[Bug]: Podcast Scheduled download restricted to 3 episodes max which breaks some podcasts #717

Closed
opened 2026-04-24 23:17:58 +02:00 by adam · 1 comment
Owner

Originally created by @louisjg on GitHub (Oct 26, 2022).

Describe the issue

There is a podcast I subscribe to, Coast to Coast AM, that pushes 4 episodes every night (hours 1-4 of the radio show as separate files).

I have it set via the Schedule tab to download every 24 hours. The result I get is hours 2-4 are downloaded, but hour 1 is not. The reason why is as in the example that follows:

timer expires, podcast manager runs episode check
Episode check gets the podcast feed and looks at the last episode pubDate (pubDate) it had remembered

It calls checkPodcastForNewEpisodes() with a default maxNewEpisodes argument of 3

It sees there are 4 new episodes:
ep4 - pubdate = 1/1/70 0503 (UTC)
ep3 - pubdate = 1/1/70 0502 (UTC)
ep2 - pubdate = 1/1/70 0501 (UTC)
ep1 - pubdate = 1/1/70 0500 (UTC)

It does a slice on this from (0, maxNewEpisodes) which in this case (from the Scheduled tab) is always 3. So it will fetch ep4, ep3, and ep2 but NOT ep1. The slice (0,3) causes ep1 to drop off.

It saves off the pubdate of the last episode it downloads. So this will be ep4 or 1/1/70 0503 (UTC)

The problem is ep1 will never be retrieved.

The next day when there are new episodes, checkPodcastForNewEpisodes() will run with the last pubdate: 1/1/70 0503 (UTC) which is AFTER the pubdate of ep1. Therefore ep1 will be lost forever. And all ep1 every night will be lost forever because the maxNewEpisodes is set to 3.

Here is actual output from my log file. I added output to dump the list of new episodes before the slice so I could debug it. Notice it dumps a list of 4 episodes, but only "finds" 3.

