Lyrics for remote tracks

This commit is contained in:
2025-12-20 01:01:12 +08:00
parent aaba0382cf
commit 7f67332590
8 changed files with 630 additions and 427 deletions

View File

@@ -3,6 +3,7 @@ import 'package:groovybox/data/db.dart' as db;
import 'package:drift/drift.dart' as drift;
import 'package:groovybox/logic/lrc_providers.dart';
import 'package:groovybox/logic/lyrics_parser.dart';
import 'package:groovybox/providers/audio_provider.dart';
import 'package:groovybox/providers/db_provider.dart';
import 'package:groovybox/ui/screens/player_screen.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
@@ -60,6 +61,16 @@ class LyricsFetcher extends _$LyricsFetcher {
debugPrint('Updated database with lyrics for track $trackId');
// Update the current track provider if this is the current track
final currentTrackNotifier = ref.read(currentTrackProvider.notifier);
final currentTrack = currentTrackNotifier.state;
if (currentTrack != null && currentTrack.id == trackId) {
// Update the current track with new lyrics
final updatedTrack = currentTrack.copyWith(lyrics: lyricsJson);
currentTrackNotifier.setTrack(updatedTrack);
debugPrint('Updated current track provider with new lyrics');
}
// Invalidate the track provider to refresh the UI
ref.invalidate(trackByPathProvider(trackPath));