From 6b6b3bcbcf47de353ff7ad3f82d6c6228a04c9d8 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Wed, 22 Oct 2014 16:10:09 -0700 Subject: #415 Don't auto delete bookmarks made with 10 seconds of current position --- src/github/daneren2005/dsub/service/DownloadService.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java index 08516cfd..8d9f6867 100644 --- a/src/github/daneren2005/dsub/service/DownloadService.java +++ b/src/github/daneren2005/dsub/service/DownloadService.java @@ -1890,7 +1890,18 @@ public class DownloadService extends Service { } private boolean isPastCutoff(int position, int duration) { int cutoffPoint = (int) (duration * DELETE_CUTOFF); - return duration > 0 && position > cutoffPoint; + boolean isPastCutoff = duration > 0 && position > cutoffPoint; + + // Check to make sure song isn't within 10 seconds of where it was created + MusicDirectory.Entry entry = currentPlaying.getSong(); + if(entry != null && entry.getBookmark() != null) { + Bookmark bookmark = entry.getBookmark(); + if(position < (bookmark.getPosition() + 10000)) { + isPastCutoff = false; + } + } + + return isPastCutoff; } private void clearCurrentBookmark() { -- cgit v1.2.3