aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-10-27 16:11:45 -0700
committerScott Jackson <daneren2005@gmail.com>2014-10-27 16:11:45 -0700
commit805d1067441c31a3dececb1287115fb99ea1ea4d (patch)
tree0723af512c036ab6695fe1649e54a4b9a4a8dfa0 /src
parent666f6bb24019e5b8e74f5754049eda6983b7cdba (diff)
downloaddsub-805d1067441c31a3dececb1287115fb99ea1ea4d.tar.gz
dsub-805d1067441c31a3dececb1287115fb99ea1ea4d.tar.bz2
dsub-805d1067441c31a3dececb1287115fb99ea1ea4d.zip
#415 Improve bookmark logic when playing a series of audio books
For audio books we want to modify the automatic creation of deletion of bookmarks. An example of what this is supposed to handle: Start in chapter 8 from bookmark, continue to chapter to 9 of 10. At position 8:50 of 10:00. Start playing some music. Current behavior is that this will have deleted a bookmark from 8 and not create one at 9. Now, it will create one at 9 since there is still another chapter to read.
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/service/DownloadService.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java
index a5b647a9..afa91d90 100644
--- a/src/github/daneren2005/dsub/service/DownloadService.java
+++ b/src/github/daneren2005/dsub/service/DownloadService.java
@@ -575,7 +575,7 @@ public class DownloadService extends Service {
// Delete podcast if fully listened to
int position = getPlayerPosition();
int duration = getPlayerDuration();
- boolean cutoff = isPastCutoff(position, duration);
+ boolean cutoff = isPastCutoff(position, duration, true);
if(currentPlaying != null && currentPlaying.getSong() instanceof PodcastEpisode) {
if(cutoff) {
currentPlaying.delete();
@@ -1888,6 +1888,9 @@ public class DownloadService extends Service {
return isPastCutoff(getPlayerPosition(), getPlayerDuration());
}
private boolean isPastCutoff(int position, int duration) {
+ return isPastCutoff(position, duration, false);
+ }
+ private boolean isPastCutoff(int position, int duration, boolean allowSkipping) {
if(currentPlaying == null) {
return false;
}
@@ -1904,6 +1907,18 @@ public class DownloadService extends Service {
}
}
+ // Check to make sure we aren't in a series of similar content before deleting bookmark
+ if(isPastCutoff && allowSkipping) {
+ // Check to make sure:
+ // Is an audio book
+ // Next playing exists and is not a wrap around or a shuffle
+ // Next playing is from same context as current playing, so not at end of list
+ if(entry.isAudioBook() && nextPlaying != null && downloadList.indexOf(nextPlaying) != 0 && !shuffleMode && !shuffleRemote
+ && entry.getParent() != null && entry.getParent().equals(nextPlaying.getSong().getParent())) {
+ isPastCutoff = false;
+ }
+ }
+
return isPastCutoff;
}