diff options
Diffstat (limited to 'app/src/main/java/github/daneren2005/dsub/service/Scrobbler.java')
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/service/Scrobbler.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/service/Scrobbler.java b/app/src/main/java/github/daneren2005/dsub/service/Scrobbler.java index 1d9fecef..168a7777 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/Scrobbler.java +++ b/app/src/main/java/github/daneren2005/dsub/service/Scrobbler.java @@ -3,6 +3,7 @@ package github.daneren2005.dsub.service; import android.content.Context; import android.util.Log; +import github.daneren2005.dsub.domain.MusicDirectory; import github.daneren2005.dsub.domain.PodcastEpisode; import github.daneren2005.dsub.util.SilentBackgroundTask; import github.daneren2005.dsub.util.SongDBHandler; @@ -21,18 +22,18 @@ public class Scrobbler { private String lastSubmission; private String lastNowPlaying; - public void conditionalScrobble(Context context, DownloadFile song, int playerPosition, int duration) { + public void conditionalScrobble(Context context, DownloadFile song, int playerPosition, int duration, boolean isPastCutoff) { // More than 4 minutes if(playerPosition > FOUR_MINUTES) { - scrobble(context, song, true); + scrobble(context, song, true, isPastCutoff); } // More than 50% played else if(duration > 0 && playerPosition > (duration / 2)) { - scrobble(context, song, true); + scrobble(context, song, true, isPastCutoff); } } - public void scrobble(final Context context, final DownloadFile song, final boolean submission) { + public void scrobble(final Context context, final DownloadFile song, final boolean submission, final boolean isPastCutoff) { if(song == null) { return; } @@ -55,7 +56,9 @@ public class Scrobbler { new SilentBackgroundTask<Void>(context) { @Override protected Void doInBackground() { - SongDBHandler.getHandler(context).setSongPlayed(song, submission); + if(isPastCutoff) { + SongDBHandler.getHandler(context).setSongPlayed(song, submission); + } // Scrobbling disabled if (!Util.isScrobblingEnabled(context)) { |