From ac3b53f6fd64a00a121dfa19c489fe251f141362 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Fri, 10 Jan 2014 20:12:32 -0800 Subject: Delete podcast if skipped while near end --- src/github/daneren2005/dsub/service/DownloadServiceImpl.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') 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 -- cgit v1.2.3