fix path imports

pull/42/head 1.9.2
Junkbite 4 years ago
parent 18963f3523
commit 181748b0c1

@ -61,9 +61,9 @@ def get_config_value(env_key, config_key, config_section):
BASE_CONFIG = 'config.conf' BASE_CONFIG = 'config.conf'
if DEV: if DEV:
settingsFilename = os.path.join(os.getcwd(), 'dev-{}'.format(BASE_CONFIG)) settingsFilename = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'dev-{}'.format(BASE_CONFIG))
else: else:
settingsFilename = os.path.join(os.getcwd(), BASE_CONFIG) settingsFilename = os.path.join(os.path.abspath(os.path.dirname(__file__)), BASE_CONFIG)
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read(settingsFilename) config.read(settingsFilename)
@ -376,6 +376,7 @@ elif sonarrA_url and sonarrB_url:
######################################################################################################################## ########################################################################################################################
# path generators # path generators
def get_path(instance_url, api_path, key, changed_api_version=False): def get_path(instance_url, api_path, key, changed_api_version=False):
global api_version, api_profile_path global api_version, api_profile_path
@ -400,26 +401,31 @@ def get_path(instance_url, api_path, key, changed_api_version=False):
url = f"{instance_url}/api/{api_version}{api_path}?apikey={key}" url = f"{instance_url}/api/{api_version}{api_path}?apikey={key}"
return url return url
def get_status_path(instance_url, key, changed_api_version): def get_status_path(instance_url, key, changed_api_version):
url = get_path(instance_url, api_status_path, key, changed_api_version) url = get_path(instance_url, api_status_path, key, changed_api_version)
logger.debug('get_status_path: {}'.format(url)) logger.debug('get_status_path: {}'.format(url))
return url return url
def get_content_path(instance_url, key): def get_content_path(instance_url, key):
url = get_path(instance_url, api_content_path, key) url = get_path(instance_url, api_content_path, key)
logger.debug('get_content_path: {}'.format(url)) logger.debug('get_content_path: {}'.format(url))
return url return url
def get_language_path(instance_url, key): def get_language_path(instance_url, key):
url = get_path(instance_url, api_language_path, key) url = get_path(instance_url, api_language_path, key)
logger.debug('get_language_path: {}'.format(url)) logger.debug('get_language_path: {}'.format(url))
return url return url
def get_profile_path(instance_url, key): def get_profile_path(instance_url, key):
url = get_path(instance_url, api_profile_path, key) url = get_path(instance_url, api_profile_path, key)
logger.debug('get_profile_path: {}'.format(url)) logger.debug('get_profile_path: {}'.format(url))
return url return url
def get_tag_path(instance_url, key): def get_tag_path(instance_url, key):
url = get_path(instance_url, api_tag_path, key) url = get_path(instance_url, api_tag_path, key)
logger.debug('get_tag_path: {}'.format(url)) logger.debug('get_tag_path: {}'.format(url))
@ -428,6 +434,7 @@ def get_tag_path(instance_url, key):
######################################################################################################################## ########################################################################################################################
# check for required fields # check for required fields
logger.debug({ logger.debug({
'instanceA_url': instanceA_url, 'instanceA_url': instanceA_url,
'instanceA_key': instanceA_key, 'instanceA_key': instanceA_key,

@ -94,6 +94,7 @@ def get_new_content_payload(content, instance_path, instance_profile_id, instanc
logger.debug(payload) logger.debug(payload)
return payload return payload
def get_quality_profiles(instance_session, instance_url, instance_key): def get_quality_profiles(instance_session, instance_url, instance_key):
instance_profile_url = get_profile_path(instance_url, instance_key) instance_profile_url = get_profile_path(instance_url, instance_key)
profiles_response = instance_session.get(instance_profile_url) profiles_response = instance_session.get(instance_profile_url)
@ -445,6 +446,7 @@ def sync_content():
######################################################################################################################## ########################################################################################################################
if is_in_docker: if is_in_docker:
logger.info('syncing every {} seconds'.format(instance_sync_interval_seconds)) logger.info('syncing every {} seconds'.format(instance_sync_interval_seconds))

Loading…
Cancel
Save