auto-cleanup deleted wrong number of episodes

This commit is contained in:
daniel oeh 2013-03-10 21:57:35 +01:00
parent ceeb4c9612
commit 437cdabadf
1 changed files with 12 additions and 10 deletions

View File

@ -714,16 +714,18 @@ public class FeedManager {
* */
private int performAutoCleanup(Context context, final int episodeNumber) {
int counter = 0;
int episodesLeft = episodeNumber;
feedloop: for (Feed feed : feeds) {
for (FeedItem item : feed.getItems()) {
if (item.hasMedia() && item.getMedia().isDownloaded()) {
if (!isInQueue(item) && item.isRead()) {
deleteFeedMedia(context, item.getMedia());
counter++;
episodesLeft--;
if (episodesLeft == 0) {
break feedloop;
if (episodeNumber > 0) {
int episodesLeft = episodeNumber;
feedloop: for (Feed feed : feeds) {
for (FeedItem item : feed.getItems()) {
if (item.hasMedia() && item.getMedia().isDownloaded()) {
if (!isInQueue(item) && item.isRead()) {
deleteFeedMedia(context, item.getMedia());
counter++;
episodesLeft--;
if (episodesLeft == 0) {
break feedloop;
}
}
}
}