Describe the bug
nzbToRadarr fails with "No scan id was returned due to: list indices must be integers or slices, not str" when processing response from Radarr API call
Technical Specs
Fedora 39
Python 3.11
nzbget
radarr
Expected behavior
Nzbget should be to parse Radarr Response
Log
Please provide an extract, or full debug log that indicates the issue.
2024-02-25 15:26:18 DEBUG ::RADARR: Opening URL: http://localhost:7878/api/v3/command with PARAMS: {'name': 'DownloadedMoviesScan', 'path': '/home/kjh/Downloads/couchpotato/Mean.Girls.2024.1080p.WEBRip.x265.10bit.5.1-LAMA', 'downloadClientId': '46099cfb9c83402b966eeee938436742', 'importMode': 'Copy'}
2024-02-25 15:26:18 POSTPROCESS::RADARR: Starting DownloadedMoviesScan scan for Mean.Girls.2024.1080p.WEBRip.x265.10bit.5.1-LAMA
2024-02-25 15:26:18 WARNING ::RADARR: kjh: result = [{'name': 'RefreshMonitoredDownloads', 'commandName': 'Refresh Monitored Downloads', 'message': <deleted for brevity>
2024-02-25 15:26:18 WARNING ::RADARR: kjh: type(result) = <class 'list'>
2024-02-25 15:26:18 WARNING ::RADARR: No scan id was returned due to: list indices must be integers or slices, not str
2024-02-25 15:26:18 POSTPROCESS::RADARR: Checking for status change, please stand by ...
2024-02-25 15:27:18 POSTPROCESS::RADARR: Checking for status change, please stand by ...
2024-02-25 15:28:18 POSTPROCESS::RADARR: Checking for status change, please stand by ...
2024-02-25 15:29:18 POSTPROCESS::RADARR: Checking for status change, please stand by ...
2024-02-25 15:30:18 POSTPROCESS::RADARR: Checking for status change, please stand by ...
2024-02-25 15:31:18 POSTPROCESS::RADARR: Checking for status change, please stand by ...
2024-02-25 15:32:18 DEBUG ::RADARR: The Scan command did not return status completed, but complete Download Handling is enabled. Passing back to Radarr.
2024-02-25 15:32:18 INFO ::MAIN: The /home/kjh/nzbget/scripts/nzbToMedia/nzbToRadarr.py script completed successfully.
core/auto_process/movies.py fails when parsing the response to a Radarr API call. I don't know when this changed, but the code is expecting the response to be an object but what's actually in "result" is an array of objects.
I created the following fix that detects if result is a list and if so, alters the accessor.
$ git diff 558970c212343bdc54a26f61f8cb317d27a26c3e 94f9b9014bbe3365a76f7e8334980193265fc695 core/auto_process/movies.py
diff --git a/core/auto_process/movies.py b/core/auto_process/movies.py
index bfee550a..31bc619f 100644
--- a/core/auto_process/movies.py
+++ b/core/auto_process/movies.py
@@ -260,7 +260,11 @@ def process(section, dir_name, input_name=None, status=0, client_agent='manual',
)
elif section == 'Radarr':
try:
- scan_id = int(result['id'])
+ if isinstance(result, list):
+ scan_id = int(result[0]['id'])
+ else:
+ scan_id = int(result['id'])
+
logger.debug('Scan started with id: {0}'.format(scan_id), section)
except Exception as e:
logger.warning('No scan id was returned due to: {0}'.format(e), section)
Describe the bug nzbToRadarr fails with "No scan id was returned due to: list indices must be integers or slices, not str" when processing response from Radarr API call Technical Specs
Expected behavior Nzbget should be to parse Radarr Response
Log Please provide an extract, or full debug log that indicates the issue.
core/auto_process/movies.py fails when parsing the response to a Radarr API call. I don't know when this changed, but the code is expecting the response to be an object but what's actually in "result" is an array of objects.
I created the following fix that detects if result is a list and if so, alters the accessor.