aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/service/Scrobbler.java13
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)) {