aboutsummaryrefslogtreecommitdiff
path: root/src/github/daneren2005
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-01-21 15:17:46 -0800
committerScott Jackson <daneren2005@gmail.com>2015-01-21 15:17:46 -0800
commita05ab3a268382c1be40a61cb289494814ea7ba7c (patch)
treebac14d53fd05f910441cbc71d25107bcc33a8065 /src/github/daneren2005
parentfb28c08c158a2fe40d1f1b65e031d8142afebfa4 (diff)
downloaddsub-a05ab3a268382c1be40a61cb289494814ea7ba7c.tar.gz
dsub-a05ab3a268382c1be40a61cb289494814ea7ba7c.tar.bz2
dsub-a05ab3a268382c1be40a61cb289494814ea7ba7c.zip
When casting, we still want to clear bookmarks and setup podcasts for deletion
Diffstat (limited to 'src/github/daneren2005')
-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());