fix: Login-Fehlerhandler — 200 ohne Token abfangen, Server-Nachrichten parsen

This commit is contained in:
Dustin
2026-08-01 17:44:05 +02:00
parent 7f17a5afd6
commit a495a183d8
6 changed files with 122 additions and 7 deletions
+30
View File
@@ -318,6 +318,7 @@ class DownloadService extends ChangeNotifier {
istHeruntergeladen: true,
istKorrupt: istKorrupt,
downloadQuelle: 'youtube',
ytUrl: url,
);
await _db.songEinfuegen(song);
@@ -426,6 +427,35 @@ class DownloadService extends ChangeNotifier {
}
}
/// Korrupten Song mit bekannter ytUrl neu herunterladen
Future<Song?> reDownload(Song song) async {
if (song.ytUrl == null || song.ytUrl!.isEmpty) {
_fehler = 'Keine YouTube-Quell-URL für diesen Song';
notifyListeners();
return null;
}
_resetStatus();
_aktuellerTitel = '🔄 Lade neu: ${song.titel}';
notifyListeners();
// Alten Song-Eintrag aus DB löschen
if (song.id != null) {
await _db.loeschSong(song.id!);
}
// Alte Datei löschen
try {
final alteDatei = File(song.dateiPfad);
if (await alteDatei.exists()) {
await alteDatei.delete();
}
} catch (_) {}
// Neu herunterladen mit der gespeicherten ytUrl
return _downloadEinzeln(song.ytUrl!);
}
@override
void dispose() {
abbrechen();