diff --git a/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java b/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java index e8436a3a2..41e8c64d1 100644 --- a/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java +++ b/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java @@ -128,7 +128,8 @@ public class PlaybackServiceMediaPlayerTest { } private Playable writeTestPlayable(String downloadUrl, String fileUrl) { - Feed f = new Feed(0, null, "f", "l", "d", null, null, null, null, "i", null, null, "l", false); + Feed f = new Feed(0, null, "f", "l", "d", null, null, null, null, + "i", null, null, "l", System.currentTimeMillis()); FeedPreferences prefs = new FeedPreferences(f.getId(), false, FeedPreferences.AutoDeleteAction.NEVER, VolumeAdaptionSetting.OFF, FeedPreferences.NewEpisodesAction.NOTHING, null, null); f.setPreferences(prefs); diff --git a/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java b/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java index 9f1fc2261..ea484faca 100644 --- a/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java +++ b/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java @@ -63,7 +63,8 @@ public class PlaybackServiceTaskManagerTest { private List writeTestQueue(String pref) { final int NUM_ITEMS = 10; - Feed f = new Feed(0, null, "title", "link", "d", null, null, null, null, "id", null, "null", "url", false); + Feed f = new Feed(0, null, "title", "link", "d", null, null, null, null, "id", + null, "null", "url", System.currentTimeMillis()); f.setItems(new ArrayList<>()); for (int i = 0; i < NUM_ITEMS; i++) { f.getItems().add(new FeedItem(0, pref + i, pref + i, "link", new Date(), FeedItem.PLAYED, f)); diff --git a/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java b/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java index 0202d9d48..979d527f6 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java @@ -123,7 +123,7 @@ public class UITestUtils { for (int i = 0; i < NUM_FEEDS; i++) { Feed feed = new Feed(0, null, "Title " + i, "http://example.com/" + i, "Description of feed " + i, "http://example.com/pay/feed" + i, "author " + i, "en", Feed.TYPE_RSS2, "feed" + i, null, null, - "http://example.com/feed/src/" + i, false); + "http://example.com/feed/src/" + i, System.currentTimeMillis()); // create items List items = new ArrayList<>(); @@ -169,7 +169,6 @@ public class UITestUtils { List queue = new ArrayList<>(); for (Feed feed : hostedFeeds) { - feed.setDownloaded(true); if (downloadEpisodes) { for (FeedItem item : feed.getItems()) { if (item.hasMedia()) { diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/FeedUpdateWorker.java b/core/src/main/java/de/danoeh/antennapod/core/service/FeedUpdateWorker.java index 5e864c5c0..3eb69228e 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/FeedUpdateWorker.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/FeedUpdateWorker.java @@ -23,7 +23,7 @@ import de.danoeh.antennapod.core.service.download.DefaultDownloaderFactory; import de.danoeh.antennapod.core.service.download.DownloadRequestCreator; import de.danoeh.antennapod.core.service.download.Downloader; import de.danoeh.antennapod.core.service.download.NewEpisodesNotification; -import de.danoeh.antennapod.core.service.download.handler.FeedSyncTask; +import de.danoeh.antennapod.core.service.download.handler.FeedParserTask; import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBWriter; @@ -35,6 +35,7 @@ import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.download.DownloadRequest; import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequestBuilder; +import de.danoeh.antennapod.parser.feed.FeedHandlerResult; import de.danoeh.antennapod.ui.notifications.NotificationUtils; import java.util.ArrayList; import java.util.Collections; @@ -190,29 +191,30 @@ public class FeedUpdateWorker extends Worker { return; } - FeedSyncTask feedSyncTask = new FeedSyncTask(getApplicationContext(), request); - boolean success = feedSyncTask.run(); - - if (!success) { + FeedParserTask parserTask = new FeedParserTask(request); + FeedHandlerResult feedHandlerResult = parserTask.call(); + if (!parserTask.isSuccessful()) { DBWriter.setFeedLastUpdateFailed(request.getFeedfileId(), true); - DBWriter.addDownloadStatus(feedSyncTask.getDownloadStatus()); + DBWriter.addDownloadStatus(parserTask.getDownloadStatus()); return; } + feedHandlerResult.feed.setLastRefreshAttempt(System.currentTimeMillis()); + Feed savedFeed = DBTasks.updateFeed(getApplicationContext(), feedHandlerResult.feed, false); if (request.getFeedfileId() == 0) { return; // No download logs for new subscriptions } // we create a 'successful' download log if the feed's last refresh failed List log = DBReader.getFeedDownloadLog(request.getFeedfileId()); - if (log.size() > 0 && !log.get(0).isSuccessful()) { - DBWriter.addDownloadStatus(feedSyncTask.getDownloadStatus()); + if (!log.isEmpty() && !log.get(0).isSuccessful()) { + DBWriter.addDownloadStatus(parserTask.getDownloadStatus()); } - newEpisodesNotification.showIfNeeded(getApplicationContext(), feedSyncTask.getSavedFeed()); + newEpisodesNotification.showIfNeeded(getApplicationContext(), savedFeed); if (downloader.permanentRedirectUrl != null) { DBWriter.updateFeedDownloadURL(request.getSource(), downloader.permanentRedirectUrl); - } else if (feedSyncTask.getRedirectUrl() != null - && !feedSyncTask.getRedirectUrl().equals(request.getSource())) { - DBWriter.updateFeedDownloadURL(request.getSource(), feedSyncTask.getRedirectUrl()); + } else if (feedHandlerResult.redirectUrl != null + && !feedHandlerResult.redirectUrl.equals(request.getSource())) { + DBWriter.updateFeedDownloadURL(request.getSource(), feedHandlerResult.redirectUrl); } } } diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FeedParserTask.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FeedParserTask.java index b96b2723c..37775ab94 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FeedParserTask.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FeedParserTask.java @@ -41,7 +41,6 @@ public class FeedParserTask implements Callable { Feed feed = new Feed(request.getSource(), request.getLastModified()); feed.setLocalFileUrl(request.getDestination()); feed.setId(request.getFeedfileId()); - feed.setDownloaded(true); feed.setPreferences(new FeedPreferences(0, true, FeedPreferences.AutoDeleteAction.GLOBAL, VolumeAdaptionSetting.OFF, FeedPreferences.NewEpisodesAction.GLOBAL, request.getUsername(), request.getPassword())); diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FeedSyncTask.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FeedSyncTask.java deleted file mode 100644 index 03d7ab6ec..000000000 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FeedSyncTask.java +++ /dev/null @@ -1,44 +0,0 @@ -package de.danoeh.antennapod.core.service.download.handler; - -import android.content.Context; -import androidx.annotation.NonNull; -import de.danoeh.antennapod.core.storage.DBTasks; -import de.danoeh.antennapod.model.download.DownloadResult; -import de.danoeh.antennapod.model.feed.Feed; -import de.danoeh.antennapod.model.download.DownloadRequest; -import de.danoeh.antennapod.parser.feed.FeedHandlerResult; - -public class FeedSyncTask { - private final Context context; - private Feed savedFeed; - private final FeedParserTask task; - private FeedHandlerResult feedHandlerResult; - - public FeedSyncTask(Context context, DownloadRequest request) { - this.context = context; - this.task = new FeedParserTask(request); - } - - public boolean run() { - feedHandlerResult = task.call(); - if (!task.isSuccessful()) { - return false; - } - - savedFeed = DBTasks.updateFeed(context, feedHandlerResult.feed, false); - return true; - } - - @NonNull - public DownloadResult getDownloadStatus() { - return task.getDownloadStatus(); - } - - public Feed getSavedFeed() { - return savedFeed; - } - - public String getRedirectUrl() { - return feedHandlerResult.redirectUrl; - } -} diff --git a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMother.java b/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMother.java index b1f3fca27..7616f8f91 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMother.java +++ b/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMother.java @@ -8,7 +8,7 @@ public class FeedMother { public static Feed anyFeed() { return new Feed(0, null, "title", "http://example.com", "This is the description", "http://example.com/payment", "Daniel", "en", null, "http://example.com/feed", IMAGE_URL, - null, "http://example.com/feed", true); + null, "http://example.com/feed", System.currentTimeMillis()); } } diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbReaderTest.java b/core/src/test/java/de/danoeh/antennapod/core/storage/DbReaderTest.java index 6195ef714..54b4e507c 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbReaderTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/storage/DbReaderTest.java @@ -80,10 +80,11 @@ public class DbReaderTest { PodDBAdapter adapter = PodDBAdapter.getInstance(); adapter.open(); - Feed feed1 = new Feed(0, null, "A", "link", "d", null, null, null, "rss", "A", null, "", "", true); - Feed feed2 = new Feed(0, null, "b", "link", "d", null, null, null, "rss", "b", null, "", "", true); - Feed feed3 = new Feed(0, null, "C", "link", "d", null, null, null, "rss", "C", null, "", "", true); - Feed feed4 = new Feed(0, null, "d", "link", "d", null, null, null, "rss", "d", null, "", "", true); + final long lastRefreshed = System.currentTimeMillis(); + Feed feed1 = new Feed(0, null, "A", "link", "d", null, null, null, "rss", "A", null, "", "", lastRefreshed); + Feed feed2 = new Feed(0, null, "b", "link", "d", null, null, null, "rss", "b", null, "", "", lastRefreshed); + Feed feed3 = new Feed(0, null, "C", "link", "d", null, null, null, "rss", "C", null, "", "", lastRefreshed); + Feed feed4 = new Feed(0, null, "d", "link", "d", null, null, null, "rss", "d", null, "", "", lastRefreshed); adapter.setCompleteFeed(feed1); adapter.setCompleteFeed(feed2); adapter.setCompleteFeed(feed3); diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbTestUtils.java b/core/src/test/java/de/danoeh/antennapod/core/storage/DbTestUtils.java index 3a3213a37..84a6efb6a 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbTestUtils.java +++ b/core/src/test/java/de/danoeh/antennapod/core/storage/DbTestUtils.java @@ -43,7 +43,7 @@ abstract class DbTestUtils { adapter.open(); for (int i = 0; i < numFeeds; i++) { Feed f = new Feed(0, null, "feed " + i, "link" + i, "descr", null, null, - null, null, "id" + i, null, null, "url" + i, false); + null, null, "id" + i, null, null, "url" + i, System.currentTimeMillis()); f.setItems(new ArrayList<>()); for (int j = 0; j < numItems; j++) { FeedItem item = new FeedItem(0, "item " + j, "id" + j, "link" + j, new Date(), diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/mapper/FeedCursorMapperTest.java b/core/src/test/java/de/danoeh/antennapod/core/storage/mapper/FeedCursorMapperTest.java index 24f65744e..87ade0c6f 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/mapper/FeedCursorMapperTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/storage/mapper/FeedCursorMapperTest.java @@ -55,7 +55,7 @@ public class FeedCursorMapperTest { assertEquals("feed image url", feed.getImageUrl()); assertEquals("feed file url", feed.getLocalFileUrl()); assertEquals("feed download url", feed.getDownloadUrl()); - assertTrue(feed.isDownloaded()); + assertEquals(42, feed.getLastRefreshAttempt()); assertEquals("feed last update", feed.getLastModified()); assertEquals("feed type", feed.getType()); assertEquals("feed identifier", feed.getFeedIdentifier()); @@ -85,7 +85,7 @@ public class FeedCursorMapperTest { values.put(PodDBAdapter.KEY_FILE_URL, "feed file url"); values.put(PodDBAdapter.KEY_DOWNLOAD_URL, "feed download url"); - values.put(PodDBAdapter.KEY_DOWNLOADED, true); + values.put(PodDBAdapter.KEY_LAST_REFRESH_ATTEMPT, 42); values.put(PodDBAdapter.KEY_LASTUPDATE, "feed last update"); values.put(PodDBAdapter.KEY_TYPE, "feed type"); values.put(PodDBAdapter.KEY_FEED_IDENTIFIER, "feed identifier"); diff --git a/model/src/main/java/de/danoeh/antennapod/model/feed/Feed.java b/model/src/main/java/de/danoeh/antennapod/model/feed/Feed.java index 6b7c40095..8d36d24a3 100644 --- a/model/src/main/java/de/danoeh/antennapod/model/feed/Feed.java +++ b/model/src/main/java/de/danoeh/antennapod/model/feed/Feed.java @@ -24,7 +24,6 @@ public class Feed { private long id; private String localFileUrl; private String downloadUrl; - private boolean downloaded; /** * title as defined by the feed. */ @@ -56,6 +55,7 @@ public class Feed { * String that identifies the last update (adopted from Last-Modified or ETag header). */ private String lastModified; + private long lastRefreshAttempt; private ArrayList fundingList; /** @@ -109,11 +109,11 @@ public class Feed { public Feed(long id, String lastModified, String title, String customTitle, String link, String description, String paymentLinks, String author, String language, String type, String feedIdentifier, String imageUrl, String fileUrl, - String downloadUrl, boolean downloaded, boolean paged, String nextPageLink, + String downloadUrl, long lastRefreshAttempt, boolean paged, String nextPageLink, String filter, @Nullable SortOrder sortOrder, boolean lastUpdateFailed) { this.localFileUrl = fileUrl; this.downloadUrl = downloadUrl; - this.downloaded = downloaded; + this.lastRefreshAttempt = lastRefreshAttempt; this.id = id; this.feedTitle = title; this.customTitle = customTitle; @@ -143,9 +143,9 @@ public class Feed { */ public Feed(long id, String lastModified, String title, String link, String description, String paymentLink, String author, String language, String type, String feedIdentifier, String imageUrl, String fileUrl, - String downloadUrl, boolean downloaded) { + String downloadUrl, long lastRefreshAttempt) { this(id, lastModified, title, null, link, description, paymentLink, author, language, type, feedIdentifier, - imageUrl, fileUrl, downloadUrl, downloaded, false, null, null, null, false); + imageUrl, fileUrl, downloadUrl, lastRefreshAttempt, false, null, null, null, false); } /** @@ -155,7 +155,7 @@ public class Feed { public Feed(String url, String lastModified) { this.localFileUrl = null; this.downloadUrl = url; - this.downloaded = false; + this.lastRefreshAttempt = 0; this.lastModified = lastModified; } @@ -241,6 +241,9 @@ public class Feed { if (other.fundingList != null) { fundingList = other.fundingList; } + if (other.lastRefreshAttempt > lastRefreshAttempt) { + lastRefreshAttempt = other.lastRefreshAttempt; + } // this feed's nextPage might already point to a higher page, so we only update the nextPage value // if this feed is not paged and the other feed is. if (!this.paged && other.paged) { @@ -395,9 +398,6 @@ public class Feed { public void setLocalFileUrl(String fileUrl) { this.localFileUrl = fileUrl; - if (fileUrl == null) { - downloaded = false; - } } public String getDownloadUrl() { @@ -408,12 +408,12 @@ public class Feed { this.downloadUrl = downloadUrl; } - public boolean isDownloaded() { - return downloaded; + public long getLastRefreshAttempt() { + return lastRefreshAttempt; } - public void setDownloaded(boolean downloaded) { - this.downloaded = downloaded; + public void setLastRefreshAttempt(long lastRefreshAttempt) { + this.lastRefreshAttempt = lastRefreshAttempt; } public int getPageNr() { diff --git a/parser/feed/src/test/java/de/danoeh/antennapod/parser/feed/element/namespace/FeedParserTestHelper.java b/parser/feed/src/test/java/de/danoeh/antennapod/parser/feed/element/namespace/FeedParserTestHelper.java index 4497f455d..35cdfb6f8 100644 --- a/parser/feed/src/test/java/de/danoeh/antennapod/parser/feed/element/namespace/FeedParserTestHelper.java +++ b/parser/feed/src/test/java/de/danoeh/antennapod/parser/feed/element/namespace/FeedParserTestHelper.java @@ -29,7 +29,6 @@ public abstract class FeedParserTestHelper { FeedHandler handler = new FeedHandler(); Feed parsedFeed = new Feed("http://example.com/feed", null); parsedFeed.setLocalFileUrl(feedFile.getAbsolutePath()); - parsedFeed.setDownloaded(true); handler.parseFeed(parsedFeed); return parsedFeed; } diff --git a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/PodDBAdapter.java b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/PodDBAdapter.java index a169c8fda..261a9dd45 100644 --- a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/PodDBAdapter.java +++ b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/PodDBAdapter.java @@ -77,6 +77,7 @@ public class PodDBAdapter { public static final String KEY_FEED = "feed"; public static final String KEY_MEDIA = "media"; public static final String KEY_DOWNLOADED = "downloaded"; + public static final String KEY_LAST_REFRESH_ATTEMPT = "downloaded"; public static final String KEY_LASTUPDATE = "last_update"; public static final String KEY_FEEDFILE = "feedfile"; public static final String KEY_REASON = "reason"; @@ -135,14 +136,22 @@ public class PodDBAdapter { private static final String TABLE_PRIMARY_KEY = KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT ,"; - private static final String CREATE_TABLE_FEEDS = "CREATE TABLE " - + TABLE_NAME_FEEDS + " (" + TABLE_PRIMARY_KEY + KEY_TITLE - + " TEXT," + KEY_CUSTOM_TITLE + " TEXT," + KEY_FILE_URL + " TEXT," + KEY_DOWNLOAD_URL + " TEXT," - + KEY_DOWNLOADED + " INTEGER," + KEY_LINK + " TEXT," - + KEY_DESCRIPTION + " TEXT," + KEY_PAYMENT_LINK + " TEXT," - + KEY_LASTUPDATE + " TEXT," + KEY_LANGUAGE + " TEXT," + KEY_AUTHOR - + " TEXT," + KEY_IMAGE_URL + " TEXT," + KEY_TYPE + " TEXT," - + KEY_FEED_IDENTIFIER + " TEXT," + KEY_AUTO_DOWNLOAD_ENABLED + " INTEGER DEFAULT 1," + private static final String CREATE_TABLE_FEEDS = "CREATE TABLE " + TABLE_NAME_FEEDS + " (" + + TABLE_PRIMARY_KEY + KEY_TITLE + " TEXT," + + KEY_CUSTOM_TITLE + " TEXT," + + KEY_FILE_URL + " TEXT," + + KEY_DOWNLOAD_URL + " TEXT," + + KEY_LAST_REFRESH_ATTEMPT + " INTEGER," + + KEY_LINK + " TEXT," + + KEY_DESCRIPTION + " TEXT," + + KEY_PAYMENT_LINK + " TEXT," + + KEY_LASTUPDATE + " TEXT," + + KEY_LANGUAGE + " TEXT," + + KEY_AUTHOR + " TEXT," + + KEY_IMAGE_URL + " TEXT," + + KEY_TYPE + " TEXT," + + KEY_FEED_IDENTIFIER + " TEXT," + + KEY_AUTO_DOWNLOAD_ENABLED + " INTEGER DEFAULT 1," + KEY_USERNAME + " TEXT," + KEY_PASSWORD + " TEXT," + KEY_INCLUDE_FILTER + " TEXT DEFAULT ''," @@ -284,7 +293,7 @@ public class PodDBAdapter { + TABLE_NAME_FEEDS + "." + KEY_CUSTOM_TITLE + ", " + TABLE_NAME_FEEDS + "." + KEY_FILE_URL + ", " + TABLE_NAME_FEEDS + "." + KEY_DOWNLOAD_URL + ", " - + TABLE_NAME_FEEDS + "." + KEY_DOWNLOADED + ", " + + TABLE_NAME_FEEDS + "." + KEY_LAST_REFRESH_ATTEMPT + ", " + TABLE_NAME_FEEDS + "." + KEY_LINK + ", " + TABLE_NAME_FEEDS + "." + KEY_DESCRIPTION + ", " + TABLE_NAME_FEEDS + "." + KEY_PAYMENT_LINK + ", " @@ -418,7 +427,7 @@ public class PodDBAdapter { values.put(KEY_FILE_URL, feed.getLocalFileUrl()); values.put(KEY_DOWNLOAD_URL, feed.getDownloadUrl()); - values.put(KEY_DOWNLOADED, feed.isDownloaded()); + values.put(KEY_LAST_REFRESH_ATTEMPT, feed.getLastRefreshAttempt()); values.put(KEY_LASTUPDATE, feed.getLastModified()); values.put(KEY_TYPE, feed.getType()); values.put(KEY_FEED_IDENTIFIER, feed.getFeedIdentifier()); @@ -748,6 +757,7 @@ public class PodDBAdapter { public void setFeedLastUpdateFailed(long feedId, boolean failed) { final String sql = "UPDATE " + TABLE_NAME_FEEDS + " SET " + KEY_LAST_UPDATE_FAILED + "=" + (failed ? "1" : "0") + + "," + KEY_LAST_REFRESH_ATTEMPT + "=" + System.currentTimeMillis() + " WHERE " + KEY_ID + "=" + feedId; db.execSQL(sql); } diff --git a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/FeedCursorMapper.java b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/FeedCursorMapper.java index bb5ea4df6..f7be7009f 100644 --- a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/FeedCursorMapper.java +++ b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/FeedCursorMapper.java @@ -32,7 +32,7 @@ public abstract class FeedCursorMapper { int indexFeedIdentifier = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_FEED_IDENTIFIER); int indexFileUrl = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_FILE_URL); int indexDownloadUrl = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_DOWNLOAD_URL); - int indexDownloaded = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_DOWNLOADED); + int indexLastRefreshed = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_LAST_REFRESH_ATTEMPT); int indexIsPaged = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_IS_PAGED); int indexNextPageLink = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_NEXT_PAGE_LINK); int indexHide = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_HIDE); @@ -55,7 +55,7 @@ public abstract class FeedCursorMapper { cursor.getString(indexImageUrl), cursor.getString(indexFileUrl), cursor.getString(indexDownloadUrl), - cursor.getInt(indexDownloaded) > 0, + cursor.getLong(indexLastRefreshed), cursor.getInt(indexIsPaged) > 0, cursor.getString(indexNextPageLink), cursor.getString(indexHide),