diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-01-10 20:12:32 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-01-10 20:12:32 -0800 |
commit | ac3b53f6fd64a00a121dfa19c489fe251f141362 (patch) | |
tree | 8db10899ec3033882bbecf3d8997837f22946430 /src/github/daneren2005 | |
parent | be3335ff5e4ef4ff2ba2556932aedac18be1a3d0 (diff) | |
download | dsub-ac3b53f6fd64a00a121dfa19c489fe251f141362.tar.gz dsub-ac3b53f6fd64a00a121dfa19c489fe251f141362.tar.bz2 dsub-ac3b53f6fd64a00a121dfa19c489fe251f141362.zip |
Delete podcast if skipped while near end
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r-- | src/github/daneren2005/dsub/service/DownloadServiceImpl.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadServiceImpl.java b/src/github/daneren2005/dsub/service/DownloadServiceImpl.java index 684b9227..90713466 100644 --- a/src/github/daneren2005/dsub/service/DownloadServiceImpl.java +++ b/src/github/daneren2005/dsub/service/DownloadServiceImpl.java @@ -812,6 +812,17 @@ public class DownloadServiceImpl extends Service implements DownloadService { @Override public synchronized void next() { + // Delete podcast if fully listened to + if(currentPlaying != null && currentPlaying.getSong() instanceof PodcastEpisode) { + int duration = getPlayerDuration(); + + // Make sure > 90% of the way through + int cutoffPoint = (int)(duration * 0.90); + if(duration > 0 && cachedPosition > cutoffPoint) { + toDelete.add(currentPlaying); + } + } + int index = getCurrentPlayingIndex(); int nextPlayingIndex = getNextPlayingIndex(); // Make sure to actually go to next when repeat song is on |