UI: Alben sind Kategorien — Reiter Lieder/Kategorie/Kuenstler

Auf Wunsch von Dustin: seine beste Freundin sortiert ihre Sammlung ueber
das Album-Feld. In Melo ist der Album-Titel deshalb ab jetzt die Kategorie
— sie muss nichts neu machen.

1) Album = Kategorie
- kategorienAusTags(): Album-Titel steht VORN in der Kategorienliste (die
  erste Kategorie bestimmt das Coverbild), Genres dahinter.
- Beide Scans (android_scan + scan_service) tragen ihn ein; von Hand
  gepflegte Kategorien (categoriesEdited) bleiben unberuehrt.
- DB-Schema 9: einmalige Nachruestung bestehender Bibliotheken, damit das
  nicht erst beim naechsten vollstaendigen Scan sichtbar wird (der auf
  Android nur laeuft, wenn sich die Dateianzahl aendert).

2) Reiter: 'Songs/Kuenstler/Alben' -> 'Lieder/Kategorie/Kuenstler'
- Neu: library/category_list.dart mit groupByCategory(); Lieder ohne
  Kategorie sammeln sich am Ende unter "Ohne Kategorie".
- Entfernt: library/album_list.dart, groupByAlbum(), albumArtistLabel() —
  mit dem Alben-Reiter tot geworden. Das Album-FELD bleibt erhalten.

3) YouTube-Downloads ohne Original-Album
- Feld "Kategorie (optional)" im YouTube-Bereich, mit Vorschlaegen aus der
  Bibliothek und freier Eingabe.
- ordneDownloadEin() verwirft nach dem Scan das Album-Tag (yt-dlp leitet es
  aus Kanal/Playlist ab — als Kategorie waere das Unsinn) und setzt
  stattdessen die gewaehlte Kategorie. Beides als "von Hand gesetzt"
  markiert, damit der naechste Scan es nicht zurueckholt.
- MeloDb.songByPath() und MeloDb.verwirfAlbum() neu.
- CategoryService.alleNamen: Kategorienamen ohne zusaetzliche Abfrage —
  ohne das flackerte die Vorschlagsliste und im Widget-Test blieb ein
  Aufraeum-Timer von drift haengen.

295 Tests gruen (19 neue, 1 uebersprungen), flutter analyze ohne Befund.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FpPu4nuKjKKeX1RpdDeX81
This commit is contained in:
Hermes (Server)
2026-08-21 09:36:46 +02:00
co-authored by Claude Opus 5
parent cd79213bb3
commit c7a7a7c458
17 changed files with 726 additions and 157 deletions
+1 -46
View File
@@ -67,49 +67,4 @@ void main() {
expect(groupByArtist(const []), isEmpty);
});
});
group('groupByAlbum', () {
test('gruppiert mehrere Alben getrennt', () {
final songs = [
_song(id: '1', title: 'A', album: 'Best Of'),
_song(id: '2', title: 'B', album: 'Anthology'),
];
final grouped = groupByAlbum(songs);
expect(grouped.keys.toList(), ['Anthology', 'Best Of']);
});
test('gruppiert Songs ohne Album unter "Unbekanntes Album"', () {
final songs = [_song(id: '1', title: 'A', album: null)];
final grouped = groupByAlbum(songs);
expect(grouped.keys, [unbekanntesAlbum]);
});
test('leere Liste ergibt leere Map', () {
expect(groupByAlbum(const []), isEmpty);
});
});
group('albumArtistLabel', () {
test('zeigt gemeinsamen Künstler, wenn alle Songs von ihm stammen', () {
final songs = [
_song(id: '1', title: 'A', artist: 'Alice', album: 'X'),
_song(id: '2', title: 'B', artist: 'Alice', album: 'X'),
];
expect(albumArtistLabel(songs), 'Alice');
});
test('zeigt "Verschiedene Interpreten" bei unterschiedlichen Künstlern', () {
final songs = [
_song(id: '1', title: 'A', artist: 'Alice', album: 'X'),
_song(id: '2', title: 'B', artist: 'Bob', album: 'X'),
];
expect(albumArtistLabel(songs), 'Verschiedene Interpreten');
});
});
}
}