remove ability to specify mediaIds when autodownloading

This commit is contained in:
Tom Hennen 2015-09-05 12:25:11 -04:00
parent d271ffd7f0
commit b9c14b385f
3 changed files with 11 additions and 21 deletions

View File

@ -29,12 +29,10 @@ public class APDownloadAlgorithm implements AutomaticDownloadAlgorithm {
* This method is executed on an internal single thread executor.
*
* @param context Used for accessing the DB.
* @param mediaIds If this list is not empty, the method will only download a candidate for automatic downloading if
* its media ID is in the mediaIds list.
* @return A Runnable that will be submitted to an ExecutorService.
*/
@Override
public Runnable autoDownloadUndownloadedItems(final Context context, final long... mediaIds) {
public Runnable autoDownloadUndownloadedItems(final Context context) {
return new Runnable() {
@Override
public void run() {
@ -53,17 +51,13 @@ public class APDownloadAlgorithm implements AutomaticDownloadAlgorithm {
Log.d(TAG, "Performing auto-dl of undownloaded episodes");
List<FeedItem> candidates;
if(mediaIds.length > 0) {
candidates = DBReader.getFeedItems(context, mediaIds);
} else {
final List<FeedItem> queue = DBReader.getQueue(context);
final List<FeedItem> newItems = DBReader.getNewItemsList(context);
candidates = new ArrayList<FeedItem>(queue.size() + newItems.size());
candidates.addAll(queue);
for(FeedItem newItem : newItems) {
if(candidates.contains(newItem) == false) {
candidates.add(newItem);
}
final List<FeedItem> queue = DBReader.getQueue(context);
final List<FeedItem> newItems = DBReader.getNewItemsList(context);
candidates = new ArrayList<FeedItem>(queue.size() + newItems.size());
candidates.addAll(queue);
for(FeedItem newItem : newItems) {
if(candidates.contains(newItem) == false) {
candidates.add(newItem);
}
}

View File

@ -12,9 +12,7 @@ public interface AutomaticDownloadAlgorithm {
* This method is executed on an internal single thread executor.
*
* @param context Used for accessing the DB.
* @param mediaIds If this list is not empty, the method will only download a candidate for automatic downloading if
* its media ID is in the mediaIds list.
* @return A Runnable that will be submitted to an ExecutorService.
*/
public Runnable autoDownloadUndownloadedItems(Context context, long... mediaIds);
public Runnable autoDownloadUndownloadedItems(Context context);
}

View File

@ -374,14 +374,12 @@ public final class DBTasks {
* This method is executed on an internal single thread executor.
*
* @param context Used for accessing the DB.
* @param mediaIds If this list is not empty, the method will only download a candidate for automatic downloading if
* its media ID is in the mediaIds list.
* @return A Future that can be used for waiting for the methods completion.
*/
public static Future<?> autodownloadUndownloadedItems(final Context context, final long... mediaIds) {
public static Future<?> autodownloadUndownloadedItems(final Context context) {
Log.d(TAG, "autodownloadUndownloadedItems");
return autodownloadExec.submit(ClientConfig.dbTasksCallbacks.getAutomaticDownloadAlgorithm()
.autoDownloadUndownloadedItems(context, mediaIds));
.autoDownloadUndownloadedItems(context));
}