diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-10-09 16:32:04 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-10-09 16:32:04 -0700 |
commit | 89a6640791144d5f562c9a5bfb70056d075633e8 (patch) | |
tree | 52df13f11404dae1cded379989df6120789d9690 /app/src/main/java/github/daneren2005/dsub/service | |
parent | a55bbbde42ed1a475e14acd2b9ce72ea84793a4b (diff) | |
download | dsub-89a6640791144d5f562c9a5bfb70056d075633e8.tar.gz dsub-89a6640791144d5f562c9a5bfb70056d075633e8.tar.bz2 dsub-89a6640791144d5f562c9a5bfb70056d075633e8.zip |
#559 Don't remove offline id's from serialized state, just from state sent to Subsonic
Diffstat (limited to 'app/src/main/java/github/daneren2005/dsub/service')
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java | 17 |
1 files changed, 11 insertions, 6 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 d057c7fd..4c8ac586 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java +++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java @@ -286,10 +286,7 @@ public class DownloadServiceLifecycleSupport { public void serializeDownloadQueueNow(List<DownloadFile> songs, boolean serializeRemote) { final PlayerQueue state = new PlayerQueue(); for (DownloadFile downloadFile : songs) { - MusicDirectory.Entry song = downloadFile.getSong(); - if(song.isOnlineId(downloadService)) { - state.songs.add(downloadFile.getSong()); - } + state.songs.add(downloadFile.getSong()); } for (DownloadFile downloadFile : downloadService.getToDelete()) { state.toDelete.add(downloadFile.getSong()); @@ -324,11 +321,19 @@ public class DownloadServiceLifecycleSupport { position = 0; } + MusicDirectory.Entry currentPlaying = state.songs.get(index); + List<MusicDirectory.Entry> songs = new ArrayList<>(); + for(MusicDirectory.Entry song: state.songs) { + if(song.isOnlineId(downloadService)) { + songs.add(song); + } + } + MusicService musicService = MusicServiceFactory.getMusicService(downloadService); - musicService.savePlayQueue(state.songs, state.songs.get(index), position, downloadService, null); - currentSavePlayQueueTask = null; + musicService.savePlayQueue(songs, currentPlaying, position, downloadService, null); } catch (Exception e) { Log.e(TAG, "Failed to save playing queue to server", e); + } finally { currentSavePlayQueueTask = null; } |