From 28a397c8979f143fba74ea5d385e74bae62c6673 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Fri, 26 Aug 2022 00:10:51 +0200 Subject: Make statistics loading more efficient --- .../antennapod/storage/database/PodDBAdapter.java | 129 ++++++++++++++------- .../database/mapper/ChapterCursorMapper.java | 10 +- .../mapper/DownloadStatusCursorMapper.java | 16 +-- .../storage/database/mapper/FeedCursorMapper.java | 40 +++---- .../mapper/FeedPreferencesCursorMapper.java | 30 ++--- 5 files changed, 133 insertions(+), 92 deletions(-) (limited to 'storage/database/src') 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 453d1c184..5ce75a2ae 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 @@ -226,46 +226,6 @@ public class PodDBAdapter { + TABLE_NAME_FAVORITES + "(" + KEY_ID + " INTEGER PRIMARY KEY," + KEY_FEEDITEM + " INTEGER," + KEY_FEED + " INTEGER)"; - /** - * Select all columns from the feed-table - */ - private static final String[] FEED_SEL_STD = { - TABLE_NAME_FEEDS + "." + KEY_ID, - TABLE_NAME_FEEDS + "." + KEY_TITLE, - 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_LINK, - TABLE_NAME_FEEDS + "." + KEY_DESCRIPTION, - TABLE_NAME_FEEDS + "." + KEY_PAYMENT_LINK, - TABLE_NAME_FEEDS + "." + KEY_LASTUPDATE, - TABLE_NAME_FEEDS + "." + KEY_LANGUAGE, - TABLE_NAME_FEEDS + "." + KEY_AUTHOR, - TABLE_NAME_FEEDS + "." + KEY_IMAGE_URL, - TABLE_NAME_FEEDS + "." + KEY_TYPE, - TABLE_NAME_FEEDS + "." + KEY_FEED_IDENTIFIER, - TABLE_NAME_FEEDS + "." + KEY_AUTO_DOWNLOAD_ENABLED, - TABLE_NAME_FEEDS + "." + KEY_KEEP_UPDATED, - TABLE_NAME_FEEDS + "." + KEY_IS_PAGED, - TABLE_NAME_FEEDS + "." + KEY_NEXT_PAGE_LINK, - TABLE_NAME_FEEDS + "." + KEY_USERNAME, - TABLE_NAME_FEEDS + "." + KEY_PASSWORD, - TABLE_NAME_FEEDS + "." + KEY_HIDE, - TABLE_NAME_FEEDS + "." + KEY_SORT_ORDER, - TABLE_NAME_FEEDS + "." + KEY_LAST_UPDATE_FAILED, - TABLE_NAME_FEEDS + "." + KEY_AUTO_DELETE_ACTION, - TABLE_NAME_FEEDS + "." + KEY_FEED_VOLUME_ADAPTION, - TABLE_NAME_FEEDS + "." + KEY_INCLUDE_FILTER, - TABLE_NAME_FEEDS + "." + KEY_EXCLUDE_FILTER, - TABLE_NAME_FEEDS + "." + KEY_MINIMAL_DURATION_FILTER, - TABLE_NAME_FEEDS + "." + KEY_FEED_PLAYBACK_SPEED, - TABLE_NAME_FEEDS + "." + KEY_FEED_TAGS, - TABLE_NAME_FEEDS + "." + KEY_FEED_SKIP_INTRO, - TABLE_NAME_FEEDS + "." + KEY_FEED_SKIP_ENDING, - TABLE_NAME_FEEDS + "." + KEY_EPISODE_NOTIFICATION - }; - /** * All the tables in the database */ @@ -281,6 +241,7 @@ public class PodDBAdapter { public static final String SELECT_KEY_ITEM_ID = "item_id"; public static final String SELECT_KEY_MEDIA_ID = "media_id"; + public static final String SELECT_KEY_FEED_ID = "feed_id"; private static final String KEYS_FEED_ITEM_WITHOUT_DESCRIPTION = TABLE_NAME_FEED_ITEMS + "." + KEY_ID + " AS " + SELECT_KEY_ITEM_ID + ", " @@ -312,6 +273,42 @@ public class PodDBAdapter { + TABLE_NAME_FEED_MEDIA + "." + KEY_HAS_EMBEDDED_PICTURE + ", " + TABLE_NAME_FEED_MEDIA + "." + KEY_LAST_PLAYED_TIME; + private static final String KEYS_FEED = + TABLE_NAME_FEEDS + "." + KEY_ID + " AS " + SELECT_KEY_FEED_ID + ", " + + TABLE_NAME_FEEDS + "." + KEY_TITLE + ", " + + 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_LINK + ", " + + TABLE_NAME_FEEDS + "." + KEY_DESCRIPTION + ", " + + TABLE_NAME_FEEDS + "." + KEY_PAYMENT_LINK + ", " + + TABLE_NAME_FEEDS + "." + KEY_LASTUPDATE + ", " + + TABLE_NAME_FEEDS + "." + KEY_LANGUAGE + ", " + + TABLE_NAME_FEEDS + "." + KEY_AUTHOR + ", " + + TABLE_NAME_FEEDS + "." + KEY_IMAGE_URL + ", " + + TABLE_NAME_FEEDS + "." + KEY_TYPE + ", " + + TABLE_NAME_FEEDS + "." + KEY_FEED_IDENTIFIER + ", " + + TABLE_NAME_FEEDS + "." + KEY_IS_PAGED + ", " + + TABLE_NAME_FEEDS + "." + KEY_NEXT_PAGE_LINK + ", " + + TABLE_NAME_FEEDS + "." + KEY_LAST_UPDATE_FAILED + ", " + + TABLE_NAME_FEEDS + "." + KEY_AUTO_DOWNLOAD_ENABLED + ", " + + TABLE_NAME_FEEDS + "." + KEY_KEEP_UPDATED + ", " + + TABLE_NAME_FEEDS + "." + KEY_USERNAME + ", " + + TABLE_NAME_FEEDS + "." + KEY_PASSWORD + ", " + + TABLE_NAME_FEEDS + "." + KEY_HIDE + ", " + + TABLE_NAME_FEEDS + "." + KEY_SORT_ORDER + ", " + + TABLE_NAME_FEEDS + "." + KEY_AUTO_DELETE_ACTION + ", " + + TABLE_NAME_FEEDS + "." + KEY_FEED_VOLUME_ADAPTION + ", " + + TABLE_NAME_FEEDS + "." + KEY_INCLUDE_FILTER + ", " + + TABLE_NAME_FEEDS + "." + KEY_EXCLUDE_FILTER + ", " + + TABLE_NAME_FEEDS + "." + KEY_MINIMAL_DURATION_FILTER + ", " + + TABLE_NAME_FEEDS + "." + KEY_FEED_PLAYBACK_SPEED + ", " + + TABLE_NAME_FEEDS + "." + KEY_FEED_TAGS + ", " + + TABLE_NAME_FEEDS + "." + KEY_FEED_SKIP_INTRO + ", " + + TABLE_NAME_FEEDS + "." + KEY_FEED_SKIP_ENDING + ", " + + TABLE_NAME_FEEDS + "." + KEY_EPISODE_NOTIFICATION; + private static final String JOIN_FEED_ITEM_AND_MEDIA = " LEFT JOIN " + TABLE_NAME_FEED_MEDIA + " ON " + TABLE_NAME_FEED_ITEMS + "." + KEY_ID + "=" + TABLE_NAME_FEED_MEDIA + "." + KEY_FEEDITEM + " "; @@ -914,8 +911,10 @@ public class PodDBAdapter { * @return The cursor of the query */ public final Cursor getAllFeedsCursor() { - return db.query(TABLE_NAME_FEEDS, FEED_SEL_STD, null, null, null, null, - KEY_TITLE + " COLLATE NOCASE ASC"); + final String query = "SELECT " + KEYS_FEED + + " FROM " + TABLE_NAME_FEEDS + + " ORDER BY " + TABLE_NAME_FEEDS + "." + KEY_TITLE + " COLLATE NOCASE ASC"; + return db.rawQuery(query, null); } public final Cursor getFeedCursorDownloadUrls() { @@ -1102,8 +1101,10 @@ public class PodDBAdapter { } public final Cursor getFeedCursor(final long id) { - return db.query(TABLE_NAME_FEEDS, FEED_SEL_STD, KEY_ID + "=" + id, null, - null, null, null); + final String query = "SELECT " + KEYS_FEED + + " FROM " + TABLE_NAME_FEEDS + + " WHERE " + SELECT_KEY_FEED_ID + " = " + id; + return db.rawQuery(query, null); } public final Cursor getFeedItemCursor(final String id) { @@ -1167,6 +1168,46 @@ public class PodDBAdapter { return db.rawQuery(query, null); } + public final Cursor getFeedStatisticsCursor(boolean includeMarkedAsPlayed, long timeFilterFrom, long timeFilterTo) { + final String lastPlayedTime = TABLE_NAME_FEED_MEDIA + "." + KEY_LAST_PLAYED_TIME; + String wasStarted = TABLE_NAME_FEED_MEDIA + "." + KEY_PLAYBACK_COMPLETION_DATE + " > 0" + + " AND " + TABLE_NAME_FEED_MEDIA + "." + KEY_PLAYED_DURATION + " > 0"; + if (includeMarkedAsPlayed) { + wasStarted = "(" + wasStarted + ") OR " + + TABLE_NAME_FEED_ITEMS + "." + KEY_READ + "=" + FeedItem.PLAYED + " OR " + + TABLE_NAME_FEED_MEDIA + "." + KEY_POSITION + "> 0"; + } + final String timeFilter = lastPlayedTime + ">=" + timeFilterFrom + + " AND " + lastPlayedTime + "<=" + timeFilterTo; + String playedTime = TABLE_NAME_FEED_MEDIA + "." + KEY_PLAYED_DURATION; + if (includeMarkedAsPlayed) { + playedTime = "(CASE WHEN " + playedTime + " != 0" + + " THEN " + playedTime + " ELSE (" + + "CASE WHEN " + TABLE_NAME_FEED_ITEMS + "." + KEY_READ + "=" + FeedItem.PLAYED + + " THEN " + TABLE_NAME_FEED_MEDIA + "." + KEY_DURATION + " ELSE 0 END" + + ") END)"; + } + + final String query = "SELECT " + KEYS_FEED + ", " + + "COUNT(*) AS num_episodes, " + + "MIN(CASE WHEN " + lastPlayedTime + " > 0" + + " THEN " + lastPlayedTime + " ELSE " + Long.MAX_VALUE + " END) AS oldest_date, " + + "SUM(CASE WHEN (" + wasStarted + ") THEN 1 ELSE 0 END) AS episodes_started, " + + "IFNULL(SUM(CASE WHEN (" + timeFilter + ")" + + " THEN (" + playedTime + ") ELSE 0 END), 0) AS played_time, " + + "IFNULL(SUM(" + TABLE_NAME_FEED_MEDIA + "." + KEY_DURATION + "), 0) AS total_time, " + + "SUM(CASE WHEN " + TABLE_NAME_FEED_MEDIA + "." + KEY_DOWNLOADED + " > 0" + + " THEN 1 ELSE 0 END) AS num_downloaded, " + + "SUM(CASE WHEN " + TABLE_NAME_FEED_MEDIA + "." + KEY_DOWNLOADED + " > 0" + + " THEN " + TABLE_NAME_FEED_MEDIA + "." + KEY_SIZE + " ELSE 0 END) AS download_size" + + " FROM " + TABLE_NAME_FEED_ITEMS + + JOIN_FEED_ITEM_AND_MEDIA + + " INNER JOIN " + TABLE_NAME_FEEDS + + " ON " + TABLE_NAME_FEED_ITEMS + "." + KEY_FEED + "=" + TABLE_NAME_FEEDS + "." + KEY_ID + + " GROUP BY " + TABLE_NAME_FEEDS + "." + KEY_ID; + return db.rawQuery(query, null); + } + public int getQueueSize() { final String query = String.format("SELECT COUNT(%s) FROM %s", KEY_ID, TABLE_NAME_QUEUE); Cursor c = db.rawQuery(query, null); diff --git a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/ChapterCursorMapper.java b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/ChapterCursorMapper.java index 71e67812d..b48a7f9d1 100644 --- a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/ChapterCursorMapper.java +++ b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/ChapterCursorMapper.java @@ -14,11 +14,11 @@ public abstract class ChapterCursorMapper { */ @NonNull public static Chapter convert(@NonNull Cursor cursor) { - int indexId = cursor.getColumnIndex(PodDBAdapter.KEY_ID); - int indexTitle = cursor.getColumnIndex(PodDBAdapter.KEY_TITLE); - int indexStart = cursor.getColumnIndex(PodDBAdapter.KEY_START); - int indexLink = cursor.getColumnIndex(PodDBAdapter.KEY_LINK); - int indexImage = cursor.getColumnIndex(PodDBAdapter.KEY_IMAGE_URL); + int indexId = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_ID); + int indexTitle = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_TITLE); + int indexStart = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_START); + int indexLink = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_LINK); + int indexImage = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_IMAGE_URL); long id = cursor.getLong(indexId); String title = cursor.getString(indexTitle); diff --git a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/DownloadStatusCursorMapper.java b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/DownloadStatusCursorMapper.java index 4a5a792af..1b8f3c726 100644 --- a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/DownloadStatusCursorMapper.java +++ b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/DownloadStatusCursorMapper.java @@ -17,14 +17,14 @@ public abstract class DownloadStatusCursorMapper { */ @NonNull public static DownloadStatus convert(@NonNull Cursor cursor) { - int indexId = cursor.getColumnIndex(PodDBAdapter.KEY_ID); - int indexTitle = cursor.getColumnIndex(PodDBAdapter.KEY_DOWNLOADSTATUS_TITLE); - int indexFeedFile = cursor.getColumnIndex(PodDBAdapter.KEY_FEEDFILE); - int indexFileFileType = cursor.getColumnIndex(PodDBAdapter.KEY_FEEDFILETYPE); - int indexSuccessful = cursor.getColumnIndex(PodDBAdapter.KEY_SUCCESSFUL); - int indexReason = cursor.getColumnIndex(PodDBAdapter.KEY_REASON); - int indexCompletionDate = cursor.getColumnIndex(PodDBAdapter.KEY_COMPLETION_DATE); - int indexReasonDetailed = cursor.getColumnIndex(PodDBAdapter.KEY_REASON_DETAILED); + int indexId = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_ID); + int indexTitle = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_DOWNLOADSTATUS_TITLE); + int indexFeedFile = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_FEEDFILE); + int indexFileFileType = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_FEEDFILETYPE); + int indexSuccessful = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_SUCCESSFUL); + int indexReason = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_REASON); + int indexCompletionDate = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_COMPLETION_DATE); + int indexReasonDetailed = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_REASON_DETAILED); return new DownloadStatus(cursor.getLong(indexId), cursor.getString(indexTitle), cursor.getLong(indexFeedFile), cursor.getInt(indexFileFileType), cursor.getInt(indexSuccessful) > 0, false, true, 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 25df7313f..bb5ea4df6 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 @@ -19,26 +19,26 @@ public abstract class FeedCursorMapper { */ @NonNull public static Feed convert(@NonNull Cursor cursor) { - int indexId = cursor.getColumnIndex(PodDBAdapter.KEY_ID); - int indexLastUpdate = cursor.getColumnIndex(PodDBAdapter.KEY_LASTUPDATE); - int indexTitle = cursor.getColumnIndex(PodDBAdapter.KEY_TITLE); - int indexCustomTitle = cursor.getColumnIndex(PodDBAdapter.KEY_CUSTOM_TITLE); - int indexLink = cursor.getColumnIndex(PodDBAdapter.KEY_LINK); - int indexDescription = cursor.getColumnIndex(PodDBAdapter.KEY_DESCRIPTION); - int indexPaymentLink = cursor.getColumnIndex(PodDBAdapter.KEY_PAYMENT_LINK); - int indexAuthor = cursor.getColumnIndex(PodDBAdapter.KEY_AUTHOR); - int indexLanguage = cursor.getColumnIndex(PodDBAdapter.KEY_LANGUAGE); - int indexType = cursor.getColumnIndex(PodDBAdapter.KEY_TYPE); - int indexFeedIdentifier = cursor.getColumnIndex(PodDBAdapter.KEY_FEED_IDENTIFIER); - int indexFileUrl = cursor.getColumnIndex(PodDBAdapter.KEY_FILE_URL); - int indexDownloadUrl = cursor.getColumnIndex(PodDBAdapter.KEY_DOWNLOAD_URL); - int indexDownloaded = cursor.getColumnIndex(PodDBAdapter.KEY_DOWNLOADED); - int indexIsPaged = cursor.getColumnIndex(PodDBAdapter.KEY_IS_PAGED); - int indexNextPageLink = cursor.getColumnIndex(PodDBAdapter.KEY_NEXT_PAGE_LINK); - int indexHide = cursor.getColumnIndex(PodDBAdapter.KEY_HIDE); - int indexSortOrder = cursor.getColumnIndex(PodDBAdapter.KEY_SORT_ORDER); - int indexLastUpdateFailed = cursor.getColumnIndex(PodDBAdapter.KEY_LAST_UPDATE_FAILED); - int indexImageUrl = cursor.getColumnIndex(PodDBAdapter.KEY_IMAGE_URL); + int indexId = cursor.getColumnIndexOrThrow(PodDBAdapter.SELECT_KEY_FEED_ID); + int indexLastUpdate = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_LASTUPDATE); + int indexTitle = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_TITLE); + int indexCustomTitle = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_CUSTOM_TITLE); + int indexLink = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_LINK); + int indexDescription = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_DESCRIPTION); + int indexPaymentLink = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_PAYMENT_LINK); + int indexAuthor = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_AUTHOR); + int indexLanguage = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_LANGUAGE); + int indexType = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_TYPE); + 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 indexIsPaged = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_IS_PAGED); + int indexNextPageLink = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_NEXT_PAGE_LINK); + int indexHide = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_HIDE); + int indexSortOrder = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_SORT_ORDER); + int indexLastUpdateFailed = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_LAST_UPDATE_FAILED); + int indexImageUrl = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_IMAGE_URL); Feed feed = new Feed( cursor.getLong(indexId), diff --git a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/FeedPreferencesCursorMapper.java b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/FeedPreferencesCursorMapper.java index 9fc70a2d7..289bcbab8 100644 --- a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/FeedPreferencesCursorMapper.java +++ b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/FeedPreferencesCursorMapper.java @@ -20,21 +20,21 @@ public abstract class FeedPreferencesCursorMapper { */ @NonNull public static FeedPreferences convert(@NonNull Cursor cursor) { - int indexId = cursor.getColumnIndex(PodDBAdapter.KEY_ID); - int indexAutoDownload = cursor.getColumnIndex(PodDBAdapter.KEY_AUTO_DOWNLOAD_ENABLED); - int indexAutoRefresh = cursor.getColumnIndex(PodDBAdapter.KEY_KEEP_UPDATED); - int indexAutoDeleteAction = cursor.getColumnIndex(PodDBAdapter.KEY_AUTO_DELETE_ACTION); - int indexVolumeAdaption = cursor.getColumnIndex(PodDBAdapter.KEY_FEED_VOLUME_ADAPTION); - int indexUsername = cursor.getColumnIndex(PodDBAdapter.KEY_USERNAME); - int indexPassword = cursor.getColumnIndex(PodDBAdapter.KEY_PASSWORD); - int indexIncludeFilter = cursor.getColumnIndex(PodDBAdapter.KEY_INCLUDE_FILTER); - int indexExcludeFilter = cursor.getColumnIndex(PodDBAdapter.KEY_EXCLUDE_FILTER); - int indexMinimalDurationFilter = cursor.getColumnIndex(PodDBAdapter.KEY_MINIMAL_DURATION_FILTER); - int indexFeedPlaybackSpeed = cursor.getColumnIndex(PodDBAdapter.KEY_FEED_PLAYBACK_SPEED); - int indexAutoSkipIntro = cursor.getColumnIndex(PodDBAdapter.KEY_FEED_SKIP_INTRO); - int indexAutoSkipEnding = cursor.getColumnIndex(PodDBAdapter.KEY_FEED_SKIP_ENDING); - int indexEpisodeNotification = cursor.getColumnIndex(PodDBAdapter.KEY_EPISODE_NOTIFICATION); - int indexTags = cursor.getColumnIndex(PodDBAdapter.KEY_FEED_TAGS); + int indexId = cursor.getColumnIndexOrThrow(PodDBAdapter.SELECT_KEY_FEED_ID); + int indexAutoDownload = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_AUTO_DOWNLOAD_ENABLED); + int indexAutoRefresh = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_KEEP_UPDATED); + int indexAutoDeleteAction = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_AUTO_DELETE_ACTION); + int indexVolumeAdaption = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_FEED_VOLUME_ADAPTION); + int indexUsername = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_USERNAME); + int indexPassword = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_PASSWORD); + int indexIncludeFilter = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_INCLUDE_FILTER); + int indexExcludeFilter = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_EXCLUDE_FILTER); + int indexMinimalDurationFilter = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_MINIMAL_DURATION_FILTER); + int indexFeedPlaybackSpeed = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_FEED_PLAYBACK_SPEED); + int indexAutoSkipIntro = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_FEED_SKIP_INTRO); + int indexAutoSkipEnding = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_FEED_SKIP_ENDING); + int indexEpisodeNotification = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_EPISODE_NOTIFICATION); + int indexTags = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_FEED_TAGS); long feedId = cursor.getLong(indexId); boolean autoDownload = cursor.getInt(indexAutoDownload) > 0; -- cgit v1.2.3