From 46d27a86e19f7df5109ec2d82dbc8600689ad313 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sat, 3 Dec 2022 11:29:15 +0100 Subject: Hide started episodes from 'random episodes' screen --- .../java/de/danoeh/antennapod/storage/database/PodDBAdapter.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'storage/database') 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 -- cgit v1.2.3