Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Whisparr support #115

Merged
merged 5 commits into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion config/config.conf-Example
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,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)
QBITTORRENT_PASSWORD = Your password (or empty)
11 changes: 9 additions & 2 deletions config/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,29 @@
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, '')
QBITTORRENT_PASSWORD = get_config_value('QBITTORRENT_PASSWORD', 'qbittorrent', False, str, '')

########################################################################################################################
########### 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)')
exit()

########### Enrich setting variables
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
Expand Down
3 changes: 2 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']:
Expand Down Expand Up @@ -85,6 +85,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)

Expand Down
9 changes: 7 additions & 2 deletions src/decluttarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 'includeUnknownSeriesItems'
else:
logger.error('Unknown arr_type specified, exiting: %s', str(arr_type))
sys.exit()
Expand Down Expand Up @@ -86,4 +91,4 @@ async def queueCleaner(settingsDict, arr_type, defective_tracker, download_sizes
logger.verbose('>>> Queue is clean.')
except Exception as error:
errorDetails(NAME, error)
return
return
4 changes: 3 additions & 1 deletion src/jobs/remove_unmonitored.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])

Expand Down
Loading