Skip to content

Commit

Permalink
fix playlist metadata status check
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaphasilor committed Nov 7, 2024
1 parent 93c4673 commit ea9ac76
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/screens/music_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,20 @@ import '../services/finamp_settings_helper.dart';
import '../services/finamp_user_helper.dart';
import '../services/jellyfin_api_helper.dart';

void postLaunchHook() async {
void postLaunchHook(WidgetRef ref) async {
final downloadsService = GetIt.instance<DownloadsService>();
final queueService = GetIt.instance<QueueService>();

// make sure playlist info is downloaded for users upgrading from older versions and new installations AFTER logging in and selecting their libraries/views
if (!FinampSettingsHelper.finampSettings.hasDownloadedPlaylistInfo) {
await downloadsService.addDefaultPlaylistInfoDownload();
// check if metadata already downloaded to avoid possible duplicates
DownloadItemStatus? status = downloadsService.getStatus(
DownloadStub.fromFinampCollection(
FinampCollection(type: FinampCollectionType.allPlaylistsMetadata)),
null);
if (status.isRequired == false) {
await downloadsService.addDefaultPlaylistInfoDownload();
}
FinampSettingsHelper.setHasDownloadedPlaylistInfo(true);
}

Expand Down Expand Up @@ -109,7 +116,7 @@ class _MusicScreenState extends ConsumerState<MusicScreen>
@override
void initState() {
super.initState();
postLaunchHook();
postLaunchHook(ref);
}

@override
Expand Down

0 comments on commit ea9ac76

Please sign in to comment.