ManiMatter / decluttarr

Watches radarr, sonarr, lidarr, readarr and whisparr download queues and removes downloads if they become stalled or no longer needed.
GNU General Public License v3.0
153 stars 20 forks source link

More Defaults to Failed / Stuck Imports? #127

Closed slkiny closed 1 month ago

slkiny commented 1 month ago
image

"Downloaded - Unable to Import Automatically"

I also found one was stuck on, Importing Forever.. But not sure if that's solvable or if we just have to kill it re-try

"Downloaded - Importing"

Add new ones to this? the " Unable to Import Automatically" specifically.

slkiny commented 1 month ago

decluttarr | [DEBUG]: http://ubuntutorserver.lan:8989 "GET /sonarr/api/v3/queue?page=1&pageSize=2&includeUnknownSeriesItems=True HTTP/11" 200 None decluttarr | [DEBUG]: queueCleaner/full_queue at start: decluttarr | [DEBUG]: {'page': 1, 'pageSize': 2, 'sortKey': 'timeleft', 'sortDirection': 'descending', 'totalRecords': 2, 'records': [{'seriesId': 90, 'episodeId': 8215, 'seasonNumber': 8, 'languages': [{'id': 1, 'name': 'English'}], 'quality': {'quality': {'id': 9, 'name': 'HDTV-1080p', 'source': 'television', 'resolution': 1080}, 'revision': {'version': 1, 'real': 0, 'isRepack': False}}, 'customFormats': [{'id': 38, 'name': 'Language: Prefer English'}], 'customFormatScore': 100, 'size': 3362784032, 'title': 'Survivor AU S08E24 1080p HDTV H264 CBFM rartv ORARBG', 'sizeleft': 0, 'timeleft': '00:00:00', 'estimatedCompletionTime': '2024-07-13T03:07:26Z', 'added': '2024-06-24T05:05:48Z', 'status': 'completed', 'trackedDownloadStatus': 'ok', 'trackedDownloadState': 'importing', 'statusMessages': [], 'downloadId': '0C84E81C8060974B8C5DE44480357F3ADAABABA0', 'protocol': 'torrent', 'downloadClient': 'qbit', 'downloadClientHasPostImportCategory': False, 'indexer': 'TheRARBG (Prowlarr)', 'outputPath': '/data/torrents/tv-sonarr/Survivor.AU.S08E24.1080p.HDTV.H264-CBFM[rarbg]', 'episodeHasFile': False, 'id': 129893534}, {'seriesId': 30, 'episodeId': 6630, 'seasonNumber': 7, 'languages': [], 'quality': {'quality': {'id': 9, 'name': 'HDTV-1080p', 'source': 'television', 'resolution': 1080}, 'revision': {'version': 1, 'real': 0, 'isRepack': False}}, 'customFormats': [], 'customFormatScore': 0, 'size': 1173299529, 'title': '[New-raws] Boku no Hero Academia S7 - 09 [1080p] [AMZN]', 'sizeleft': 0, 'timeleft': '00:00:00', 'estimatedCompletionTime': '2024-07-13T03:07:26Z', 'added': '2024-06-29T09:22:35Z', 'status': 'completed', 'trackedDownloadStatus': 'warning', 'trackedDownloadState': 'importBlocked', 'statusMessages': [{'title': 'One or more episodes expected in this release were not imported or missing from the release', 'messages': []}, {'title': '[New-raws] Boku no Hero Academia S7 - 09 [1080p] [AMZN].mkv', 'messages': ['Episode 1x09 was not found in the grabbed release: [New-raws] Boku no Hero Academia S7E09 [1080p] [AMZN].mkv']}], 'downloadId': '861154B848002DD44497BE1F9229D1852C62D174', 'protocol': 'torrent', 'downloadClient': 'qbit', 'downloadClientHasPostImportCategory': False, 'indexer': 'Nyaa.si (Prowlarr)', 'outputPath': '/data/torrents/tv-sonarr/[New-raws] Boku no Hero Academia S7 - 09 [1080p] [AMZN].mkv', 'episodeHasFile': True, 'id': 1135504527}]}}

'trackedDownloadState': 'importing' -- One is just Importing 'trackedDownloadState': 'importBlocked'

