jellyfin-plugin-media-cleaner: [Bug]: wrong interaction between filters

What happened?

I configured the new " Keep not played for X days" option to 60 days, but I noticed that it would try to delete some movies even when in my opinion it should not.

Here is a specific example: Nosferatu was added to the server on the 31st of January 2023. I’ve watched it recently, the log shows: [Deb] ItemsAdapter: "Nosferatu" played by "nicola" (01/31/2024 00:20:11) Since it has been opened in the last 30 days, then the log shows: [Tra] Filtering.ExpiredFilter: Filtering item "Nosferatu" [Tra] Filtering.ExpiredFilter: Latest played by "nicola" [Tra] JunkCollectors.MoviesJunkCollector: "Nosferatu" filtered by Expired Then when the new filter is applied: [Tra] Filtering.ExpiredNotPlayedFilter: Filtering item "Nosferatu" [Tra] Filtering.ExpiredNotPlayedFilter: Not played by anyone since 01/31/2023 00:00:00 And at the bottom: [Inf] MediaCleanupTask: (Movie) "Nosferatu" will be deleted because no one played it since 01/31/2023 00:00:00

I think this is not intuitive at all (or even wrong). I don’t want the plugin to delete something that users are watching, no matter how old the file is.

A solution could be to run the ExpiredNotPlayedFileter first, to collect all the old files, then the ExpiredFilter, overwriting the list if needed. Finally check its most recent play.

Troubleshooting info

* Jellyfin version: 10.8.13
* Plugin version: 2.14.0.0
<details>
<summary>Configuration</summary>
<pre>
&lt;PluginConfiguration&gt;
  &lt;KeepMoviesFor&gt;30&lt;/KeepMoviesFor&gt;
  &lt;KeepMoviesNotPlayedFor&gt;60&lt;/KeepMoviesNotPlayedFor&gt;
  &lt;KeepPlayedMovies&gt;AnyUserRolling&lt;/KeepPlayedMovies&gt;
  &lt;KeepFavoriteMovies&gt;AnyUser&lt;/KeepFavoriteMovies&gt;
  &lt;KeepEpisodesFor&gt;30&lt;/KeepEpisodesFor&gt;
  &lt;KeepEpisodesNotPlayedFor&gt;-1&lt;/KeepEpisodesNotPlayedFor&gt;
  &lt;KeepPlayedEpisodes&gt;AnyUserRolling&lt;/KeepPlayedEpisodes&gt;
  &lt;KeepFavoriteEpisodes&gt;AnyUser&lt;/KeepFavoriteEpisodes&gt;
  &lt;DeleteEpisodes&gt;Season&lt;/DeleteEpisodes&gt;
  &lt;KeepVideosFor&gt;-1&lt;/KeepVideosFor&gt;
  &lt;KeepVideosNotPlayedFor&gt;-1&lt;/KeepVideosNotPlayedFor&gt;
  &lt;KeepPlayedVideos&gt;AnyUserRolling&lt;/KeepPlayedVideos&gt;
  &lt;KeepFavoriteVideos&gt;AnyUser&lt;/KeepFavoriteVideos&gt;
  &lt;KeepAudioFor&gt;-1&lt;/KeepAudioFor&gt;
  &lt;KeepAudioNotPlayedFor&gt;-1&lt;/KeepAudioNotPlayedFor&gt;
  &lt;KeepPlayedAudio&gt;AnyUserRolling&lt;/KeepPlayedAudio&gt;
  &lt;KeepFavoriteAudio&gt;AnyUser&lt;/KeepFavoriteAudio&gt;
  &lt;KeepAudioBooksFor&gt;-1&lt;/KeepAudioBooksFor&gt;
  &lt;KeepAudioBooksNotPlayedFor&gt;-1&lt;/KeepAudioBooksNotPlayedFor&gt;
  &lt;KeepPlayedAudioBooks&gt;AnyUserRolling&lt;/KeepPlayedAudioBooks&gt;
  &lt;KeepFavoriteAudioBooks&gt;AnyUser&lt;/KeepFavoriteAudioBooks&gt;
  &lt;UsersIgnorePlayed&gt;
    &lt;string&gt;da1c429756594ff6b4719d24d1f65c9c&lt;/string&gt;
  &lt;/UsersIgnorePlayed&gt;
  &lt;UsersPlayedMode&gt;Ignore&lt;/UsersPlayedMode&gt;
  &lt;UsersIgnoreFavorited&gt;
    &lt;string&gt;da1c429756594ff6b4719d24d1f65c9c&lt;/string&gt;
  &lt;/UsersIgnoreFavorited&gt;
  &lt;UsersFavoritedMode&gt;Ignore&lt;/UsersFavoritedMode&gt;
  &lt;LocationsExcluded&gt;
    &lt;string&gt;/run/media/hpuser/hdd1/media/movies&lt;/string&gt;
    &lt;string&gt;/run/media/hpuser/hdd1/media/trakt-watchlists&lt;/string&gt;
    &lt;string&gt;/run/media/hpuser/hdd1/media/series&lt;/string&gt;
  &lt;/LocationsExcluded&gt;
  &lt;LocationsMode&gt;Include&lt;/LocationsMode&gt;
  &lt;MarkAsUnplayed&gt;false&lt;/MarkAsUnplayed&gt;
&lt;/PluginConfiguration&gt;
</pre>
</details>

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (13 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks for comprehensive testing! I’ll push an update to release.