Melo v2.10 - YouTube Proxy, Download-Screen, Logger, iOS

This commit is contained in:
Hermes (Server)
2026-07-26 14:24:10 +02:00
parent b4baef5875
commit 3e9389ab59
17 changed files with 1065 additions and 347 deletions
+24 -12
View File
@@ -100,27 +100,38 @@ class NavidromeService {
try {
final r = await http.get(_uri('ping.view')).timeout(const Duration(seconds: 10));
return r.statusCode == 200;
} catch (_) {
} catch (e) {
debugPrint('Navidrome Ping Fehler: $e');
return false;
}
}
/// Alle Alben abrufen
Future<List<SubsonicAlbum>> getAlben({int anzahl = 50}) async {
final r = await http.get(_uri('getAlbumList.view', {'type': 'newest', 'size': '$anzahl'})).timeout(const Duration(seconds: 15));
if (r.statusCode != 200) return [];
final data = jsonDecode(r.body);
final list = data['subsonic-response']?['albumList']?['album'] as List? ?? [];
return list.map((j) => SubsonicAlbum.fromJson(j)).toList();
try {
final r = await http.get(_uri('getAlbumList.view', {'type': 'newest', 'size': '$anzahl'})).timeout(const Duration(seconds: 15));
if (r.statusCode != 200) return [];
final data = jsonDecode(r.body);
final list = data['subsonic-response']?['albumList']?['album'] as List? ?? [];
return list.map((j) => SubsonicAlbum.fromJson(j)).toList();
} catch (e) {
debugPrint('Navidrome getAlben Fehler: $e');
return [];
}
}
/// Songs eines Albums abrufen
Future<List<SubsonicSong>> getSongs(String albumId) async {
final r = await http.get(_uri('getAlbum.view', {'id': albumId})).timeout(const Duration(seconds: 15));
if (r.statusCode != 200) return [];
final data = jsonDecode(r.body);
final songs = data['subsonic-response']?['album']?['song'] as List? ?? [];
return songs.map((j) => SubsonicSong.fromJson(j)).toList();
try {
final r = await http.get(_uri('getAlbum.view', {'id': albumId})).timeout(const Duration(seconds: 15));
if (r.statusCode != 200) return [];
final data = jsonDecode(r.body);
final songs = data['subsonic-response']?['album']?['song'] as List? ?? [];
return songs.map((j) => SubsonicSong.fromJson(j)).toList();
} catch (e) {
debugPrint('Navidrome getSongs Fehler: $e');
return [];
}
}
/// Song-Stream-URL
@@ -141,7 +152,8 @@ class NavidromeService {
if (!await musikDir.exists()) await musikDir.create(recursive: true);
final safeName = s.titel.replaceAll(RegExp(r'[^\w\s-]'), '').trim();
final dateiName = '${safeName.isEmpty ? "song" : safeName}.mp3';
final kurzId = s.id.length > 8 ? s.id.substring(0, 8) : s.id;
final dateiName = '${safeName.isEmpty ? "song" : safeName}_$kurzId.mp3';
final dateiPfad = '${musikDir.path}/$dateiName';
final file = File(dateiPfad);