diff options
author | daneren2005 <daneren2005@gmail.com> | 2013-12-04 14:40:05 -0800 |
---|---|---|
committer | daneren2005 <daneren2005@gmail.com> | 2013-12-04 14:40:05 -0800 |
commit | 28654256a22bcaaf72074ef0247f9fbc9d8d65f8 (patch) | |
tree | 05961603f869f84a6c6db52213c165c9924de660 | |
parent | d9e41e7508ec31f9cfd486b5f715e323fc76fdb4 (diff) | |
download | dsub-28654256a22bcaaf72074ef0247f9fbc9d8d65f8.tar.gz dsub-28654256a22bcaaf72074ef0247f9fbc9d8d65f8.tar.bz2 dsub-28654256a22bcaaf72074ef0247f9fbc9d8d65f8.zip |
#160 Automatically delete fully listened to podcasts
-rw-r--r-- | src/github/daneren2005/dsub/service/DownloadServiceImpl.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadServiceImpl.java b/src/github/daneren2005/dsub/service/DownloadServiceImpl.java index 56f79a0e..abee1153 100644 --- a/src/github/daneren2005/dsub/service/DownloadServiceImpl.java +++ b/src/github/daneren2005/dsub/service/DownloadServiceImpl.java @@ -31,6 +31,7 @@ import github.daneren2005.dsub.audiofx.VisualizerController; import github.daneren2005.dsub.domain.Bookmark; import github.daneren2005.dsub.domain.MusicDirectory; import github.daneren2005.dsub.domain.PlayerState; +import github.daneren2005.dsub.domain.PodcastEpisode; import github.daneren2005.dsub.domain.RemoteControlState; import github.daneren2005.dsub.domain.RepeatMode; import github.daneren2005.dsub.receiver.MediaButtonIntentReceiver; @@ -509,6 +510,15 @@ public class DownloadServiceImpl extends Service implements DownloadService { } public synchronized void clear(boolean serialize) { + // Delete podcast if fully listened to + if(currentPlaying != null && currentPlaying.getSong() instanceof PodcastEpisode) { + // Make sure > 95% of the way through + int cutoffPoint = getPlayerDuration() * 0.95; + if(duration > 0 && cachedPosition > cutoffPoint) { + currentPlaying.delete(); + } + } + reset(); downloadList.clear(); revision++; |