Kategorien (mehrere je Song), Metadaten-Ansicht mit Expertenmodus

- DB-Schema 4: Tabelle song_categories + Spalte categories_edited
- Kategorien kommen aus dem Genre-Tag (Trennung an ; , | /), manuell
  bearbeitbar; von Hand gesetzte Kategorien ueberlebt der naechste Scan
- Songzeile zeigt "Kuenstler | Kategorie1 - Kategorie2"
- Einstellung "Gleiche Kategorie = gleiches Coverbild" (Standard an)
- Metadaten-Sheet mit ausklappbarem Expertenmodus
- Neu: categories.dart, category_service.dart, song_detail_sheet.dart,
  app_settings.dart

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:29:45 +02:00
co-authored by Claude Opus 5
parent 2667613a2e
commit 7aa98864aa
22 changed files with 1792 additions and 10 deletions
+10
View File
@@ -6,6 +6,7 @@ import 'package:path/path.dart' as p;
import 'package:path_provider/path_provider.dart';
import 'package:uuid/uuid.dart';
import 'categories.dart';
import 'database.dart';
const _audioExt = {
@@ -45,6 +46,9 @@ Future<int> scanFolders(
final now = DateTime.now().millisecondsSinceEpoch;
final companions = <SongsCompanion>[];
// Kategorien werden erst nach dem Upsert geschrieben — vorher gibt es die
// Songzeile noch nicht, auf die sie verweisen.
final categories = <String, List<String>>{};
var done = 0;
if (files.isNotEmpty) onProgress?.call(0, files.length);
@@ -89,6 +93,9 @@ Future<int> scanFolders(
updatedAtMs: now,
deleted: const Value(false),
));
if (prev?.categoriesEdited != true) {
categories[id] = parseCategoryList(meta?.genres ?? const []);
}
++done;
if (done % 50 == 0 || done == files.length) {
onProgress?.call(done, files.length);
@@ -96,6 +103,9 @@ Future<int> scanFolders(
}
await db.upsertSongs(companions);
for (final entry in categories.entries) {
await db.setCategories(entry.key, entry.value);
}
if (companions.isNotEmpty) {
await db.markMissing(now);
}