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

Janitorr - Deleted show from a Sonarr instance it's not configured to interact with. #44

Closed CitizenElf closed 2 months ago

CitizenElf commented 2 months ago

Hello,

I'm currently experiencing an issue where Janitorr keeps deleting a show from an instance it is not set up for. For context, I run two instances of Sonarr, one for regular TV that Janitorr is set up for, and a separate Sonarr instance for just anime that I'd rather manage manually. This is potentially a two-part issue, with the root cause being something else that was seemingly inconsequential previously. The show in question is only getting deleted from Jellyfin (and as such the files are deleted), but the show remains monitored in Sonarr. The sequence in which the deletion & other issue occur are as follows:

2024-06-23T02:32:55.560Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Taskmaster (2015) [tvdbid-298905]/Season 03 2024-06-23T02:32:55.560Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Taskmaster (2015) [tvdbid-298905]/Season 04 2024-06-23T02:32:55.560Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Taskmaster (2015) [tvdbid-298905]/Season 06 2024-06-23T02:32:55.560Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Taskmaster (2015) [tvdbid-298905]/Season 07 2024-06-23T02:32:55.560Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Taskmaster (2015) [tvdbid-298905]/Season 08 2024-06-23T02:32:55.560Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Taskmaster (2015) [tvdbid-298905]/Season 09 2024-06-23T02:32:55.560Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Taskmaster (2015) [tvdbid-298905]/Season 10 2024-06-23T02:32:55.560Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Taskmaster (2015) [tvdbid-298905]/Season 11 2024-06-23T02:32:55.560Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Taskmaster (2015) [tvdbid-298905]/Season 12 2024-06-23T02:32:55.560Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Taskmaster (2015) [tvdbid-298905]/Season 14 2024-06-23T02:32:55.560Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Silo (2023) [tvdbid-403245]/Season 01 2024-06-23T02:32:55.561Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Superman & Lois (2021) [tvdbid-375655]/Season 01 2024-06-23T02:32:55.561Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Superman & Lois (2021) [tvdbid-375655]/Season 02 2024-06-23T02:32:55.561Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Superman & Lois (2021) [tvdbid-375655]/Season 03 2024-06-23T02:33:08.409Z INFO 1 --- [ scheduling-1] c.g.s.j.m.jellyfin.JellyfinClientConfig : Logged in to Jellyfin as Janitorr a270dfb7e33c4bbd82512b4d7b0907d3 2024-06-23T02:33:09.609Z INFO 1 --- [ scheduling-1] c.g.s.j.m.AbstractMediaServerRestService : Deleting HaNaYaMaTa Season 1 from Jellyfin 2024-06-23T03:33:54.179Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Taskmaster (2015) [tvdbid-298905]/Season 03 2024-06-23T03:33:54.179Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Taskmaster (2015) [tvdbid-298905]/Season 04 2024-06-23T03:33:54.179Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Taskmaster (2015) [tvdbid-298905]/Season 06 2024-06-23T03:33:54.179Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Taskmaster (2015) [tvdbid-298905]/Season 07 2024-06-23T03:33:54.179Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Taskmaster (2015) [tvdbid-298905]/Season 08 2024-06-23T03:33:54.179Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Taskmaster (2015) [tvdbid-298905]/Season 09 2024-06-23T03:33:54.179Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Taskmaster (2015) [tvdbid-298905]/Season 10 2024-06-23T03:33:54.179Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Taskmaster (2015) [tvdbid-298905]/Season 11 2024-06-23T03:33:54.179Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Taskmaster (2015) [tvdbid-298905]/Season 12 2024-06-23T03:33:54.179Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Taskmaster (2015) [tvdbid-298905]/Season 14 2024-06-23T03:33:54.179Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Silo (2023) [tvdbid-403245]/Season 01 2024-06-23T03:33:54.179Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Superman & Lois (2021) [tvdbid-375655]/Season 01 2024-06-23T03:33:54.179Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Superman & Lois (2021) [tvdbid-375655]/Season 02 2024-06-23T03:33:54.180Z INFO 1 --- [ scheduling-1] c.g.s.j.mediaserver.MediaServerService : Can't find original season folder - no links to create /tv/TV Shows/Superman & Lois (2021) [tvdbid-375655]/Season 03 2024-06-23T03:34:07.950Z INFO 1 --- [ scheduling-1] c.g.s.j.m.jellyfin.JellyfinClientConfig : Logged in to Jellyfin as Janitorr 8f926a8358a04bd1a635d30c5546baf3 2024-06-23T03:34:07.973Z ERROR 1 --- [ scheduling-1] c.g.s.j.m.AbstractMediaServerRestService : Deleting from Jellyfin failed

I believe that the folders Janitorr couldn't find are from prior to Janitorr when I would manually 'archive' some shows by moving them to back-up media, and unmonitoring the season & leaving the show in Sonarr. I'd been meaning to get around to cleaning them up eventually, but it looks like they're potentially causing other issues with Janitorr. From my understanding, I'm taking a guess that the season of HaNaYaMaTa was somehow ending up with the same Jellyfin item ID as another one of these other Seasons that Janitorr was trying to locate and delete. For further context, HaNaYaMaTa had only been added to the library a few hours prior to the deletion, and after assuming user error at first Janitorr then deleted it again after I had put the files back in the library but had not yet realised they were deleted by Janitorr. If these 'leftover' shows are causing issues it would be nice to know the root cause in the case of user-error as it looks like the above 'Can't find original season folder' messages still appear after deleting the show from Sonarr and re-adding it to kind of 'refresh' it in the eyes of Janitorr.

Schaka commented 2 months ago

Janitorr finds shows by IMDB/TMDB in Jellyfin and then deletes those. You may want to disable this feature altogether, if you suspect it's causing issues.

Generally, it should be virtually impossible for a mixup like this to happen. Can you screenshot or paste your metadat for HaNaYaMaTa here? I would love to know if it somehow clashes with what's in Jellyfin.

The show getting deleted is TVDB-ID: 281948, TMDB-ID: 61528 and IMDB-ID: tt3774756

None of these seem to clash. You can find the matching here: https://github.com/Schaka/janitorr/blob/develop/src/main/kotlin/com/github/schaka/janitorr/mediaserver/AbstractMediaServerRestService.kt#L160

I don't really see how this could happen, unless data is incorrectly matching what's available to Sonarr.

CitizenElf commented 2 months ago

The metadata seems to match for the most part, but there's an oddity here that might be the root cause.

As you mentioned, the TMDB-ID should be '61528', but Jellyfin has scraped it as 'hanayamata' instead.

Not sure why this would cause Janitorr to list the season for deletion, but I ran a dry run before correcting this and the AbstractMediaServerRestService immediately 'Found HaNaYaMaTa Season 1 on Jellyfin'. A dry run after correcting the issue instead targets a different show that sounds like a valid target based on the parameters of my config file. In any case, it seems Jellyfin itself was the root cause.

Schaka commented 2 months ago

There is definitely a hotfix I can attempt here. Right now, a incorrect string could lead to it matching an empty/missing ID in Sonarr. Appreciate the report.

Schaka commented 2 months ago

This is now available via :develop image. You can recreate the broken state and try it out via dry-run.

CitizenElf commented 2 months ago

Thanks for actioning that so quickly Schaka. After updating to the :develop image I was unable to replicate the issue.