diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-08-30 12:59:07 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-08-30 12:59:07 -0700 |
commit | dea9f0d5e91b59b370d630839a22515d593e899f (patch) | |
tree | e22b4451a990130e1f1d82b3509d3ae39415a97f | |
parent | b0b3636a441ec63ac4c5d957ce9987c70eed8cd2 (diff) | |
download | dsub-dea9f0d5e91b59b370d630839a22515d593e899f.tar.gz dsub-dea9f0d5e91b59b370d630839a22515d593e899f.tar.bz2 dsub-dea9f0d5e91b59b370d630839a22515d593e899f.zip |
Get type from xml so podcasts played from other places (ie: Bookmarks tab) can be auto bookmarked
4 files changed, 28 insertions, 2 deletions
diff --git a/src/github/daneren2005/dsub/domain/MusicDirectory.java b/src/github/daneren2005/dsub/domain/MusicDirectory.java index 3d199522..1caf77cf 100644 --- a/src/github/daneren2005/dsub/domain/MusicDirectory.java +++ b/src/github/daneren2005/dsub/domain/MusicDirectory.java @@ -107,6 +107,10 @@ public class MusicDirectory implements Serializable { } public static class Entry implements Serializable { + public static final int TYPE_SONG = 0; + public static final int TYPE_PODCAST = 1; + public static final int TYPE_AUDIO_BOOK = 2; + private String id; private String parent; private String grandParent; @@ -133,7 +137,7 @@ public class MusicDirectory implements Serializable { private boolean starred; private Integer rating; private Bookmark bookmark; - private int type; + private int type = 0; private int closeness; public void loadMetadata(File file) { @@ -409,6 +413,22 @@ public class MusicDirectory implements Serializable { public void setBookmark(Bookmark bookmark) { this.bookmark = bookmark; } + + public int getType() { + return type; + } + public void setType(int type) { + this.type = type; + } + public boolean isSong() { + return type == TYPE_SONG; + } + public boolean isPodcast() { + return this instanceof PodcastEpisode || type == TYPE_PODCAST; + } + public boolean isAudiBook() { + return type == TYPE_AUDIO_BOOK; + } public int getCloseness() { return closeness; diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java index 7c23f595..fa09a060 100644 --- a/src/github/daneren2005/dsub/service/DownloadService.java +++ b/src/github/daneren2005/dsub/service/DownloadService.java @@ -1860,7 +1860,7 @@ public class DownloadService extends Service { int duration = getPlayerDuration(); // If song is podcast or long go ahead and auto add a bookmark - if(entry instanceof PodcastEpisode || duration > (10L * 60L * 1000L)) { + if(entry.isPodcast() || duration > (10L * 60L * 1000L)) { final Context context = this; final int position = getPlayerPosition(); diff --git a/src/github/daneren2005/dsub/service/parser/MusicDirectoryEntryParser.java b/src/github/daneren2005/dsub/service/parser/MusicDirectoryEntryParser.java index 67effc24..1dc22ff9 100644 --- a/src/github/daneren2005/dsub/service/parser/MusicDirectoryEntryParser.java +++ b/src/github/daneren2005/dsub/service/parser/MusicDirectoryEntryParser.java @@ -66,6 +66,11 @@ public class MusicDirectoryEntryParser extends AbstractParser { if(bookmark != null) { entry.setBookmark(new Bookmark(bookmark)); } + + String type = get("type"); + if("podcast".equals(type)) { + entry.setType(MusicDirectory.Entry.TYPE_PODCAST); + } } else if(!"".equals(artist)) { entry.setPath(artist + "/" + entry.getTitle()); } diff --git a/src/github/daneren2005/dsub/service/parser/PodcastEntryParser.java b/src/github/daneren2005/dsub/service/parser/PodcastEntryParser.java index afd861f0..fe742819 100644 --- a/src/github/daneren2005/dsub/service/parser/PodcastEntryParser.java +++ b/src/github/daneren2005/dsub/service/parser/PodcastEntryParser.java @@ -93,6 +93,7 @@ public class PodcastEntryParser extends AbstractParser { if(bookmark != null) {
episode.setBookmark(new Bookmark(bookmark));
}
+ episode.setType(MusicDirectory.Entry.TYPE_PODCAST);
if(episode.getId() == null) {
episode.setId(String.valueOf(bogusId));
|