Improvement: Add error message to logs for failed imports (info-level)

This commit is contained in:
Benjamin Harder
2024-07-25 21:34:53 +02:00
parent d9c49693de
commit dd278b2b14
2 changed files with 29 additions and 7 deletions

View File

@@ -78,9 +78,10 @@ async def execute_checks(settingsDict, affectedItems, failType, BASE_URL, API_KE
for affectedItem in affectedItems:
# Checks whether when removing the queue item from the *arr app the torrent should be kept
removeFromClient = True
if 'keepTorrentForPrivateTrackers' in extraParameters:
if extraParameters.get('keepTorrentForPrivateTrackers', False):
if settingsDict['IGNORE_PRIVATE_TRACKERS'] and affectedItem['downloadId'] in privateDowloadIDs:
removeFromClient = False
# Removes the queue item
await remove_download(settingsDict, BASE_URL, API_KEY, affectedItem, failType, addToBlocklist, deleted_downloads, removeFromClient)
# Exit Logs
@@ -133,10 +134,19 @@ async def remove_download(settingsDict, BASE_URL, API_KEY, affectedItem, failTyp
# Removes downloads and creates log entry
logger.debug('remove_download/deleted_downloads.dict IN: %s', str(deleted_downloads.dict))
if affectedItem['downloadId'] not in deleted_downloads.dict:
# "schizophrenic" removal:
# Yes, the failed imports are removed from the -arr apps (so the removal kicks still in)
# But in the torrent client they are kept
if removeFromClient:
logger.info('>>> Removing %s download: %s', failType, affectedItem['title'])
else:
logger.info('>>> Removing %s download (without removing torrent): %s', failType, affectedItem['title'])
logger.info('>>> Removing %s download (without removing from torrent client): %s', failType, affectedItem['title'])
# Print out detailed removal messages (if any were added in the jobs)
if removal_messages in affectedItem:
for removal_message in affectedItem.removal_messages:
logger.info(removal_message)
if not settingsDict['TEST_RUN']:
await rest_delete(f'{BASE_URL}/queue/{affectedItem["id"]}', API_KEY, {'removeFromClient': removeFromClient, 'blocklist': addToBlocklist})
deleted_downloads.dict.append(affectedItem['downloadId'])