aboutsummaryrefslogtreecommitdiff
path: root/src/github
diff options
context:
space:
mode:
Diffstat (limited to 'src/github')
-rw-r--r--src/github/daneren2005/dsub/service/ChromeCastController.java1
-rw-r--r--src/github/daneren2005/dsub/service/DLNAController.java1
-rw-r--r--src/github/daneren2005/dsub/service/DownloadService.java18
3 files changed, 14 insertions, 6 deletions
diff --git a/src/github/daneren2005/dsub/service/ChromeCastController.java b/src/github/daneren2005/dsub/service/ChromeCastController.java
index 6f35ac1d..40f5d73d 100644
--- a/src/github/daneren2005/dsub/service/ChromeCastController.java
+++ b/src/github/daneren2005/dsub/service/ChromeCastController.java
@@ -450,6 +450,7 @@ public class ChromeCastController extends RemoteController {
case MediaStatus.PLAYER_STATE_IDLE:
if (mediaStatus.getIdleReason() == MediaStatus.IDLE_REASON_FINISHED) {
downloadService.setPlayerState(PlayerState.COMPLETED);
+ downloadService.postPlayCleanup();
downloadService.onSongCompleted();
} else if (mediaStatus.getIdleReason() == MediaStatus.IDLE_REASON_INTERRUPTED) {
if (downloadService.getPlayerState() != PlayerState.PREPARING) {
diff --git a/src/github/daneren2005/dsub/service/DLNAController.java b/src/github/daneren2005/dsub/service/DLNAController.java
index 207f6f21..c1ac4d09 100644
--- a/src/github/daneren2005/dsub/service/DLNAController.java
+++ b/src/github/daneren2005/dsub/service/DLNAController.java
@@ -156,6 +156,7 @@ public class DLNAController extends RemoteController {
} else if(downloadService.getPlayerState() == PlayerState.STARTED) {
// Played until the end
downloadService.setPlayerState(PlayerState.COMPLETED);
+ downloadService.postPlayCleanup();
downloadService.onSongCompleted();
} else {
downloadService.setPlayerState(PlayerState.STOPPED);
diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java
index ef69c9d3..473815dc 100644
--- a/src/github/daneren2005/dsub/service/DownloadService.java
+++ b/src/github/daneren2005/dsub/service/DownloadService.java
@@ -1654,12 +1654,7 @@ public class DownloadService extends Service {
Log.i(TAG, "Ending position " + pos + " of " + duration);
if (!isPartial || (downloadFile.isWorkDone() && (Math.abs(duration - pos) < 10000)) || nextSetup) {
playNext();
-
- // Finished loading, delete when list is cleared
- if (downloadFile.getSong() instanceof PodcastEpisode) {
- toDelete.add(downloadFile);
- }
- clearCurrentBookmark(downloadFile.getSong(), true);
+ postPlayCleanup(downloadFile);
} else {
// If file is not completely downloaded, restart the playback from the current position.
synchronized (DownloadService.this) {
@@ -1941,6 +1936,17 @@ public class DownloadService extends Service {
}
}
}
+
+ public void postPlayCleanup() {
+ postPlayCleanup(currentPlaying);
+ }
+ public void postPlayCleanup(DownloadFile downloadFile) {
+ // Finished loading, delete when list is cleared
+ if (downloadFile.getSong() instanceof PodcastEpisode) {
+ toDelete.add(downloadFile);
+ }
+ clearCurrentBookmark(downloadFile.getSong(), true);
+ }
private boolean isPastCutoff() {
return isPastCutoff(getPlayerPosition(), getPlayerDuration());