summaryrefslogtreecommitdiff
path: root/storage/database
diff options
context:
space:
mode:
authorByteHamster <info@bytehamster.com>2022-12-03 11:29:15 +0100
committerByteHamster <info@bytehamster.com>2022-12-03 11:29:15 +0100
commit46d27a86e19f7df5109ec2d82dbc8600689ad313 (patch)
treed2e1395991342b6647966d94a8f53bdd2e5a8e00 /storage/database
parentbc3b7179112e986958bbb4773419ec94eb3aa67f (diff)
downloadAntennaPod-46d27a86e19f7df5109ec2d82dbc8600689ad313.zip
Hide started episodes from 'random episodes' screen
Diffstat (limited to 'storage/database')
-rw-r--r--storage/database/src/main/java/de/danoeh/antennapod/storage/database/PodDBAdapter.java5
1 files changed, 4 insertions, 1 deletions
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 63ced1973..46c731205 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
@@ -1068,8 +1068,11 @@ public class PodDBAdapter {
public Cursor getRandomEpisodesCursor(int limit, int seed) {
final String allItemsRandomOrder = SELECT_FEED_ITEMS_AND_MEDIA
+ " WHERE (" + KEY_READ + " = " + FeedItem.NEW + " OR " + KEY_READ + " = " + FeedItem.UNPLAYED + ") "
- // Only from the last two years. Older episodes frequently contain broken covers and stuff like that
+ // Only from the last two years. Older episodes often contain broken covers and stuff like that
+ " AND " + KEY_PUBDATE + " > " + (System.currentTimeMillis() - 1000L * 3600L * 24L * 356L * 2)
+ // Hide episodes that have been played but not completed
+ + " AND (" + KEY_LAST_PLAYED_TIME + " == 0"
+ + " OR " + KEY_LAST_PLAYED_TIME + " > " + (System.currentTimeMillis() - 1000L * 3600L) + ")"
+ " ORDER BY " + randomEpisodeNumber(seed);
final String query = "SELECT * FROM (" + allItemsRandomOrder + ")"
+ " GROUP BY " + KEY_FEED