aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java
index 1a6658e3..9c87096c 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java
@@ -53,6 +53,7 @@ import github.daneren2005.dsub.domain.Share;
import github.daneren2005.dsub.domain.User;
import github.daneren2005.dsub.util.SilentBackgroundTask;
import github.daneren2005.dsub.util.ProgressListener;
+import github.daneren2005.dsub.util.SyncUtil;
import github.daneren2005.dsub.util.TimeLimitedCache;
import github.daneren2005.dsub.util.FileUtil;
import github.daneren2005.dsub.util.Util;
@@ -259,6 +260,26 @@ public class CachedMusicService implements MusicService {
if(cachedPlaylist == null || !playlistFile.exists() || !cachedPlaylist.getChildren().equals(dir.getChildren())) {
FileUtil.writePlaylistFile(context, playlistFile, dir);
}
+
+ if(cachedPlaylist != null) {
+ // Make sure this playlist is supposed to be synced
+ ArrayList<SyncUtil.SyncSet> playlistList = SyncUtil.getSyncedPlaylists(context, musicService.getInstance(context));
+ for(int i = 0; i < playlistList.size(); i++) {
+ SyncUtil.SyncSet syncPlaylist = playlistList.get(i);
+ if(syncPlaylist.id != null && syncPlaylist.id.equals(id)) {
+ List<Entry> toDelete = cachedPlaylist.getChildren();
+ for (Entry entry : dir.getChildren()) {
+ toDelete.remove(entry);
+ }
+
+ for (Entry entry : toDelete) {
+ DownloadFile file = new DownloadFile(context, entry, true);
+ file.unpin();
+ }
+ break;
+ }
+ }
+ }
}
return dir;
}