From 5a3646c07bfbb8ea264067e63f684d0c6ac0c841 Mon Sep 17 00:00:00 2001 From: Benjamin Harder Date: Sun, 6 Oct 2024 13:39:41 +0200 Subject: [PATCH] Add check for English --- README.md | 2 +- src/utils/loadScripts.py | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 67c4095..6ce9821 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ You can find a sample docker-compose.yml in the docker folder. - When broken torrents are removed the files belonging to them are deleted - Across all removal types: A new download from another source is automatically added by radarr/sonarr/lidarr/readarr/whisparr (if available) - If you use qBittorrent and none of your torrents get removed and the verbose logs tell that all torrents are protected by the NO_STALLED_REMOVAL_QBIT_TAG even if they are not, you may be using a qBittorrent version that has problems with API calls and you may want to consider switching to a different qBit image (see https://github.com/ManiMatter/decluttarr/issues/56) -- Currently, “*Arr” apps are only supported in English. Refer to issue https://github.com/ManiMatter/decluttarr/issues/92 for more details. +- Currently, “*Arr” apps are only supported in English. Refer to issue https://github.com/ManiMatter/decluttarr/issues/132 for more details ## Getting started There's two ways to run this: diff --git a/src/utils/loadScripts.py b/src/utils/loadScripts.py index 6418bdb..8e59fb6 100644 --- a/src/utils/loadScripts.py +++ b/src/utils/loadScripts.py @@ -147,9 +147,10 @@ async def instanceChecks(settingsDict): if isinstance(error, requests.exceptions.HTTPError) and error.response.status_code == 401: logger.error ('> Have you configured %s correctly?', instance + '_KEY') + arr_status = response.json() if not error_occured: # Check if network settings are pointing to the right Arr-apps - current_app = (await rest_get(settingsDict[instance + '_URL']+'/system/status', settingsDict[instance + '_KEY']))['appName'] + current_app = arr_status['appName'] if current_app.upper() != instance: error_occured = True logger.error('!! %s Error: !!', instance.title()) @@ -157,12 +158,22 @@ async def instanceChecks(settingsDict): if not error_occured: # Check minimum version requirements are met - current_version = (await rest_get(settingsDict[instance + '_URL']+'/system/status', settingsDict[instance + '_KEY']))['version'] + current_version = arr_status['version'] if settingsDict[instance + '_MIN_VERSION']: if version.parse(current_version) < version.parse(settingsDict[instance + '_MIN_VERSION']): error_occured = True logger.error('!! %s Error: !!', instance.title()) logger.error('> Please update %s to at least version %s. Current version: %s', instance.title(), settingsDict[instance + '_MIN_VERSION'], current_version) + + if not error_occured: + # Check if language is english + uiLanguage = (await rest_get(settingsDict[instance + '_URL']+'/config/ui', settingsDict[instance + '_KEY']))['uiLanguage'] + if uiLanguage > 1: # Not English + error_occured = True + logger.error('!! %s Error: !!', instance.title()) + logger.error('> Decluttarr only works correctly if UI language is set to English (under Settings/UI in %s)', instance.title()) + logger.error('> Details: https://github.com/ManiMatter/decluttarr/issues/132)') + if not error_occured: logger.info('OK | %s', instance.title()) logger.debug('Current version of %s: %s', instance, current_version)