|
|
@ -46,14 +46,14 @@ def ConfigSectionMap(section):
|
|
|
|
def get_config_value(env_key, config_key, config_section):
|
|
|
|
def get_config_value(env_key, config_key, config_section):
|
|
|
|
if is_in_docker:
|
|
|
|
if is_in_docker:
|
|
|
|
value = os.environ.get(env_key)
|
|
|
|
value = os.environ.get(env_key)
|
|
|
|
if value is not None:
|
|
|
|
if value is not None: # only return if given value else try config file
|
|
|
|
return value
|
|
|
|
return value
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
_config = ConfigSectionMap(config_section)
|
|
|
|
_config = ConfigSectionMap(config_section)
|
|
|
|
return _config.get(config_key)
|
|
|
|
return _config.get(config_key)
|
|
|
|
except configparser.NoSectionError:
|
|
|
|
except configparser.NoSectionError:
|
|
|
|
return ''
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
########################################################################################################################
|
|
|
|
########################################################################################################################
|
|
|
|
# load config file
|
|
|
|
# load config file
|
|
|
@ -73,23 +73,19 @@ config.read(settingsFilename)
|
|
|
|
radarrA_url = get_config_value('RADARR_A_URL', 'url', 'radarrA')
|
|
|
|
radarrA_url = get_config_value('RADARR_A_URL', 'url', 'radarrA')
|
|
|
|
radarrA_key = get_config_value('RADARR_A_KEY', 'key', 'radarrA')
|
|
|
|
radarrA_key = get_config_value('RADARR_A_KEY', 'key', 'radarrA')
|
|
|
|
radarrA_profile = get_config_value('RADARR_A_PROFILE', 'profile', 'radarrA')
|
|
|
|
radarrA_profile = get_config_value('RADARR_A_PROFILE', 'profile', 'radarrA')
|
|
|
|
radarrA_profile_id = get_config_value(
|
|
|
|
radarrA_profile_id = get_config_value('RADARR_A_PROFILE_ID', 'profile_id', 'radarrA')
|
|
|
|
'RADARR_A_PROFILE_ID', 'profile_id', 'radarrA')
|
|
|
|
radarrA_profile_filter = get_config_value('RADARR_A_PROFILE_FILTER', 'profile_filter', 'radarrA')
|
|
|
|
radarrA_profile_filter = get_config_value(
|
|
|
|
radarrA_quality_match = get_config_value('SONARR_A_QUALITY_MATCH', 'quality_match', 'sonarrA')
|
|
|
|
'RADARR_A_PROFILE_FILTER', 'profile_filter', 'radarrA')
|
|
|
|
radarrA_profile_filter_id = get_config_value('RADARR_A_PROFILE_FILTER_ID', 'profile_filter_id', 'radarrA')
|
|
|
|
radarrA_profile_filter_id = get_config_value(
|
|
|
|
|
|
|
|
'RADARR_A_PROFILE_FILTER_ID', 'profile_filter_id', 'radarrA')
|
|
|
|
|
|
|
|
radarrA_path = get_config_value('RADARR_A_PATH', 'path', 'radarrA')
|
|
|
|
radarrA_path = get_config_value('RADARR_A_PATH', 'path', 'radarrA')
|
|
|
|
|
|
|
|
|
|
|
|
radarrB_url = get_config_value('RADARR_B_URL', 'url', 'radarrB')
|
|
|
|
radarrB_url = get_config_value('RADARR_B_URL', 'url', 'radarrB')
|
|
|
|
radarrB_key = get_config_value('RADARR_B_KEY', 'key', 'radarrB')
|
|
|
|
radarrB_key = get_config_value('RADARR_B_KEY', 'key', 'radarrB')
|
|
|
|
radarrB_profile = get_config_value('RADARR_B_PROFILE', 'profile', 'radarrB')
|
|
|
|
radarrB_profile = get_config_value('RADARR_B_PROFILE', 'profile', 'radarrB')
|
|
|
|
radarrB_profile_id = get_config_value(
|
|
|
|
radarrB_profile_id = get_config_value('RADARR_B_PROFILE_ID', 'profile_id', 'radarrB')
|
|
|
|
'RADARR_B_PROFILE_ID', 'profile_id', 'radarrB')
|
|
|
|
radarrB_profile_filter = get_config_value('RADARR_B_PROFILE_FILTER', 'profile_filter', 'radarrB')
|
|
|
|
radarrB_profile_filter = get_config_value(
|
|
|
|
radarrB_profile_filter_id = get_config_value('RADARR_B_PROFILE_FILTER_ID', 'profile_filter_id', 'radarrB')
|
|
|
|
'RADARR_B_PROFILE_FILTER', 'profile_filter', 'radarrB')
|
|
|
|
radarrB_quality_match = get_config_value('RADARR_B_QUALITY_MATCH', 'quality_match', 'radarrB')
|
|
|
|
radarrB_profile_filter_id = get_config_value(
|
|
|
|
|
|
|
|
'RADARR_B_PROFILE_FILTER_ID', 'profile_filter_id', 'radarrB')
|
|
|
|
|
|
|
|
radarrB_path = get_config_value('RADARR_B_PATH', 'path', 'radarrB')
|
|
|
|
radarrB_path = get_config_value('RADARR_B_PATH', 'path', 'radarrB')
|
|
|
|
|
|
|
|
|
|
|
|
# get config settings from ENV or config files for Sonarr
|
|
|
|
# get config settings from ENV or config files for Sonarr
|
|
|
@ -97,77 +93,70 @@ sonarrA_url = get_config_value('SONARR_A_URL', 'url', 'sonarrA')
|
|
|
|
sonarrA_key = get_config_value('SONARR_A_KEY', 'key', 'sonarrA')
|
|
|
|
sonarrA_key = get_config_value('SONARR_A_KEY', 'key', 'sonarrA')
|
|
|
|
sonarrA_path = get_config_value('SONARR_A_PATH', 'path', 'sonarrA')
|
|
|
|
sonarrA_path = get_config_value('SONARR_A_PATH', 'path', 'sonarrA')
|
|
|
|
sonarrA_profile = get_config_value('SONARR_A_PROFILE', 'profile', 'sonarrA')
|
|
|
|
sonarrA_profile = get_config_value('SONARR_A_PROFILE', 'profile', 'sonarrA')
|
|
|
|
sonarrA_profile_id = get_config_value(
|
|
|
|
sonarrA_profile_id = get_config_value('SONARR_A_PROFILE_ID', 'profile_id', 'sonarrA')
|
|
|
|
'SONARR_A_PROFILE_ID', 'profile_id', 'sonarrA')
|
|
|
|
sonarrA_profile_filter = get_config_value('SONARR_A_PROFILE_FILTER', 'profile_filter', 'sonarrA')
|
|
|
|
sonarrA_profile_filter = get_config_value(
|
|
|
|
sonarrA_profile_filter_id = get_config_value('SONARR_A_PROFILE_FILTER_ID', 'profile_filter_id', 'sonarrA')
|
|
|
|
'SONARR_A_PROFILE_FILTER', 'profile_filter', 'sonarrA')
|
|
|
|
sonarrA_quality_match = get_config_value('SONARR_A_QUALITY_MATCH', 'quality_match', 'sonarrA')
|
|
|
|
sonarrA_profile_filter_id = get_config_value(
|
|
|
|
|
|
|
|
'SONARR_A_PROFILE_FILTER_ID', 'profile_filter_id', 'sonarrA')
|
|
|
|
|
|
|
|
sonarrA_language = get_config_value('SONARR_A_LANGUAGE', 'language', 'sonarrA')
|
|
|
|
sonarrA_language = get_config_value('SONARR_A_LANGUAGE', 'language', 'sonarrA')
|
|
|
|
sonarrA_language_id = get_config_value(
|
|
|
|
sonarrA_language_id = get_config_value('SONARR_A_LANGUAGE_ID', 'language_id', 'sonarrA')
|
|
|
|
'SONARR_A_LANGUAGE_ID', 'language_id', 'sonarrA')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sonarrB_url = get_config_value('SONARR_B_URL', 'url', 'sonarrB')
|
|
|
|
sonarrB_url = get_config_value('SONARR_B_URL', 'url', 'sonarrB')
|
|
|
|
sonarrB_key = get_config_value('SONARR_B_KEY', 'key', 'sonarrB')
|
|
|
|
sonarrB_key = get_config_value('SONARR_B_KEY', 'key', 'sonarrB')
|
|
|
|
sonarrB_path = get_config_value('SONARR_B_PATH', 'path', 'sonarrB')
|
|
|
|
sonarrB_path = get_config_value('SONARR_B_PATH', 'path', 'sonarrB')
|
|
|
|
sonarrB_profile = get_config_value('SONARR_B_PROFILE', 'profile', 'sonarrB')
|
|
|
|
sonarrB_profile = get_config_value('SONARR_B_PROFILE', 'profile', 'sonarrB')
|
|
|
|
sonarrB_profile_id = get_config_value(
|
|
|
|
sonarrB_profile_id = get_config_value('SONARR_B_PROFILE_ID', 'profile_id', 'sonarrB')
|
|
|
|
'SONARR_B_PROFILE_ID', 'profile_id', 'sonarrB')
|
|
|
|
sonarrB_profile_filter = get_config_value('SONARR_B_PROFILE_FILTER', 'profile_filter', 'sonarrB')
|
|
|
|
sonarrB_profile_filter = get_config_value(
|
|
|
|
sonarrB_profile_filter_id = get_config_value('SONARR_B_PROFILE_FILTER_ID', 'profile_filter_id', 'sonarrB')
|
|
|
|
'SONARR_A_PROFILE_FILTER', 'profile_filter', 'sonarrB')
|
|
|
|
sonarrB_quality_match = get_config_value('SONARR_B_QUALITY_MATCH', 'quality_match', 'sonarrB')
|
|
|
|
sonarrB_profile_filter_id = get_config_value(
|
|
|
|
|
|
|
|
'SONARR_A_PROFILE_FILTER_ID', 'profile_filter_id', 'sonarrB')
|
|
|
|
|
|
|
|
sonarrB_language = get_config_value('SONARR_B_LANGUAGE', 'language', 'sonarrB')
|
|
|
|
sonarrB_language = get_config_value('SONARR_B_LANGUAGE', 'language', 'sonarrB')
|
|
|
|
sonarrB_language_id = get_config_value(
|
|
|
|
sonarrB_language_id = get_config_value('SONARR_B_LANGUAGE_ID', 'language_id', 'sonarrB')
|
|
|
|
'SONARR_B_LANGUAGE_ID', 'language_id', 'sonarrB')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# get config settings from ENV or config files for Lidarr
|
|
|
|
# get config settings from ENV or config files for Lidarr
|
|
|
|
lidarrA_url = get_config_value('LIDARR_A_URL', 'url', 'lidarrA')
|
|
|
|
lidarrA_url = get_config_value('LIDARR_A_URL', 'url', 'lidarrA')
|
|
|
|
lidarrA_key = get_config_value('LIDARR_A_KEY', 'key', 'lidarrA')
|
|
|
|
lidarrA_key = get_config_value('LIDARR_A_KEY', 'key', 'lidarrA')
|
|
|
|
lidarrA_profile = get_config_value('LIDARR_A_PROFILE', 'profile', 'lidarrA')
|
|
|
|
lidarrA_profile = get_config_value('LIDARR_A_PROFILE', 'profile', 'lidarrA')
|
|
|
|
lidarrA_profile_id = get_config_value(
|
|
|
|
lidarrA_profile_id = get_config_value('LIDARR_A_PROFILE_ID', 'profile_id', 'lidarrA')
|
|
|
|
'LIDARR_A_PROFILE_ID', 'profile_id', 'lidarrA')
|
|
|
|
lidarrA_profile_filter = get_config_value('LIDARR_A_PROFILE_FILTER', 'profile_filter', 'lidarrA')
|
|
|
|
lidarrA_profile_filter = get_config_value(
|
|
|
|
lidarrA_profile_filter_id = get_config_value('LIDARR_A_PROFILE_FILTER_ID', 'profile_filter_id', 'lidarrA')
|
|
|
|
'LIDARR_A_PROFILE_FILTER', 'profile_filter', 'lidarrA')
|
|
|
|
lidarrA_quality_match = get_config_value('LIDARR_A_QUALITY_MATCH', 'quality_match', 'lidarrA')
|
|
|
|
lidarrA_profile_filter_id = get_config_value(
|
|
|
|
|
|
|
|
'LIDARR_A_PROFILE_FILTER_ID', 'profile_filter_id', 'lidarrA')
|
|
|
|
|
|
|
|
lidarrA_path = get_config_value('LIDARR_A_PATH', 'path', 'lidarrA')
|
|
|
|
lidarrA_path = get_config_value('LIDARR_A_PATH', 'path', 'lidarrA')
|
|
|
|
|
|
|
|
|
|
|
|
lidarrB_url = get_config_value('LIDARR_B_URL', 'url', 'lidarrB')
|
|
|
|
lidarrB_url = get_config_value('LIDARR_B_URL', 'url', 'lidarrB')
|
|
|
|
lidarrB_key = get_config_value('LIDARR_B_KEY', 'key', 'lidarrB')
|
|
|
|
lidarrB_key = get_config_value('LIDARR_B_KEY', 'key', 'lidarrB')
|
|
|
|
lidarrB_profile = get_config_value('LIDARR_B_PROFILE', 'profile', 'lidarrB')
|
|
|
|
lidarrB_profile = get_config_value('LIDARR_B_PROFILE', 'profile', 'lidarrB')
|
|
|
|
lidarrB_profile_id = get_config_value(
|
|
|
|
lidarrB_profile_id = get_config_value('LIDARR_B_PROFILE_ID', 'profile_id', 'lidarrB')
|
|
|
|
'LIDARR_B_PROFILE_ID', 'profile_id', 'lidarrB')
|
|
|
|
lidarrB_profile_filter = get_config_value('LIDARR_B_PROFILE_FILTER', 'profile_filter', 'lidarrB')
|
|
|
|
lidarrB_profile_filter = get_config_value(
|
|
|
|
lidarrB_profile_filter_id = get_config_value('LIDARR_B_PROFILE_FILTER_ID', 'profile_filter_id', 'lidarrB')
|
|
|
|
'LIDARR_A_PROFILE_FILTER', 'profile_filter', 'lidarrB')
|
|
|
|
lidarrB_quality_match = get_config_value('LIDARR_B_QUALITY_MATCH', 'quality_match', 'lidarrB')
|
|
|
|
lidarrB_profile_filter_id = get_config_value(
|
|
|
|
|
|
|
|
'LIDARR_A_PROFILE_FILTER_ID', 'profile_filter_id', 'lidarrB')
|
|
|
|
|
|
|
|
lidarrB_path = get_config_value('LIDARR_B_PATH', 'path', 'lidarrB')
|
|
|
|
lidarrB_path = get_config_value('LIDARR_B_PATH', 'path', 'lidarrB')
|
|
|
|
|
|
|
|
|
|
|
|
# get general conf options
|
|
|
|
|
|
|
|
sync_bidirectionally = get_config_value(
|
|
|
|
# set to search if config not set
|
|
|
|
'SYNCARR_BIDIRECTIONAL_SYNC', 'bidirectional', 'general')
|
|
|
|
sync_bidirectionally = get_config_value('SYNCARR_BIDIRECTIONAL_SYNC', 'bidirectional', 'general')
|
|
|
|
if sync_bidirectionally is not None:
|
|
|
|
if sync_bidirectionally is not None:
|
|
|
|
|
|
|
|
try:
|
|
|
|
sync_bidirectionally = int(sync_bidirectionally)
|
|
|
|
sync_bidirectionally = int(sync_bidirectionally)
|
|
|
|
# set to search if config not set
|
|
|
|
except ValueError:
|
|
|
|
if sync_bidirectionally is None:
|
|
|
|
sync_bidirectionally = 0
|
|
|
|
|
|
|
|
else:
|
|
|
|
sync_bidirectionally = 0
|
|
|
|
sync_bidirectionally = 0
|
|
|
|
|
|
|
|
|
|
|
|
auto_search = get_config_value(
|
|
|
|
# set to search if config not set
|
|
|
|
'SYNCARR_AUTO_SEARCH', 'auto_search', 'general')
|
|
|
|
auto_search = get_config_value('SYNCARR_AUTO_SEARCH', 'auto_search', 'general')
|
|
|
|
if auto_search is not None:
|
|
|
|
if auto_search is not None:
|
|
|
|
|
|
|
|
try:
|
|
|
|
auto_search = int(auto_search)
|
|
|
|
auto_search = int(auto_search)
|
|
|
|
# set to search if config not set
|
|
|
|
except ValueError:
|
|
|
|
if auto_search is None:
|
|
|
|
auto_search = 0
|
|
|
|
|
|
|
|
else:
|
|
|
|
auto_search = 1
|
|
|
|
auto_search = 1
|
|
|
|
|
|
|
|
|
|
|
|
monitor_new_content = get_config_value(
|
|
|
|
# set to monitor if config not set
|
|
|
|
'SYNCARR_MONITOR_NEW_CONTENT', 'monitor_new_content', 'general')
|
|
|
|
monitor_new_content = get_config_value('SYNCARR_MONITOR_NEW_CONTENT', 'monitor_new_content', 'general')
|
|
|
|
if monitor_new_content is not None:
|
|
|
|
if monitor_new_content is not None:
|
|
|
|
monitor_new_content = int(monitor_new_content)
|
|
|
|
monitor_new_content = int(monitor_new_content)
|
|
|
|
# set to monitor if config not set
|
|
|
|
else:
|
|
|
|
if monitor_new_content is None:
|
|
|
|
|
|
|
|
monitor_new_content = 1
|
|
|
|
monitor_new_content = 1
|
|
|
|
|
|
|
|
|
|
|
|
########################################################################################################################
|
|
|
|
########################################################################################################################
|
|
|
@ -176,13 +165,15 @@ if monitor_new_content is None:
|
|
|
|
# CRITICAL 50, ERROR 40, WARNING 3, INFO 20, DEBUG 10, NOTSET 0
|
|
|
|
# CRITICAL 50, ERROR 40, WARNING 3, INFO 20, DEBUG 10, NOTSET 0
|
|
|
|
log_level = get_config_value('LOG_LEVEL', 'log_level', 'general') or 20
|
|
|
|
log_level = get_config_value('LOG_LEVEL', 'log_level', 'general') or 20
|
|
|
|
if log_level:
|
|
|
|
if log_level:
|
|
|
|
|
|
|
|
try:
|
|
|
|
log_level = int(log_level)
|
|
|
|
log_level = int(log_level)
|
|
|
|
|
|
|
|
except ValueError:
|
|
|
|
|
|
|
|
log_level = 20
|
|
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger()
|
|
|
|
logger = logging.getLogger()
|
|
|
|
logger.setLevel(log_level)
|
|
|
|
logger.setLevel(log_level)
|
|
|
|
|
|
|
|
|
|
|
|
logFormatter = logging.Formatter(
|
|
|
|
logFormatter = logging.Formatter("%(asctime)s [%(threadName)-12.12s] [%(levelname)-5.5s] %(message)s")
|
|
|
|
"%(asctime)s [%(threadName)-12.12s] [%(levelname)-5.5s] %(message)s")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# log to txt file
|
|
|
|
# log to txt file
|
|
|
|
fileHandler = logging.FileHandler("./output.txt")
|
|
|
|
fileHandler = logging.FileHandler("./output.txt")
|
|
|
@ -212,8 +203,7 @@ if (
|
|
|
|
(radarrB_url and lidarrA_url) or
|
|
|
|
(radarrB_url and lidarrA_url) or
|
|
|
|
(radarrB_url and lidarrB_url)
|
|
|
|
(radarrB_url and lidarrB_url)
|
|
|
|
):
|
|
|
|
):
|
|
|
|
logger.error(
|
|
|
|
logger.error('cannot have more than one *arr type profile(s) setup at the same time')
|
|
|
|
'cannot have more than one *arr type profile(s) setup at the same time')
|
|
|
|
|
|
|
|
sys.exit(0)
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
|
|
########################################################################################################################
|
|
|
|
########################################################################################################################
|
|
|
@ -226,6 +216,7 @@ instanceA_profile_id = ''
|
|
|
|
instanceA_profile_filter = ''
|
|
|
|
instanceA_profile_filter = ''
|
|
|
|
instanceA_language_id = ''
|
|
|
|
instanceA_language_id = ''
|
|
|
|
instanceA_language = ''
|
|
|
|
instanceA_language = ''
|
|
|
|
|
|
|
|
instanceA_quality_match = ''
|
|
|
|
|
|
|
|
|
|
|
|
instanceB_url = ''
|
|
|
|
instanceB_url = ''
|
|
|
|
instanceB_key = ''
|
|
|
|
instanceB_key = ''
|
|
|
@ -235,6 +226,7 @@ instanceB_profile_id = ''
|
|
|
|
instanceB_profile_filter = ''
|
|
|
|
instanceB_profile_filter = ''
|
|
|
|
instanceB_language_id = ''
|
|
|
|
instanceB_language_id = ''
|
|
|
|
instanceB_language = ''
|
|
|
|
instanceB_language = ''
|
|
|
|
|
|
|
|
instanceB_quality_match = ''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
api_version = '' # we are going to detect what API version we are on
|
|
|
|
api_version = '' # we are going to detect what API version we are on
|
|
|
@ -434,8 +426,7 @@ if not content_id_key:
|
|
|
|
if sync_bidirectionally:
|
|
|
|
if sync_bidirectionally:
|
|
|
|
assert instanceA_path
|
|
|
|
assert instanceA_path
|
|
|
|
if not instanceB_profile_id and not instanceB_profile:
|
|
|
|
if not instanceB_profile_id and not instanceB_profile:
|
|
|
|
logger.error(
|
|
|
|
logger.error('profile_id or profile is required for *arr instance A if sync bidirectionally is enabled')
|
|
|
|
'profile_id or profile is required for *arr instance A if sync bidirectionally is enabled')
|
|
|
|
|
|
|
|
sys.exit(0)
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|