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: Do not delete from *arr just unmonitor #29

Closed miberecz closed 5 months ago

miberecz commented 5 months ago

I have just ran a test execution of your script, and was supprised that half of my Sonarr entries were gone, even so that I have dry-run: true . Not a big deal, Sonarr backups are easy to restore but still... Would it make sense to have a config entry to only unmonitor a Series/Season/Movie but keep it in *arr?

Also I would have a question, let me not open a separate issue: How do you tell that a movie is still seeding ?

arr_janitorr.1.ry0fqbkxbqhy@banavm01    | 2024-03-31T16:48:14.794+02:00  INFO 1 --- [   scheduling-1] c.g.s.j.s.radarr.RadarrRestService       : Can't delete movie [still seeding - file exists] (/media/bananas/Torrent/Oppenheimer 2023 1080p Blu-ray AVC DTS-HD MA 5.1-ESiR/BDMV/STREAM/00246.m2ts), id: 73, imdb: tt15398776
Schaka commented 5 months ago

You may have caught a bug. Is the show that disappeared empty?

Janitorr checks if seasons in a show are all monitored and if no files were found (via Sonarr's API, not file access) it will delete the entire show.

The entry you should see in your log is

log.info("Deleting {} [{}] - All seasons were unused", show.title, show.id)

If this isn't the case, I'm not sure you set up the config file correctly.

Seeding is determined by *arr grab history and checking if the original file (hardlinked) still in place (i.e. still seeding).

miberecz commented 5 months ago

Yes I saw the log entries, a lot of them actually :)

Okay, so deleting an entire show mostly not desired. What if currently there are no season, but they announce a new? Lots of current Disney shows are coming up with one season, and if its popular they will do more (see Loki, Mandalorian... etc ). Or there was this show about Jeffrey Dahmer called "Dahmer", now its rebranded to "Monster" and become an anthology ( https://www.imdb.com/title/tt13207736/ ) So I would suggest to make this an option atleast.

About the other topic (maybe I should open a new ticket afterall?) What if I want to delete the original file? That would be the point to free up space. If I just delete the hardlinks, I gain nothing, do I?

Anyways, you are doing Gods works here. Danke sehr!

Schaka commented 5 months ago

I'll turn it into an option.

Right now, if the latest season is monitored it doesn't get removed. Only shows with no monitored seasons and no files at all get removed. I'll make it so you can turn that feature off.

You don't need to worry about hardlinks. All cleanup is done via API requests to the arrs, not file access. So the files will disappear if they're still seeding. Generally you wouldn't want to delete files that are still seeding though.

It's also highly recommend running something like qbit_manage to clean up your torrent directory for anything that doesn't hardlink outside of it.

I'll make it an option as well to ignore the seed check.

Schaka commented 5 months ago

Regarding the initial feature request: I don't want to implement something that doesn't delete data. The whole point of Janitorr is to delete "left over" media.

I've given it some thought and just unmonitoring makes no sense to me. If you can provide a good argument for why unmonitoring should be in, when you can already set a tag to prevent deletion for each show and you somehow have a reasonable approach to just unmonitoring, I'm willing to change my mind.

But as of right now, it goes against the spirit of Janitorr. If media is unused, let Janitorr clean it up and have your users request it again when they ACTUALLY want to watch it.

The rest of your bug fixes and suggestions have been implemented in v1.2.5

miberecz commented 5 months ago

Yes, and I'm totally with you. I do not mean to keep the media itself. Sure enough, if the last season (or the one existing if there is only one) of the show was seen by the family, then it should be deleted. I just say, that Sonarr entry is not media, its just some database lines, that not take up that much space. And as I explained, it would come in handy if years later they revive it for a new season for some reason. Yes, tagging it is an option, but then you have to expect new seasons. Lets take the Dahmer example: would you think that a show would continue after the story was clearly over?

Schaka commented 5 months ago

What you want, meaning empty TV show cleanup, has already been implemented as an option you can disable.

I was asking specifically for a use case for unmonitoring over media deletion.

miberecz commented 5 months ago

I just want to unmonitor the last season after the corresponding media files are deleted, but keeping the show itself. Maybe we have a little misunderstanding. I can see the option delete-empty-shows. I will test it out.

Schaka commented 5 months ago

Oh, you're asking that instead of the show being deleted, the latest season just gets unmonitored? That may be doable as an option.

miberecz commented 5 months ago

Yes, exactly. Keep the absolute minimum of it.

Schaka commented 5 months ago

It just doesn't match Janitorr. I had a rudimentary implementation and decided to revert it. Janitorr ONLY deletes shows where ALL seasons are already unmonitored and ALL files are missing.

Disabling deletion is enough. Trying to fit some logic into that that would also unmonitor all seasons that have no files way overcomplicates things and doesn't really give the desired results.

The whole point of this "feature" was so shows can get removed if Janitorr leaves orphaned folders around after deleting all seasons. Disabling that will leave shows on your drive and in Sonarr. That has to be enough.