summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod/service/download
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2013-10-04 16:14:15 +0200
committerdaniel oeh <daniel.oeh@gmail.com>2013-10-04 16:14:15 +0200
commit44e4924db9afd40c2bfb9515ec84f2d569b150e3 (patch)
tree41af7ea0589bdf19a51f77509fe45780a737d3a4 /src/de/danoeh/antennapod/service/download
parent7fcefdbbe76da22f1c35de34353fa18d05836298 (diff)
downloadAntennaPod-44e4924db9afd40c2bfb9515ec84f2d569b150e3.zip
Disable download log cleanup, handle media download before saving DownloadStatus
Might resolve problems with failed downloads being reported as successful
Diffstat (limited to 'src/de/danoeh/antennapod/service/download')
-rw-r--r--src/de/danoeh/antennapod/service/download/DownloadService.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/de/danoeh/antennapod/service/download/DownloadService.java b/src/de/danoeh/antennapod/service/download/DownloadService.java
index 4040c85a8..c1af4ef19 100644
--- a/src/de/danoeh/antennapod/service/download/DownloadService.java
+++ b/src/de/danoeh/antennapod/service/download/DownloadService.java
@@ -827,23 +827,24 @@ public class DownloadService extends Service {
}
}
- saveDownloadStatus(status);
- sendDownloadHandledIntent();
-
try {
if (chaptersRead) {
DBWriter.setFeedItem(DownloadService.this, media.getItem()).get();
}
DBWriter.setFeedMedia(DownloadService.this, media).get();
+ if (!DBTasks.isInQueue(DownloadService.this, media.getItem().getId())) {
+ DBWriter.addQueueItem(DownloadService.this, media.getItem().getId()).get();
+ }
} catch (ExecutionException e) {
e.printStackTrace();
+ status = new DownloadStatus(media, media.getEpisodeTitle(), DownloadError.ERROR_DB_ACCESS_ERROR, false, e.getMessage());
} catch (InterruptedException e) {
e.printStackTrace();
+ status = new DownloadStatus(media, media.getEpisodeTitle(), DownloadError.ERROR_DB_ACCESS_ERROR, false, e.getMessage());
}
- if (!DBTasks.isInQueue(DownloadService.this, media.getItem().getId())) {
- DBWriter.addQueueItem(DownloadService.this, media.getItem().getId());
- }
+ saveDownloadStatus(status);
+ sendDownloadHandledIntent();
numberOfDownloads.decrementAndGet();
queryDownloadsAsync();