diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-09-04 17:39:05 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-09-04 17:39:05 -0700 |
commit | 0802ff8624311d9e56f45ca751154abc03c6f372 (patch) | |
tree | 895c436c46c648a0812cf3619653627bdfbdcd2a /src/github/daneren2005 | |
parent | f56982435e236235f4230c2ddc679b06790cb7eb (diff) | |
download | dsub-0802ff8624311d9e56f45ca751154abc03c6f372.tar.gz dsub-0802ff8624311d9e56f45ca751154abc03c6f372.tar.bz2 dsub-0802ff8624311d9e56f45ca751154abc03c6f372.zip |
Fixes for GenericEntryUpdater
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r-- | src/github/daneren2005/dsub/domain/MusicDirectory.java | 9 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/service/CachedMusicService.java | 20 |
2 files changed, 19 insertions, 10 deletions
diff --git a/src/github/daneren2005/dsub/domain/MusicDirectory.java b/src/github/daneren2005/dsub/domain/MusicDirectory.java index a738f9bf..5b6bab26 100644 --- a/src/github/daneren2005/dsub/domain/MusicDirectory.java +++ b/src/github/daneren2005/dsub/domain/MusicDirectory.java @@ -139,6 +139,15 @@ public class MusicDirectory implements Serializable { private Bookmark bookmark; private int type = 0; private int closeness; + + public Entry() { + + } + public Entry(Artist artist) { + this.id = artist.getId(); + this.title = artist.getName(); + this.directory = true; + } public void loadMetadata(File file) { try { diff --git a/src/github/daneren2005/dsub/service/CachedMusicService.java b/src/github/daneren2005/dsub/service/CachedMusicService.java index 58de141f..783f0b4d 100644 --- a/src/github/daneren2005/dsub/service/CachedMusicService.java +++ b/src/github/daneren2005/dsub/service/CachedMusicService.java @@ -20,6 +20,7 @@ package github.daneren2005.dsub.service; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.ListIterator; @@ -1252,7 +1253,7 @@ public class CachedMusicService implements MusicService { boolean isTagBrowsing = Util.isTagBrowsing(context, musicService.getInstance(context)); // Run through each entry, trying to update the directory it is in - List<Entry> songs; + final List<Entry> songs = new ArrayList<Entry>(); for(final Entry entry: entries) { if(isTagBrowsing) { // If starring album, needs to reference artist instead @@ -1283,39 +1284,38 @@ public class CachedMusicService implements MusicService { new IndexesUpdater(context, cacheName) { @Override public boolean checkResult(Artist check) { - return checkResult(entry, new Entry(check)); + return GenericEntryUpdater.this.checkResult(entry, new Entry(check)); } @Override public void updateResult(List<Artist> objects, Artist result) { - updateResult(new Entry(result)); + GenericEntryUpdater.this.updateResult(new Entry(result)); } }.execute(); } else { new MusicDirectoryUpdater(context, cacheName, parent) { @Override public boolean checkResult(Entry check) { - return checkResult(entry, check); + return GenericEntryUpdater.this.checkResult(entry, check); } @Override public void updateResult(List<Entry> objects, Entry result) { - updateResult(result); + GenericEntryUpdater.this.updateResult(result); } }.execute(); } if(entry instanceof PodcastEpisode) { - PodcastEpisode episode = (PodcastEpisode) entry; - new MusicDirectoryUpdater(context, cacheName, "p-" + entry.getId()) { + new MusicDirectoryUpdater(context, cacheName, "p-" + entry.getParent()) { @Override public boolean checkResult(Entry check) { - return checkResult(entry, check); + return GenericEntryUpdater.this.checkResult(entry, check); } @Override public void updateResult(List<Entry> objects, Entry result) { - updateResult(result); + GenericEntryUpdater.this.updateResult(result); } }.execute(); } else if(!entry.isDirectory()) { @@ -1329,7 +1329,7 @@ public class CachedMusicService implements MusicService { @Override public boolean checkResult(Entry check) { for(Entry entry: songs) { - if(checkResult(entry, check)) { + if(GenericEntryUpdater.this.checkResult(entry, check)) { return true; } } |