decluttarr | [DEBUG]: http://ubuntutorserver.lan:8989 "GET /sonarr/api/v3/queue?page=1&pageSize=2 HTTP/11" 200 None decluttarr | [DEBUG]: execute_checks/queue OUT (failType: unmonitored): [{'downloadId': '0C84E81C8060974B8C5DE44480357F3ADAABABA0', 'downloadTitle': 'Survivor AU S08E24 1080p HDTV H264 CBFM rartv ORARBG', 'IDs': [129893534]}, {'downloadId': '861154B848002DD44497BE1F9229D1852C62D174', 'downloadTitle': '[New-raws] Boku no Hero Academia S7 - 09 [1080p] [AMZN]', 'IDs': [1135504527]}]

slkiny commented 1 month ago

My initial thought is if its just an importBlocked would that be caught by the patterns? I tried a few messages, but looking at the debug the message is actually empty or is it the title that matters?

Nabstar3 commented 1 month ago

In your case, import is blocked because 'Episode 1x09 was not found in the grabbed release.

i.e. An episode was missing

However, I assume that Sonarr would still import the rest of the episodes and conduct an search on the missing episode aslong as its monitored.

If my assumption is correct, I see no need for marking it as bad and removing the already downloaded episodes.

Furthermore, import blocked is sourced from a variety of issues including importing option issues that are not directly related to the release grabbed/downloaded. This would just lead to a healthy download that has matched the search criteria from being removed from the downloader and having another release be grabbed only for the same issue to occur again.

ManiMatter commented 1 month ago

Here's the code that rules over the import-blocked code: https://github.com/ManiMatter/decluttarr/blob/d9c49693de8a325da9f9869547b03eae534bb8b6/src/jobs/remove_failed_imports.py#L21-L23

In your log showing queueCleaner/full_queue at start, you see specifically this queue item that corresponds to your screenshot of qbit:

{'seriesId': 30, 'episodeId': 6630, 'seasonNumber': 7, 'languages': [], 'quality': {'quality': {'id': 9, 'name': 'HDTV-1080p', 'source': 'television', 'resolution': 1080}, 'revision': {'version': 1, 'real': 0, 'isRepack': False}}, 'customFormats': [], 'customFormatScore': 0, 'size': 1173299529, 'title': '[New-raws] Boku no Hero Academia S7 - 09 [1080p] [AMZN]', 'sizeleft': 0, 'timeleft': '00:00:00', 'estimatedCompletionTime': '2024-07-13T03:07:26Z', 'added': '2024-06-29T09:22:35Z', 'status': 'completed', 'trackedDownloadStatus': 'warning', 'trackedDownloadState': 'importBlocked', 'statusMessages': [{'title': 'One or more episodes expected in this release were not imported or missing from the release', 'messages': []}, {'title': '[New-raws] Boku no Hero Academia S7 - 09 [1080p] [AMZN].mkv', 'messages': ['Episode 1x09 was not found in the grabbed release: [New-raws] Boku no Hero Academia S7E09 [1080p] [AMZN].mkv']}], 'downloadId': '861154B848002DD44497BE1F9229D1852C62D174', 'protocol': 'torrent', 'downloadClient': 'qbit', 'downloadClientHasPostImportCategory': False, 'indexer': 'Nyaa.si (Prowlarr)', 'outputPath': '/data/torrents/tv-sonarr/[New-raws] Boku no Hero Academia S7 - 09 [1080p] [AMZN].mkv', 'episodeHasFile': True, 'id': 1135504527}

Specifically these particular info are relevant:

'status': 'completed', 'trackedDownloadStatus': 'warning', 'trackedDownloadState': 'importBlocked', 'statusMessages': [{'title': 'One or more episodes expected in this release were not imported or missing from the release'

You can see that the first 3 correspond with the conditions I mentioned above, so the script should fire here. Thus it's the status message that doesn't kick in.

You can simply add in your docker-compose config the above status message, and you should be good.

Whether adding it as default or not: I would not add it. Reason: I don't know whether the blocked-status gets added when sonarr tries to import a particular episode, and if it can't, immediately flags it, or whether it does so after having importet all episode that it can import. Why does this matter? If it gets flagged immediately, decluttarr may remove the queue item eventhough there are still healthy episodes pending import. If you have a way to confirm how it works, we can revisit adding it as a default.

ManiMatter commented 1 month ago

can this be closed?

ManiMatter commented 1 month ago

Considered closed.