diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-09-19 14:55:36 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-09-19 14:55:36 -0700 |
commit | 40f4baecca74fbc25f42fab83f763c1612b4089c (patch) | |
tree | e63bfd4ff110522dd0f5da06e7864f38908d826a /src | |
parent | 384b9bafeb3077cf84789e787203620591f85587 (diff) | |
download | dsub-40f4baecca74fbc25f42fab83f763c1612b4089c.tar.gz dsub-40f4baecca74fbc25f42fab83f763c1612b4089c.tar.bz2 dsub-40f4baecca74fbc25f42fab83f763c1612b4089c.zip |
#388 Add conditional scrobble logic
Diffstat (limited to 'src')
-rw-r--r-- | src/github/daneren2005/dsub/service/Scrobbler.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/github/daneren2005/dsub/service/Scrobbler.java b/src/github/daneren2005/dsub/service/Scrobbler.java index 0be11127..6772ec5d 100644 --- a/src/github/daneren2005/dsub/service/Scrobbler.java +++ b/src/github/daneren2005/dsub/service/Scrobbler.java @@ -14,11 +14,22 @@ import github.daneren2005.dsub.util.Util; * @version $Id$ */ public class Scrobbler { - private static final String TAG = Scrobbler.class.getSimpleName(); + private static final int FOUR_MINUTES = 4 * 60 * 1000; private String lastSubmission; private String lastNowPlaying; + + public void conditionalScrobble(Context context, DownloadFile song, int playerPosition, int duration) { + // More than 4 minutes + if(playerPosition > FOUR_MINUTES) { + scrobble(context, song, true); + } + // More than 50% played + else if(duration > 0 && playerPosition > (duration / 2)) { + scrobble(context, song, true); + } + } public void scrobble(final Context context, final DownloadFile song, final boolean submission) { if (song == null || !Util.isScrobblingEnabled(context)) { |