diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-12-14 18:02:24 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-12-14 18:02:24 -0800 |
commit | 816c72f0f0005e8d5395742894efc7c60d15c87a (patch) | |
tree | f4f5642e29ae9d9bf5cbf08facdd5dd910d17ee5 /app/src/main/java/github | |
parent | ebf3b2c85c2f4225c1564d5facd8a7243bbb30e7 (diff) | |
download | dsub-816c72f0f0005e8d5395742894efc7c60d15c87a.tar.gz dsub-816c72f0f0005e8d5395742894efc7c60d15c87a.tar.bz2 dsub-816c72f0f0005e8d5395742894efc7c60d15c87a.zip |
Fix offline id's with SongDBHandler when saving remote playlist
Diffstat (limited to 'app/src/main/java/github')
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java index 4c8ac586..4989db40 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java +++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java @@ -43,7 +43,9 @@ import github.daneren2005.dsub.domain.ServerInfo; import github.daneren2005.dsub.util.CacheCleaner; import github.daneren2005.dsub.util.Constants; import github.daneren2005.dsub.util.FileUtil; +import github.daneren2005.dsub.util.Pair; import github.daneren2005.dsub.util.SilentBackgroundTask; +import github.daneren2005.dsub.util.SongDBHandler; import github.daneren2005.dsub.util.Util; import static github.daneren2005.dsub.domain.PlayerState.PREPARING; @@ -323,8 +325,12 @@ public class DownloadServiceLifecycleSupport { MusicDirectory.Entry currentPlaying = state.songs.get(index); List<MusicDirectory.Entry> songs = new ArrayList<>(); + + SongDBHandler dbHandler = SongDBHandler.getHandler(downloadService); for(MusicDirectory.Entry song: state.songs) { - if(song.isOnlineId(downloadService)) { + Pair<Integer, String> onlineSongIds = dbHandler.getOnlineSongId(song); + if(onlineSongIds != null && onlineSongIds.getSecond() != null) { + song.setId(onlineSongIds.getSecond()); songs.add(song); } } |