Skip to content

Commit

Permalink
Improved code
Browse files Browse the repository at this point in the history
  • Loading branch information
gokadzev committed Dec 20, 2023
1 parent b8baa36 commit 55c657e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/API/musify.dart
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,12 @@ Future<List<Map<String, int>>> getSkipSegments(String id) async {
}

Future<Map> getRandomSong() async {
const playlistId = 'PLgzTt0k8mXzEk586ze4BjvDXR7c-TUSnx';
final playlistSongs = await getSongsFromPlaylist(playlistId);
if (globalSongs.isEmpty) {
const playlistId = 'PLgzTt0k8mXzEk586ze4BjvDXR7c-TUSnx';
globalSongs = await getSongsFromPlaylist(playlistId);
}

return playlistSongs[random.nextInt(playlistSongs.length)];
return globalSongs[random.nextInt(globalSongs.length)];
}

Future<List> getSongsFromPlaylist(dynamic playlistId) async {
Expand Down

0 comments on commit 55c657e

Please sign in to comment.