aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2016-03-10 17:55:54 -0800
committerScott Jackson <daneren2005@gmail.com>2016-03-10 17:55:54 -0800
commit1a5fb5c35b0992ed988c2103dc47bf6c3175161e (patch)
treecbdbe27bafc0c712e07c0f41e67dc6708da17bcc /app/src/main/java
parentb12bfa078f71c3aa3f46cc65dc2ea4a6573ada18 (diff)
downloaddsub-1a5fb5c35b0992ed988c2103dc47bf6c3175161e.tar.gz
dsub-1a5fb5c35b0992ed988c2103dc47bf6c3175161e.tar.bz2
dsub-1a5fb5c35b0992ed988c2103dc47bf6c3175161e.zip
Respect the isPastCutoff params for setting a song as completely listened to
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/DownloadService.java10
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/Scrobbler.java13
2 files changed, 13 insertions, 10 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
index 96c97393..84a884ed 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
@@ -761,7 +761,7 @@ public class DownloadService extends Service {
checkAddBookmark();
}
if(currentPlaying != null) {
- scrobbler.conditionalScrobble(this, currentPlaying, position, duration);
+ scrobbler.conditionalScrobble(this, currentPlaying, position, duration, cutoff);
}
reset();
@@ -1187,7 +1187,7 @@ public class DownloadService extends Service {
clearCurrentBookmark(true);
}
if(currentPlaying != null) {
- scrobbler.conditionalScrobble(this, currentPlaying, position, duration);
+ scrobbler.conditionalScrobble(this, currentPlaying, position, duration, cutoff);
}
int index = getCurrentPlayingIndex();
@@ -1411,9 +1411,9 @@ public class DownloadService extends Service {
}
if (playerState == STARTED) {
- scrobbler.scrobble(this, currentPlaying, false);
+ scrobbler.scrobble(this, currentPlaying, false, false);
} else if (playerState == COMPLETED) {
- scrobbler.scrobble(this, currentPlaying, true);
+ scrobbler.scrobble(this, currentPlaying, true, true);
}
if(playerState == STARTED && positionCache == null) {
@@ -1459,7 +1459,7 @@ public class DownloadService extends Service {
positionCache.stop();
positionCache = null;
}
- scrobbler.scrobble(this, currentPlaying, true);
+ scrobbler.scrobble(this, currentPlaying, true, true);
onStateUpdate();
}
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)) {