{"timestamp":"2022-10-25 13:00:00","message":"[CronManager] Start executing podcast cron 0 13 * * * for 1 item(s)","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:00","message":"[PodcastManager] runEpisodeCheck: "Coast to Coast AM Podcast" | Last check: Tue Oct 25 2022 02:52:06 GMT+0000 (Coordinated Universal Time) | Latest episode pubDate: Sun Oct 23 2022 10:03:27 GMT+0000 (Coordinated Universal Time)","levelName":"INFO","level":2}
{"timestamp":"2022-10-25 13:00:00","message":"[PodcastManager] runEpisodeCheck: "Coast to Coast AM Podcast" checking for episodes after Sun Oct 23 2022 10:03:27 GMT+0000 (Coordinated Universal Time)","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:00","message":"[podcastUtils] getPodcastFeed for "https://<username/login redacted>@rss.premiereradio.net/podcast/coast.xml"","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:01","message":"[podcastUtils] getPodcastFeed for "https://<username/login redacted>@rss.premiereradio.net/podcast/coast.xml" success - parsing xml","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:02","message":"[PodcastManager] check after: 1666519407000","levelName":"INFO","level":2}
{"timestamp":"2022-10-25 13:00:02","message":"[PodcastManager] Episode Mon, Oct 24 2022 - Hour 4 Date 1666605820000","levelName":"INFO","level":2}
{"timestamp":"2022-10-25 13:00:02","message":"[PodcastManager] Episode Mon, Oct 24 2022 - Hour 3 Date 1666605745000","levelName":"INFO","level":2}
{"timestamp":"2022-10-25 13:00:02","message":"[PodcastManager] Episode Mon, Oct 24 2022 - Hour 2 Date 1666605668000","levelName":"INFO","level":2}
{"timestamp":"2022-10-25 13:00:02","message":"[PodcastManager] Episode Mon, Oct 24 2022 - Hour 1 Date 1666605652000","levelName":"INFO","level":2}
{"timestamp":"2022-10-25 13:00:02","message":"[PodcastManager] runEpisodeCheck: 3 episodes found","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:02","message":"[PodcastManager] Found 3 new episodes for podcast "Coast to Coast AM Podcast" - starting download","levelName":"INFO","level":2}
{"timestamp":"2022-10-25 13:00:02","message":"[Watcher] Ignoring directory "/podcasts/favorites/Coast to Coast AM Podcast"","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:02","message":"[fileUtils] Downloading file to /podcasts/favorites/Coast to Coast AM Podcast/Mon, Oct 24 2022 - Hour 4.mp3","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:02","message":"[LibraryItem] Success saving abmetadata to "/metadata/items/li_fb242ffmibppyeeklr/metadata.abs"","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:03","message":"[DB] Library Items updated 1","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:03","message":"[CronManager] Finished executing podcast cron 0 13 * * * for 1 item(s)","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:08","message":"[LibraryItem] Success saving abmetadata to "/metadata/items/li_fb242ffmibppyeeklr/metadata.abs"","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:09","message":"[DB] Library Items updated 1","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:09","message":"[PodcastManager] Successfully downloaded podcast episode "Mon, Oct 24 2022 - Hour 4"","levelName":"INFO","level":2}
{"timestamp":"2022-10-25 13:00:09","message":"[Watcher] No longer ignoring directory "/podcasts/favorites/Coast to Coast AM Podcast"","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:09","message":"[Watcher] Ignoring directory "/podcasts/favorites/Coast to Coast AM Podcast"","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:09","message":"[fileUtils] Downloading file to /podcasts/favorites/Coast to Coast AM Podcast/Mon, Oct 24 2022 - Hour 3.mp3","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:13","message":"[LibraryItem] Success saving abmetadata to "/metadata/items/li_fb242ffmibppyeeklr/metadata.abs"","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:14","message":"[DB] Library Items updated 1","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:14","message":"[PodcastManager] Successfully downloaded podcast episode "Mon, Oct 24 2022 - Hour 3"","levelName":"INFO","level":2}
{"timestamp":"2022-10-25 13:00:14","message":"[Watcher] No longer ignoring directory "/podcasts/favorites/Coast to Coast AM Podcast"","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:14","message":"[Watcher] Ignoring directory "/podcasts/favorites/Coast to Coast AM Podcast"","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:14","message":"[fileUtils] Downloading file to /podcasts/favorites/Coast to Coast AM Podcast/Mon, Oct 24 2022 - Hour 2.mp3","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:18","message":"[LibraryItem] Success saving abmetadata to "/metadata/items/li_fb242ffmibppyeeklr/metadata.abs"","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:19","message":"[DB] Library Items updated 1","levelName":"DEBUG","level":1}
{"timestamp":"2022-10-25 13:00:19","message":"[PodcastManager] Successfully downloaded podcast episode "Mon, Oct 24 2022 - Hour 2"","levelName":"INFO","level":2}
{"timestamp":"2022-10-25 13:00:19","message":"[Watcher] No longer ignoring directory "/podcasts/favorites/Coast to Coast AM Podcast"","levelName":"DEBUG","level":1}

I think to fix this requires two parts:

  1. Allow root to set maxNewEpisodes per podcast for autodownload so root can set maxNewEpisodes >= the number per poll interval

  2. Ideally the scan should start with the oldest episode that's NOT downloaded and work forward maxNewEpisodes. This way at least nothing will be lost. If root wants to catch up, then a manual download could catch them up.

Steps to reproduce the issue

  1. Subscribe to a podcast via the Schedule tab that pushes more than 3 episodes per scheduled time interval (or simulate such)

  2. Let the scheduled run happen

  3. The result will be it always downloads only the last 3 episodes. Anything before those 3 is lost and can only be manually downloaded via FindEpisodes and manually selecting the ones that are missed. They will not be picked up on the next scan.

Audiobookshelf version

v2.2.1

How are you running audiobookshelf?

Docker

Originally created by @louisjg on GitHub (Oct 26, 2022). ### Describe the issue There is a podcast I subscribe to, Coast to Coast AM, that pushes 4 episodes every night (hours 1-4 of the radio show as separate files). I have it set via the Schedule tab to download every 24 hours. The result I get is hours 2-4 are downloaded, but hour 1 is not. The reason why is as in the example that follows: timer expires, podcast manager runs episode check Episode check gets the podcast feed and looks at the last episode pubDate (pubDate) it had remembered It calls checkPodcastForNewEpisodes() with a default maxNewEpisodes argument of 3 It sees there are 4 new episodes: ep4 - pubdate = 1/1/70 0503 (UTC) ep3 - pubdate = 1/1/70 0502 (UTC) ep2 - pubdate = 1/1/70 0501 (UTC) ep1 - pubdate = 1/1/70 0500 (UTC) It does a slice on this from (0, maxNewEpisodes) which in this case (from the Scheduled tab) is always 3. So it will fetch ep4, ep3, and ep2 but NOT ep1. The slice (0,3) causes ep1 to drop off. It saves off the pubdate of the last episode it downloads. So this will be ep4 or 1/1/70 0503 (UTC) The problem is ep1 will never be retrieved. The next day when there are new episodes, checkPodcastForNewEpisodes() will run with the last pubdate: 1/1/70 0503 (UTC) which is AFTER the pubdate of ep1. Therefore ep1 will be lost forever. And all ep1 every night will be lost forever because the maxNewEpisodes is set to 3. Here is actual output from my log file. I added output to dump the list of new episodes before the slice so I could debug it. Notice it dumps a list of 4 episodes, but only "finds" 3. > {"timestamp":"2022-10-25 13:00:00","message":"[CronManager] Start executing podcast cron 0 13 * * * for 1 item(s)","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:00","message":"[PodcastManager] runEpisodeCheck: \"Coast to Coast AM Podcast\" | Last check: Tue Oct 25 2022 02:52:06 GMT+0000 (Coordinated Universal Time) | Latest episode pubDate: Sun Oct 23 2022 10:03:27 GMT+0000 (Coordinated Universal Time)","levelName":"INFO","level":2} {"timestamp":"2022-10-25 13:00:00","message":"[PodcastManager] runEpisodeCheck: \"Coast to Coast AM Podcast\" checking for episodes after Sun Oct 23 2022 10:03:27 GMT+0000 (Coordinated Universal Time)","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:00","message":"[podcastUtils] getPodcastFeed for \"https://<username/login redacted>@rss.premiereradio.net/podcast/coast.xml\"","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:01","message":"[podcastUtils] getPodcastFeed for \"https://<username/login redacted>@rss.premiereradio.net/podcast/coast.xml\" success - parsing xml","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:02","message":"[PodcastManager] check after: 1666519407000","levelName":"INFO","level":2} {"timestamp":"2022-10-25 13:00:02","message":"[PodcastManager] Episode Mon, Oct 24 2022 - Hour 4 Date 1666605820000","levelName":"INFO","level":2} {"timestamp":"2022-10-25 13:00:02","message":"[PodcastManager] Episode Mon, Oct 24 2022 - Hour 3 Date 1666605745000","levelName":"INFO","level":2} {"timestamp":"2022-10-25 13:00:02","message":"[PodcastManager] Episode Mon, Oct 24 2022 - Hour 2 Date 1666605668000","levelName":"INFO","level":2} {"timestamp":"2022-10-25 13:00:02","message":"[PodcastManager] Episode Mon, Oct 24 2022 - Hour 1 Date 1666605652000","levelName":"INFO","level":2} {"timestamp":"2022-10-25 13:00:02","message":"[PodcastManager] runEpisodeCheck: 3 episodes found","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:02","message":"[PodcastManager] Found 3 new episodes for podcast \"Coast to Coast AM Podcast\" - starting download","levelName":"INFO","level":2} {"timestamp":"2022-10-25 13:00:02","message":"[Watcher] Ignoring directory \"/podcasts/favorites/Coast to Coast AM Podcast\"","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:02","message":"[fileUtils] Downloading file to /podcasts/favorites/Coast to Coast AM Podcast/Mon, Oct 24 2022 - Hour 4.mp3","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:02","message":"[LibraryItem] Success saving abmetadata to \"/metadata/items/li_fb242ffmibppyeeklr/metadata.abs\"","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:03","message":"[DB] Library Items updated 1","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:03","message":"[CronManager] Finished executing podcast cron 0 13 * * * for 1 item(s)","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:08","message":"[LibraryItem] Success saving abmetadata to \"/metadata/items/li_fb242ffmibppyeeklr/metadata.abs\"","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:09","message":"[DB] Library Items updated 1","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:09","message":"[PodcastManager] Successfully downloaded podcast episode \"Mon, Oct 24 2022 - Hour 4\"","levelName":"INFO","level":2} {"timestamp":"2022-10-25 13:00:09","message":"[Watcher] No longer ignoring directory \"/podcasts/favorites/Coast to Coast AM Podcast\"","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:09","message":"[Watcher] Ignoring directory \"/podcasts/favorites/Coast to Coast AM Podcast\"","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:09","message":"[fileUtils] Downloading file to /podcasts/favorites/Coast to Coast AM Podcast/Mon, Oct 24 2022 - Hour 3.mp3","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:13","message":"[LibraryItem] Success saving abmetadata to \"/metadata/items/li_fb242ffmibppyeeklr/metadata.abs\"","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:14","message":"[DB] Library Items updated 1","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:14","message":"[PodcastManager] Successfully downloaded podcast episode \"Mon, Oct 24 2022 - Hour 3\"","levelName":"INFO","level":2} {"timestamp":"2022-10-25 13:00:14","message":"[Watcher] No longer ignoring directory \"/podcasts/favorites/Coast to Coast AM Podcast\"","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:14","message":"[Watcher] Ignoring directory \"/podcasts/favorites/Coast to Coast AM Podcast\"","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:14","message":"[fileUtils] Downloading file to /podcasts/favorites/Coast to Coast AM Podcast/Mon, Oct 24 2022 - Hour 2.mp3","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:18","message":"[LibraryItem] Success saving abmetadata to \"/metadata/items/li_fb242ffmibppyeeklr/metadata.abs\"","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:19","message":"[DB] Library Items updated 1","levelName":"DEBUG","level":1} {"timestamp":"2022-10-25 13:00:19","message":"[PodcastManager] Successfully downloaded podcast episode \"Mon, Oct 24 2022 - Hour 2\"","levelName":"INFO","level":2} {"timestamp":"2022-10-25 13:00:19","message":"[Watcher] No longer ignoring directory \"/podcasts/favorites/Coast to Coast AM Podcast\"","levelName":"DEBUG","level":1} I think to fix this requires two parts: 1) Allow root to set maxNewEpisodes per podcast for autodownload so root can set maxNewEpisodes >= the number per poll interval 2) Ideally the scan should start with the oldest episode that's NOT downloaded and work forward maxNewEpisodes. This way at least nothing will be lost. If root wants to catch up, then a manual download could catch them up. ### Steps to reproduce the issue 1. Subscribe to a podcast via the Schedule tab that pushes more than 3 episodes per scheduled time interval (or simulate such) 2. Let the scheduled run happen 3. The result will be it always downloads only the last 3 episodes. Anything before those 3 is lost and can only be manually downloaded via FindEpisodes and manually selecting the ones that are missed. They will not be picked up on the next scan. ### Audiobookshelf version v2.2.1 ### How are you running audiobookshelf? Docker
adam added the bug label 2026-04-24 23:17:58 +02:00
adam closed this issue 2026-04-24 23:17:59 +02:00
Author
Owner

@advplyr commented on GitHub (Nov 5, 2022):

You can now set the max number of episodes to download in v2.2.2

This is in the schedule tab for each podcast

@advplyr commented on GitHub (Nov 5, 2022): You can now set the max number of episodes to download in [v2.2.2](https://github.com/advplyr/audiobookshelf/releases/tag/v2.2.2) This is in the schedule tab for each podcast
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#717