📋 Feature: Playlisten-Sync vom Navidrome-Server (Phase 2, Part 6/X)
- getPlaylists() + getPlaylistSongs() APIs für Subsonic-Playlist-Laden - syncPlaylistsFromServer() in PlaylistService importiert alle Server-Playlisten als lokale - Benennung mit 🌐 Präfix um Server-Playlisten zu kennzeichnen - Settings-Button lädt alle Playlisten mit ihren Songs vom Server - Zeigt Anzahl importierter Playlisten mit SnackBar Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XJzQjUtnvYUtHdnTs3iCru
This commit is contained in:
co-authored by
Claude Haiku 4.5
parent
95cbd093e8
commit
221e6fd923
@@ -114,6 +114,16 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
onPressed: () => _syncServerFavorites(),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.playlist_play),
|
||||
title: const Text('📋 Playlisten-Sync'),
|
||||
subtitle: const Text('Server-Playlisten importieren'),
|
||||
trailing: IconButton(
|
||||
tooltip: 'Vom Server laden',
|
||||
icon: const Icon(Icons.cloud_download),
|
||||
onPressed: () => _syncServerPlaylists(),
|
||||
),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
const _SectionLabel('Berechtigungen'),
|
||||
ListTile(
|
||||
@@ -275,6 +285,28 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _syncServerPlaylists() async {
|
||||
final playlistService = context.read<PlaylistService>();
|
||||
if (!mounted) return;
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Lade Playlisten vom Server...')),
|
||||
);
|
||||
|
||||
final count = await playlistService.syncPlaylistsFromServer();
|
||||
if (mounted) {
|
||||
if (count == 0) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('❌ Server nicht verbunden oder keine Playlisten')),
|
||||
);
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('✅ $count Playlisten importiert')),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String _formatBytes(int bytes) {
|
||||
if (bytes < 1024) return '$bytes B';
|
||||
if (bytes < 1024 * 1024) return '${(bytes / 1024).toStringAsFixed(1)} KB';
|
||||
|
||||
Reference in New Issue
Block a user