Schaka / janitorr

Cleans your Radarr, Sonarr, Jellyseerr and Jellyfin before you run out of space
GNU General Public License v3.0
263 stars 5 forks source link

how about using Playback reporting or Jellystat? #1

Closed cellulosa closed 5 months ago

cellulosa commented 7 months ago

heya many thanks for putting this together.

I was thinking, how about using something like the Playback reporting Jellyfin plugin or Jellystat to monitor watched/unwatched films and series in Jellyfin? This way, for example, you could decide to keep a file that's been sitting there for a year, if no users ever watched it.

Schaka commented 7 months ago

I specifically don't want to rely on plugin information (especially third party) to get information that isn't retroactively available. I was aware of Jellystat, which has no API docs and only starts collecting data once installed.

I've considered checking user history to see if there's a timestamp for when people finished watching certain episodes or movies.

Back matching (i.e. Jellyfin -> Radarr) is a bit harder, but it would be doable if the information was available in the first place. It kind of goes against the current approach where the arrs are the source.

I'll leave this ticket up in case there's a way I can think of doing it optionally. At least with the Playback reporting plugin, I feel a little more confident in official support.

kmaid commented 7 months ago

Jellystat will import data from the playback reporting plugin however the playback reporting plugin only stores the last 3 months of data by default.

I would also like to identify and remove media that is least frequently watched. Will keep an eye on this project!

cellulosa commented 7 months ago

perhaps this will help when it gets implemented https://github.com/jellyfin/jellyfin/issues/3016

Schaka commented 7 months ago

I requested API docs over at Jellystat and willbe looking into how to use Jellystat to determine media age by overwriting the age determined by the *arrs' history if the media can be found in Jellystat.

JamsRepos commented 6 months ago

I requested API docs over at Jellystat and willbe looking into how to use Jellystat to determine media age by overwriting the age determined by the *arrs' history if the media can be found in Jellystat.

I see the dev responded to you, do the correct end points exist for this?

Schaka commented 6 months ago

I haven't had the chance to look at it in detail and implement it yet. I'm sure it's possible one way or another, since the data it uses is straight from Jellyfin. I set it up on my serverand have it collecting data so I have something to work with when I get to it.

In my personal testing, the current release has been stable enough that I can consider adding features now.

Schaka commented 5 months ago

First little implementation is in v1.2.0.

It replaces whatever date is in your Sonarr/Radarr history with one from Jellystat if enabled and grabs the most recent watch that's >60 seconds and overwrite the grab date with the watch date if available.

nothing2obvi commented 5 months ago

I'm using tag-based deletion only and set a tag of 1d with an expiration of 1d and tagged a limited series (1 season) in Sonarr with that tag that on Jellystat has never been watched, but on dry-run, Janitorr won't delete it. Minimum-free-disk-percent is set to 100 and I am using the latest image from ghcr.io/schaka/janitorr. The series has no history in Sonarr.

Am I maybe misunderstanding something? Thanks.

03/29/2024
07:48:28 AM
2024-03-29T14:48:28.732Z  INFO 1 --- [           main] c.g.s.janitorr.JanitorrApplicationKt     : Started JanitorrApplicationKt in 3.583 seconds (process running for 4.15)
03/29/2024
07:48:28 AM
2024-03-29T14:48:28.812Z  INFO 1 --- [   scheduling-1] c.g.s.j.cleanup.MediaCleanupSchedule     : Media based cleanup disabled, do nothing
03/29/2024
07:48:28 AM
2024-03-29T14:48:28.815Z DEBUG 1 --- [   scheduling-1] c.g.s.j.cleanup.TagBasedCleanupSchedule  : Deleting TV shows and movies with tag: TagDeleteSchedule(tag=1d, expiration=PT24H)
Schaka commented 5 months ago

If it was never grabbed, Jellystat doesn't matter. A history still needs to exist. I may be able to adjust that, but not for now and not without more effort.

nothing2obvi commented 5 months ago

Understood. Thanks for clarifying.