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

Feature Request - Delete entire show as an option #37

Closed hacshacdgacs closed 3 months ago

hacshacdgacs commented 4 months ago

Is there any way to allow Janitorr to delete an entire show instead of just going season by season?

The way I have my sonarr setup currently is that if a show is no longer monitored it loses the 'keep' tag. Personally I'm not a fan of only having select seasons of a show so having the seasons disappearing based on age makes my library feel incomplete.

(I know I could always just delete the show myself when the seasons start disappearing or deleting it early but I like the idea of having it automated and clearing up space on it's own).

Schaka commented 4 months ago

I'll consider it. It currently goes against the idea of Janitorr - I really do treat every season like it's only entity because that's how I manage my library.

How would you determine when the show needs to be deleted? When any single episode expires it takes the show with it? Regardless of the oldest or most recent season?

If you can think this feature through a little more, I may be able to implement it. There are people wanting single episode deletion too, so it's a bunch of cases that need to be considered at all times.

hacshacdgacs commented 4 months ago

I think I'd personally prefer for it to be the latest episode/season to expire, it saves the risk of a show being deleted immediately after becoming unmonitored in my case (which if I wanted to happen I would just delete it myself).

Having it based on the latest media would also allow other users using my server a chance to see it in the 'leaving soon' library and ask me to keep it if they're actively watching it (something that jellystat I imagine would solve if/when that gets opened up to emby).

In my case because I request all seasons of a show at once currently my "leaving soon" collection has grabbed only Season 2 of a show and ignores Season 1 and 3 because they happened to download later.

If while having the 'delete entire show option' allowed it to monitor based on the latest media it would allow that whole show to be shifted into the "leaving soon" collection (a draw back of this does mean that the earlier downloaded seasons will survive past the 'deletion time limit' but I imagine people selecting this "whole show" option are okay with that otherwise they'd be using the original season by season option).

Having the whole show in the 'leaving soon' collection would also allow users who are now interested to actually be able to watch the whole series in that collection. Whereas currently they would have to go find it in the other library where they most likely missed it the first time around if they're now interested (which is something they could do now because they've seen it but for user convenience would ideally not have to).

The show above also showcases a time where deleting season by season won't work for me in this instance since if someone were to have started watching it (and didn't ask me to monitor it again) the second season of the show would be deleted prior to both season 1 and 3.

Schaka commented 4 months ago

That's good enough of a layout for me and I'll see what I can do about it.

No promises, but it'll go on the roadmap.

Does jellystat not work with Emby? I could swear I had seen that it does. It might be worth setting it up for you and just seeing what sticks. The API between the two hasn't grown far enough apart to warrant significant changes.

Implementing Emby for Janitorr took me a day, but I'm obviously only using a tiny part of the API.

hacshacdgacs commented 4 months ago

Sweet, thank you. Last time I tried Jellystat it didn't work for me (at least I don't remember it working) and there is an open issue/request for emby support that's in the roadmap an update or two down the line but I'll give it another go later today anyway.

Schaka commented 3 months ago

I have implemented a basic version, which is available in the :develop image. Currently having limited testing capabilities, please feel free to give it a shot and report back.

If you're currently using the :native image, keep in mind that the application.yml file needs to be mapped differently.

hacshacdgacs commented 3 months ago

I'm currently busy over the next couple of days but will test when I'm able. Thank you

On Sat, 18 May 2024, 00:03 Schaka, @.***> wrote:

I have implemented a basic version, which is available in the :develop image. Currently having limited testing capabilities, please feel free to give it a shot and report back.

If you're currently using the :native image, keep in mind that the application.yml file needs to be mapped differently.

— Reply to this email directly, view it on GitHub https://github.com/Schaka/janitorr/issues/37#issuecomment-2117446960, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUMWJOA2TEEKGDSLXRYAABDZCXWYXAVCNFSM6AAAAABG7P7UB2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJXGQ2DMOJWGA . You are receiving this because you authored the thread.Message ID: @.***>

hacshacdgacs commented 3 months ago

Have had a quick play with it today and it seems as if the option itself doesn't apply. It states in the logs "Treating TV shows as a whole - preparing to delete 0 shows" yet is still only adding some seasons to the leaving soon collections (the first two seasons of a show but not the third, another one being seasons 1,3,4,5 but not 2 and 6 because they had episodes downloaded later). (This is with jellystat disabled)

Unless this is the currently planned feature where the seasons will continue to appear as they cross that threshold but hold off on deleting until the latest season has met the target. If that's the case then the feature appears to be working.

Schaka commented 3 months ago

Do all of these have a history?

I added some trace logging in the latest build. Might be worth uploading a full trace log here.

Here is how it should work:

The leaving-soon collection uses the same date info as the deletion component itself. If you let it re-create your leaving soon folder, are some seasons still missing? I suspect it's old data that wasn't cleaned up, maybe?

Was your use case intended to delete by the most recent or by the oldest grab? I'll see if I can maybe turn that into an option.

hacshacdgacs commented 3 months ago

These shows all have history and I deleted my folder so it was able to rebuild and repopulate on its own. The same things happened. I'll have a look at the log later when back at home

"c.g.s.j.jellystat.JellystatNoOpService : Jellystat not in use, no requests found. janitorr-1 | 2024-05-20T16:55:15.442+12:00 INFO 1 --- [ scheduling-1] c.g.s.j.s.sonarr.SonarrRestService : Treating TV shows as a whole - preparing to delete 0 shows"

Only thing my logs are showing regarding the sonarr rest service. My use case was going to be most recent grab.

Schaka commented 3 months ago

Then it should work. I'll need a full log with trace logging enabled.

The log to look out for specifically, is this one:

log.trace("Treat TV show as a whole - overwriting season import date - IMDB: ${libItem.imdbId} imported at $latestDate")

In the limited testing I was able to do, it seemed to work just fine for me. Granted, everything requires each season to have a grab history with downloadFolderImported entries.

It would look a little something like this: image

If you click on your history in Sonarr for every season, it should show this. The only way this could be overwritten is if Janitorr detects that the history is outdated and Sonarr currently contains NO files for this season at all. It will then be disregarded entirely - can't create symlinks or delete files where there aren't any.

hacshacdgacs commented 3 months ago

Okay, I've found those lines in the trace logs so everything appears to be working. It's possible that sonarr managed to import a multi-season pack even though it wasn't meant to so isn't tracking everything properly. The feature does work properly however, thank you.