advplyr / audiobookshelf

Self-hosted audiobook and podcast server
https://audiobookshelf.org
GNU General Public License v3.0
6.69k stars 472 forks source link

[Enhancement]: Add Option to Auto Delete Podcast Episodes when exceeding X episodes #903

Closed feerlessleadr closed 2 years ago

feerlessleadr commented 2 years ago

Describe the feature/enhancement

This was briefly discussed in this thread , but it was closed and not implemented or resolved as far as I can tell. As a result, I wanted to open a new request with a similar (but perhaps slightly different request).

I listen to a number of daily news type podcasts, but not super religiously. Sometimes I'll listen to new shows every day, and other times I won't listen for a week or more.

Since I don't want to listen to a news podcast that is 1 or 2 weeks out of date, it would be great if on the server, on a per podcast basis, I could turn on a setting that would only keep the latest "x" number of episodes (with "x" being user defined, say 5 as an example).

Any time a new episode is downloaded by the server with this setting enabled for that podcast, ABS would delete the oldest episode to make room for the new download.

Obviously this would not be a global setting, since there are many other episodic podcasts that this would not work well for.

Thanks for your consideration!

advplyr commented 2 years ago

Suppose you set the episode limit to 5 for a podcast, there are several scenarios we will need to workout before this gets implemented.

  1. You already have more than 5 episodes
  2. You manually download more than 5 episodes
  3. Some episodes don't have a pubDate set (could be scanned in from the file system)

The first 2 might not be an issue if the logic will only remove 1 episode when downloading 1 episode by the automatic downloader. So manually downloading episodes doesn't trigger any sort of removal, the only time a removal is triggered is if the auto download successfully downloads a new episode and you have more than 5 episodes.

For the 3rd situation we may want to just ignore episodes without a pubDate. For example if you have 6 episodes but 3 of them don't have a pubDate then only 3 will be considered when comparing for removal.

feerlessleadr commented 2 years ago

I'll honestly defer to you.

If I were the one making the final call, in scenarios 1 and 2, I wouldn't handle previously downloaded, or manually downloaded episodes differently than auto downloaded. What you could do is, on a per episode basis, add an option to always keep or something, this way the user can explicitly decide to keep or not?

Honestly though, your proposal is probably the easiest, so that means sense to me too.

advplyr commented 2 years ago

Added in 2.1.3

I went with the easier approach for now but we can revise later.