From 93273748b18689160c5d0e4cc3e34ba851f06dac Mon Sep 17 00:00:00 2001 From: Tom Hennen Date: Tue, 25 Aug 2015 20:03:58 -0400 Subject: [PATCH 1/2] Remove selective downloading of new things and just let auto-download do it's thing. refs AntennaPod/AntennaPod#1009 --- .../core/service/download/DownloadService.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java index 4fdaf6843..77772f8e0 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java @@ -325,16 +325,8 @@ public class DownloadService extends Service { cancelNotificationUpdater(); unregisterReceiver(cancelDownloadReceiver); - // TODO: I'm not sure this is actually needed. - // We could just invoke the autodownloadUndownloadeditems method - // and it would get everything it's supposed to. By sending it the - // items in newMediaFiles we're overriding the download algorithm, - // which is not something we should probably do. - if (!newMediaFiles.isEmpty()) { - Log.d(TAG, "newMediaFiles exist, autodownload them"); - DBTasks.autodownloadUndownloadedItems(getApplicationContext(), - ArrayUtils.toPrimitive(newMediaFiles.toArray(new Long[newMediaFiles.size()]))); - } + // start auto download in case anything new has shown up + DBTasks.autodownloadUndownloadedItems(getApplicationContext()); } @SuppressLint("NewApi") From 38db1636101d3e9dd8c849867b358c1dc274e917 Mon Sep 17 00:00:00 2001 From: Tom Hennen Date: Wed, 26 Aug 2015 17:40:29 -0400 Subject: [PATCH 2/2] removed unused queuing of new media files. --- .../core/service/download/DownloadService.java | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java index 77772f8e0..04ba77cda 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java @@ -113,11 +113,6 @@ public class DownloadService extends Service { */ public static final String EXTRA_REQUEST = "request"; - /** - * Stores new media files that will be queued for auto-download if possible. - */ - private List newMediaFiles; - /** * Contains all completed downloads that have not been included in the report yet. */ @@ -171,7 +166,7 @@ public class DownloadService extends Service { } private Thread downloadCompletionThread = new Thread() { - private static final String TAG = "downloadCompletionThread"; + private static final String TAG = "downloadCompletionThd"; @Override public void run() { @@ -241,7 +236,6 @@ public class DownloadService extends Service { Log.d(TAG, "Service started"); isRunning = true; handler = new Handler(); - newMediaFiles = Collections.synchronizedList(new ArrayList()); reportQueue = Collections.synchronizedList(new ArrayList()); downloads = Collections.synchronizedList(new ArrayList()); numberOfDownloads = new AtomicInteger(0); @@ -775,16 +769,6 @@ public class DownloadService extends Service { for (int i = 0; i < savedFeeds.length; i++) { Feed savedFeed = savedFeeds[i]; - // queue new media files for automatic download - for (FeedItem item : savedFeed.getItems()) { - if(item.getPubDate() == null) { - Log.d(TAG, item.toString()); - } - if (item.isNew() && item.hasMedia() && !item.getMedia().isDownloaded()) { - newMediaFiles.add(item.getMedia().getId()); - } - } - // If loadAllPages=true, check if another page is available and queue it for download final boolean loadAllPages = results.get(i).first.getArguments().getBoolean(DownloadRequester.REQUEST_ARG_LOAD_ALL_PAGES); final Feed feed = results.get(i).second.feed;