Songtext aus Datei-Tags, Warteschlangen-Aktionen, Kategorie-Cover im

Sperrbildschirm und ReplayGain

- DB-Schema 6: lyrics + gain_db
- Songtext bevorzugt lokalen Tag, Server nur als Rueckfall; Song-ID-Bug
  beim Lyrics-Aufruf behoben
- "Als Naechstes spielen" / "Zur Warteschlange hinzufuegen" ohne Eingriff
  in Favoriten oder Wiedergabelisten
- songToMediaItem nimmt eine Cover-Vorgabe: Sperrbildschirm zeigt das
  Kategorie-Cover
- ReplayGain: Tags werden gelesen, laute Titel abgesenkt, abschaltbar

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011snPXPafPC5i87o68H14W7
This commit is contained in:
2026-08-20 18:41:36 +02:00
co-authored by Claude Opus 5
parent 1325badf90
commit 4ebd0a8dd4
17 changed files with 534 additions and 46 deletions
+140 -2
View File
@@ -140,6 +140,24 @@ class $SongsTable extends Songs with TableInfo<$SongsTable, Song> {
),
defaultValue: const Constant(false),
);
static const VerificationMeta _lyricsMeta = const VerificationMeta('lyrics');
@override
late final GeneratedColumn<String> lyrics = GeneratedColumn<String>(
'lyrics',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _gainDbMeta = const VerificationMeta('gainDb');
@override
late final GeneratedColumn<double> gainDb = GeneratedColumn<double>(
'gain_db',
aliasedName,
true,
type: DriftSqlType.double,
requiredDuringInsert: false,
);
@override
List<GeneratedColumn> get $columns => [
id,
@@ -154,6 +172,8 @@ class $SongsTable extends Songs with TableInfo<$SongsTable, Song> {
deleted,
playCount,
categoriesEdited,
lyrics,
gainDb,
];
@override
String get aliasedName => _alias ?? actualTableName;
@@ -255,6 +275,18 @@ class $SongsTable extends Songs with TableInfo<$SongsTable, Song> {
),
);
}
if (data.containsKey('lyrics')) {
context.handle(
_lyricsMeta,
lyrics.isAcceptableOrUnknown(data['lyrics']!, _lyricsMeta),
);
}
if (data.containsKey('gain_db')) {
context.handle(
_gainDbMeta,
gainDb.isAcceptableOrUnknown(data['gain_db']!, _gainDbMeta),
);
}
return context;
}
@@ -312,6 +344,14 @@ class $SongsTable extends Songs with TableInfo<$SongsTable, Song> {
DriftSqlType.bool,
data['${effectivePrefix}categories_edited'],
)!,
lyrics: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}lyrics'],
),
gainDb: attachedDatabase.typeMapping.read(
DriftSqlType.double,
data['${effectivePrefix}gain_db'],
),
);
}
@@ -340,6 +380,14 @@ class Song extends DataClass implements Insertable<Song> {
/// Sobald die Kategorien eines Songs von Hand geändert wurden, überschreibt
/// ein erneuter Scan sie nicht mehr mit dem Genre-Tag der Datei.
final bool categoriesEdited;
/// Songtext aus dem Tag der Datei — Grundlage für den automatischen
/// Songtext ohne Server.
final String? lyrics;
/// ReplayGain des Titels in Dezibel, sofern die Datei den Tag mitbringt —
/// Grundlage für "Gleiche Lautstärke".
final double? gainDb;
const Song({
required this.id,
required this.path,
@@ -353,6 +401,8 @@ class Song extends DataClass implements Insertable<Song> {
required this.deleted,
required this.playCount,
required this.categoriesEdited,
this.lyrics,
this.gainDb,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
@@ -377,6 +427,12 @@ class Song extends DataClass implements Insertable<Song> {
map['deleted'] = Variable<bool>(deleted);
map['play_count'] = Variable<int>(playCount);
map['categories_edited'] = Variable<bool>(categoriesEdited);
if (!nullToAbsent || lyrics != null) {
map['lyrics'] = Variable<String>(lyrics);
}
if (!nullToAbsent || gainDb != null) {
map['gain_db'] = Variable<double>(gainDb);
}
return map;
}
@@ -402,6 +458,12 @@ class Song extends DataClass implements Insertable<Song> {
deleted: Value(deleted),
playCount: Value(playCount),
categoriesEdited: Value(categoriesEdited),
lyrics: lyrics == null && nullToAbsent
? const Value.absent()
: Value(lyrics),
gainDb: gainDb == null && nullToAbsent
? const Value.absent()
: Value(gainDb),
);
}
@@ -423,6 +485,8 @@ class Song extends DataClass implements Insertable<Song> {
deleted: serializer.fromJson<bool>(json['deleted']),
playCount: serializer.fromJson<int>(json['playCount']),
categoriesEdited: serializer.fromJson<bool>(json['categoriesEdited']),
lyrics: serializer.fromJson<String?>(json['lyrics']),
gainDb: serializer.fromJson<double?>(json['gainDb']),
);
}
@override
@@ -441,6 +505,8 @@ class Song extends DataClass implements Insertable<Song> {
'deleted': serializer.toJson<bool>(deleted),
'playCount': serializer.toJson<int>(playCount),
'categoriesEdited': serializer.toJson<bool>(categoriesEdited),
'lyrics': serializer.toJson<String?>(lyrics),
'gainDb': serializer.toJson<double?>(gainDb),
};
}
@@ -457,6 +523,8 @@ class Song extends DataClass implements Insertable<Song> {
bool? deleted,
int? playCount,
bool? categoriesEdited,
Value<String?> lyrics = const Value.absent(),
Value<double?> gainDb = const Value.absent(),
}) => Song(
id: id ?? this.id,
path: path ?? this.path,
@@ -470,6 +538,8 @@ class Song extends DataClass implements Insertable<Song> {
deleted: deleted ?? this.deleted,
playCount: playCount ?? this.playCount,
categoriesEdited: categoriesEdited ?? this.categoriesEdited,
lyrics: lyrics.present ? lyrics.value : this.lyrics,
gainDb: gainDb.present ? gainDb.value : this.gainDb,
);
Song copyWithCompanion(SongsCompanion data) {
return Song(
@@ -493,6 +563,8 @@ class Song extends DataClass implements Insertable<Song> {
categoriesEdited: data.categoriesEdited.present
? data.categoriesEdited.value
: this.categoriesEdited,
lyrics: data.lyrics.present ? data.lyrics.value : this.lyrics,
gainDb: data.gainDb.present ? data.gainDb.value : this.gainDb,
);
}
@@ -510,7 +582,9 @@ class Song extends DataClass implements Insertable<Song> {
..write('updatedAtMs: $updatedAtMs, ')
..write('deleted: $deleted, ')
..write('playCount: $playCount, ')
..write('categoriesEdited: $categoriesEdited')
..write('categoriesEdited: $categoriesEdited, ')
..write('lyrics: $lyrics, ')
..write('gainDb: $gainDb')
..write(')'))
.toString();
}
@@ -529,6 +603,8 @@ class Song extends DataClass implements Insertable<Song> {
deleted,
playCount,
categoriesEdited,
lyrics,
gainDb,
);
@override
bool operator ==(Object other) =>
@@ -545,7 +621,9 @@ class Song extends DataClass implements Insertable<Song> {
other.updatedAtMs == this.updatedAtMs &&
other.deleted == this.deleted &&
other.playCount == this.playCount &&
other.categoriesEdited == this.categoriesEdited);
other.categoriesEdited == this.categoriesEdited &&
other.lyrics == this.lyrics &&
other.gainDb == this.gainDb);
}
class SongsCompanion extends UpdateCompanion<Song> {
@@ -561,6 +639,8 @@ class SongsCompanion extends UpdateCompanion<Song> {
final Value<bool> deleted;
final Value<int> playCount;
final Value<bool> categoriesEdited;
final Value<String?> lyrics;
final Value<double?> gainDb;
final Value<int> rowid;
const SongsCompanion({
this.id = const Value.absent(),
@@ -575,6 +655,8 @@ class SongsCompanion extends UpdateCompanion<Song> {
this.deleted = const Value.absent(),
this.playCount = const Value.absent(),
this.categoriesEdited = const Value.absent(),
this.lyrics = const Value.absent(),
this.gainDb = const Value.absent(),
this.rowid = const Value.absent(),
});
SongsCompanion.insert({
@@ -590,6 +672,8 @@ class SongsCompanion extends UpdateCompanion<Song> {
this.deleted = const Value.absent(),
this.playCount = const Value.absent(),
this.categoriesEdited = const Value.absent(),
this.lyrics = const Value.absent(),
this.gainDb = const Value.absent(),
this.rowid = const Value.absent(),
}) : id = Value(id),
path = Value(path),
@@ -609,6 +693,8 @@ class SongsCompanion extends UpdateCompanion<Song> {
Expression<bool>? deleted,
Expression<int>? playCount,
Expression<bool>? categoriesEdited,
Expression<String>? lyrics,
Expression<double>? gainDb,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
@@ -624,6 +710,8 @@ class SongsCompanion extends UpdateCompanion<Song> {
if (deleted != null) 'deleted': deleted,
if (playCount != null) 'play_count': playCount,
if (categoriesEdited != null) 'categories_edited': categoriesEdited,
if (lyrics != null) 'lyrics': lyrics,
if (gainDb != null) 'gain_db': gainDb,
if (rowid != null) 'rowid': rowid,
});
}
@@ -641,6 +729,8 @@ class SongsCompanion extends UpdateCompanion<Song> {
Value<bool>? deleted,
Value<int>? playCount,
Value<bool>? categoriesEdited,
Value<String?>? lyrics,
Value<double?>? gainDb,
Value<int>? rowid,
}) {
return SongsCompanion(
@@ -656,6 +746,8 @@ class SongsCompanion extends UpdateCompanion<Song> {
deleted: deleted ?? this.deleted,
playCount: playCount ?? this.playCount,
categoriesEdited: categoriesEdited ?? this.categoriesEdited,
lyrics: lyrics ?? this.lyrics,
gainDb: gainDb ?? this.gainDb,
rowid: rowid ?? this.rowid,
);
}
@@ -699,6 +791,12 @@ class SongsCompanion extends UpdateCompanion<Song> {
if (categoriesEdited.present) {
map['categories_edited'] = Variable<bool>(categoriesEdited.value);
}
if (lyrics.present) {
map['lyrics'] = Variable<String>(lyrics.value);
}
if (gainDb.present) {
map['gain_db'] = Variable<double>(gainDb.value);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
@@ -720,6 +818,8 @@ class SongsCompanion extends UpdateCompanion<Song> {
..write('deleted: $deleted, ')
..write('playCount: $playCount, ')
..write('categoriesEdited: $categoriesEdited, ')
..write('lyrics: $lyrics, ')
..write('gainDb: $gainDb, ')
..write('rowid: $rowid')
..write(')'))
.toString();
@@ -2598,6 +2698,8 @@ typedef $$SongsTableCreateCompanionBuilder =
Value<bool> deleted,
Value<int> playCount,
Value<bool> categoriesEdited,
Value<String?> lyrics,
Value<double?> gainDb,
Value<int> rowid,
});
typedef $$SongsTableUpdateCompanionBuilder =
@@ -2614,6 +2716,8 @@ typedef $$SongsTableUpdateCompanionBuilder =
Value<bool> deleted,
Value<int> playCount,
Value<bool> categoriesEdited,
Value<String?> lyrics,
Value<double?> gainDb,
Value<int> rowid,
});
@@ -2764,6 +2868,16 @@ class $$SongsTableFilterComposer extends Composer<_$MeloDb, $SongsTable> {
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get lyrics => $composableBuilder(
column: $table.lyrics,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<double> get gainDb => $composableBuilder(
column: $table.gainDb,
builder: (column) => ColumnFilters(column),
);
Expression<bool> playlistSongsRefs(
Expression<bool> Function($$PlaylistSongsTableFilterComposer f) f,
) {
@@ -2932,6 +3046,16 @@ class $$SongsTableOrderingComposer extends Composer<_$MeloDb, $SongsTable> {
column: $table.categoriesEdited,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get lyrics => $composableBuilder(
column: $table.lyrics,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<double> get gainDb => $composableBuilder(
column: $table.gainDb,
builder: (column) => ColumnOrderings(column),
);
}
class $$SongsTableAnnotationComposer extends Composer<_$MeloDb, $SongsTable> {
@@ -2986,6 +3110,12 @@ class $$SongsTableAnnotationComposer extends Composer<_$MeloDb, $SongsTable> {
builder: (column) => column,
);
GeneratedColumn<String> get lyrics =>
$composableBuilder(column: $table.lyrics, builder: (column) => column);
GeneratedColumn<double> get gainDb =>
$composableBuilder(column: $table.gainDb, builder: (column) => column);
Expression<T> playlistSongsRefs<T extends Object>(
Expression<T> Function($$PlaylistSongsTableAnnotationComposer a) f,
) {
@@ -3132,6 +3262,8 @@ class $$SongsTableTableManager
Value<bool> deleted = const Value.absent(),
Value<int> playCount = const Value.absent(),
Value<bool> categoriesEdited = const Value.absent(),
Value<String?> lyrics = const Value.absent(),
Value<double?> gainDb = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => SongsCompanion(
id: id,
@@ -3146,6 +3278,8 @@ class $$SongsTableTableManager
deleted: deleted,
playCount: playCount,
categoriesEdited: categoriesEdited,
lyrics: lyrics,
gainDb: gainDb,
rowid: rowid,
),
createCompanionCallback:
@@ -3162,6 +3296,8 @@ class $$SongsTableTableManager
Value<bool> deleted = const Value.absent(),
Value<int> playCount = const Value.absent(),
Value<bool> categoriesEdited = const Value.absent(),
Value<String?> lyrics = const Value.absent(),
Value<double?> gainDb = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => SongsCompanion.insert(
id: id,
@@ -3176,6 +3312,8 @@ class $$SongsTableTableManager
deleted: deleted,
playCount: playCount,
categoriesEdited: categoriesEdited,
lyrics: lyrics,
gainDb: gainDb,
rowid: rowid,
),
withReferenceMapper: (p0) => p0