Added more calls of auto-cleanup and auto-download
This commit is contained in:
parent
72ee91e582
commit
485f8905c4
|
@ -627,7 +627,6 @@ public class FeedManager {
|
||||||
Log.d(TAG, "Performing auto-dl of undownloaded episodes");
|
Log.d(TAG, "Performing auto-dl of undownloaded episodes");
|
||||||
if (NetworkUtils.autodownloadNetworkAvailable(context)) {
|
if (NetworkUtils.autodownloadNetworkAvailable(context)) {
|
||||||
int undownloadedEpisodes = getNumberOfUndownloadedEpisodes();
|
int undownloadedEpisodes = getNumberOfUndownloadedEpisodes();
|
||||||
if (undownloadedEpisodes > 0) {
|
|
||||||
int downloadedEpisodes = getNumberOfDownloadedEpisodes();
|
int downloadedEpisodes = getNumberOfDownloadedEpisodes();
|
||||||
int deletedEpisodes = performAutoCleanup(context,
|
int deletedEpisodes = performAutoCleanup(context,
|
||||||
getPerformAutoCleanupArgs(undownloadedEpisodes));
|
getPerformAutoCleanupArgs(undownloadedEpisodes));
|
||||||
|
@ -645,8 +644,7 @@ public class FeedManager {
|
||||||
itemsToDownload.add(item);
|
itemsToDownload.add(item);
|
||||||
episodeSpaceLeft--;
|
episodeSpaceLeft--;
|
||||||
undownloadedEpisodes--;
|
undownloadedEpisodes--;
|
||||||
if (episodeSpaceLeft == 0
|
if (episodeSpaceLeft == 0 || undownloadedEpisodes == 0) {
|
||||||
|| undownloadedEpisodes == 0) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -658,8 +656,7 @@ public class FeedManager {
|
||||||
itemsToDownload.add(item);
|
itemsToDownload.add(item);
|
||||||
episodeSpaceLeft--;
|
episodeSpaceLeft--;
|
||||||
undownloadedEpisodes--;
|
undownloadedEpisodes--;
|
||||||
if (episodeSpaceLeft == 0
|
if (episodeSpaceLeft == 0 || undownloadedEpisodes == 0) {
|
||||||
|| undownloadedEpisodes == 0) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -671,16 +668,13 @@ public class FeedManager {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
downloadFeedItem(false, context,
|
downloadFeedItem(false, context,
|
||||||
itemsToDownload
|
itemsToDownload.toArray(new FeedItem[itemsToDownload
|
||||||
.toArray(new FeedItem[itemsToDownload
|
|
||||||
.size()]));
|
.size()]));
|
||||||
} catch (DownloadRequestException e) {
|
} catch (DownloadRequestException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -818,6 +812,12 @@ public class FeedManager {
|
||||||
adapter.close();
|
adapter.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
new Thread() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
autodownloadUndownloadedItems(context);
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -852,6 +852,12 @@ public class FeedManager {
|
||||||
adapter.close();
|
adapter.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
new Thread() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
autodownloadUndownloadedItems(context);
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -897,7 +903,6 @@ public class FeedManager {
|
||||||
if (removed) {
|
if (removed) {
|
||||||
adapter.setQueue(queue);
|
adapter.setQueue(queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Removes a FeedItem from the queue. */
|
/** Removes a FeedItem from the queue. */
|
||||||
|
@ -916,6 +921,12 @@ public class FeedManager {
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
new Thread() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
autodownloadUndownloadedItems(context);
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
eventDist.sendQueueUpdateBroadcast();
|
eventDist.sendQueueUpdateBroadcast();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -991,7 +1002,7 @@ public class FeedManager {
|
||||||
*
|
*
|
||||||
* @return The saved Feed with a database ID
|
* @return The saved Feed with a database ID
|
||||||
*/
|
*/
|
||||||
public Feed updateFeed(Context context, final Feed newFeed) {
|
public Feed updateFeed(final Context context, final Feed newFeed) {
|
||||||
// Look up feed in the feedslist
|
// Look up feed in the feedslist
|
||||||
final Feed savedFeed = searchFeedByIdentifyingValue(newFeed
|
final Feed savedFeed = searchFeedByIdentifyingValue(newFeed
|
||||||
.getIdentifyingValue());
|
.getIdentifyingValue());
|
||||||
|
@ -1038,6 +1049,12 @@ public class FeedManager {
|
||||||
savedFeed.setLastUpdate(newFeed.getLastUpdate());
|
savedFeed.setLastUpdate(newFeed.getLastUpdate());
|
||||||
savedFeed.setType(newFeed.getType());
|
savedFeed.setType(newFeed.getType());
|
||||||
setCompleteFeed(context, savedFeed);
|
setCompleteFeed(context, savedFeed);
|
||||||
|
new Thread() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
autodownloadUndownloadedItems(context);
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
return savedFeed;
|
return savedFeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue