diff --git a/config/config.conf-Example b/config/config.conf-Example index 84ef35d..b0afb55 100644 --- a/config/config.conf-Example +++ b/config/config.conf-Example @@ -33,7 +33,11 @@ LIDARR_KEY = $LIDARR_API_KEY READARR_URL = http://lidarr:8787 READARR_KEY = $READARR_API_KEY +[whisparr] +WHISPARR_URL = http://whisparr:6969 +WHISPARR_KEY = $WHISPARR_API_KEY + [qbittorrent] QBITTORRENT_URL = http://qbittorrent:8080 QBITTORRENT_USERNAME = Your name (or empty) -QBITTORRENT_PASSWORD = Your password (or empty) \ No newline at end of file +QBITTORRENT_PASSWORD = Your password (or empty) diff --git a/config/config.py b/config/config.py index 550322e..2240c23 100644 --- a/config/config.py +++ b/config/config.py @@ -117,6 +117,11 @@ READARR_URL = get_config_value('READARR_URL', READARR_KEY = None if READARR_URL == None else \ get_config_value('READARR_KEY', 'readarr', True, str) +# Whisparr +WHISPARR_URL = get_config_value('WHISPARR_URL', 'whisparr', False, str) +WHISPARR_KEY = None if WHISPARR_URL == None else \ + get_config_value('WHISPARR_KEY', 'whisparr', True, str) + # qBittorrent QBITTORRENT_URL = get_config_value('QBITTORRENT_URL', 'qbittorrent', False, str, '') QBITTORRENT_USERNAME = get_config_value('QBITTORRENT_USERNAME', 'qbittorrent', False, str, '') @@ -124,8 +129,8 @@ QBITTORRENT_PASSWORD = get_config_value('QBITTORRENT_PASSWORD', ######################################################################################################################## ########### Validate settings -if not (RADARR_URL or SONARR_URL or LIDARR_URL or READARR_URL): - print(f'[ ERROR ]: No Radarr/Sonarr/Lidarr/Readarr URLs specified (nothing to monitor)') +if not (RADARR_URL or SONARR_URL or LIDARR_URL or READARR_URL or WHISPARR_URL): + print(f'[ ERROR ]: No Radarr/Sonarr/Lidarr/Readarr/Whisparr URLs specified (nothing to monitor)') sys.exit(0) ########### Enrich setting variables @@ -133,6 +138,7 @@ if RADARR_URL: RADARR_URL += '/api/v3' if SONARR_URL: SONARR_URL += '/api/v3' if LIDARR_URL: LIDARR_URL += '/api/v1' if READARR_URL: READARR_URL += '/api/v1' +if WHISPARR_URL: WHISPARR_URL += '/api/v3' if QBITTORRENT_URL: QBITTORRENT_URL += '/api/v2' ########### Add Variables to Dictionary diff --git a/main.py b/main.py index 4dee289..5bc1a59 100644 --- a/main.py +++ b/main.py @@ -57,7 +57,7 @@ async def getProtectedAndPrivateFromQbit(settingsDict): # Main function async def main(settingsDict): # Adds to settings Dict the instances that are actually configures - arrApplications = ['RADARR', 'SONARR', 'LIDARR', 'READARR'] + arrApplications = ['RADARR', 'SONARR', 'LIDARR', 'READARR', 'WHISPARR'] settingsDict['INSTANCES'] = [] for arrApplication in arrApplications: if settingsDict[arrApplication + '_URL']: @@ -82,6 +82,7 @@ async def main(settingsDict): settingsDict['SONARR_MIN_VERSION'] = '4.0.1.1131' settingsDict['LIDARR_MIN_VERSION'] = None settingsDict['READARR_MIN_VERSION'] = None + settingsDict['WHISPARR_MIN_VERSION'] = '2.0.0.548' settingsDict['QBITTORRENT_MIN_VERSION'] = '4.3.0' settingsDict = await instanceChecks(settingsDict) diff --git a/src/decluttarr.py b/src/decluttarr.py index 771d1a6..3c593db 100644 --- a/src/decluttarr.py +++ b/src/decluttarr.py @@ -39,7 +39,12 @@ async def queueCleaner(settingsDict, arr_type, defective_tracker, download_sizes BASE_URL = settingsDict['READARR_URL'] API_KEY = settingsDict['READARR_KEY'] NAME = settingsDict['READARR_NAME'] - full_queue_param = 'includeUnknownAuthorItems' + full_queue_param = 'includeUnknownAuthorItems' + elif arr_type == 'WHISPARR': + BASE_URL = settingsDict['WHISPARR_URL'] + API_KEY = settingsDict['WHISPARR_KEY'] + NAME = settingsDict['WHISPARR_NAME'] + full_queue_param = 'includeUnknownAuthorItems' else: logger.error('Unknown arr_type specified, exiting: %s', str(arr_type)) sys.exit() diff --git a/src/jobs/remove_unmonitored.py b/src/jobs/remove_unmonitored.py index c641aa1..f6f5023 100644 --- a/src/jobs/remove_unmonitored.py +++ b/src/jobs/remove_unmonitored.py @@ -21,7 +21,9 @@ async def remove_unmonitored(settingsDict, BASE_URL, API_KEY, NAME, deleted_down elif arr_type == 'LIDARR': isMonitored = (await rest_get(f'{BASE_URL}/album/{str(queueItem["albumId"])}', API_KEY))['monitored'] elif arr_type == 'READARR': - isMonitored = (await rest_get(f'{BASE_URL}/book/{str(queueItem["bookId"])}', API_KEY))['monitored'] + isMonitored = (await rest_get(f'{BASE_URL}/book/{str(queueItem["bookId"])}', API_KEY))['monitored'] + elif arr_type == 'WHISPARR': + isMonitored = (await rest_get(f'{BASE_URL}/episode/{str(queueItem["episodeId"])}', API_KEY))['monitored'] if isMonitored: monitoredDownloadIDs.append(queueItem['downloadId'])