From 3d2070e106ce7d89424048401188d9c446d3c30f Mon Sep 17 00:00:00 2001 From: Labrys of Knossos Date: Sat, 19 Jan 2019 12:43:02 -0500 Subject: [PATCH] Refactor utility location configuration --- core/__init__.py | 69 +++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 36 deletions(-) diff --git a/core/__init__.py b/core/__init__.py index d6e61db1..2213276e 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -934,48 +934,13 @@ def configure_sections(section): CATEGORIES = list(set(CATEGORIES)) -def initialize(section=None): +def configure_utility_locations(): global SHOWEXTRACT - global CATEGORIES - global SECTIONS global SEVENZIP - global __INITIALIZED__ - global USER_DELAY - global SYS_ENCODING global FFMPEG global FFPROBE - global TORRENT_CLASS - global PASSWORDS_FILE global PAR2CMD - if __INITIALIZED__: - return False - - configure_logging() - configure_process() - configure_locale() - - # init logging - logger.ntm_log_instance.init_logging() - - configure_migration() - configure_logging_part_2() - - # initialize the main SB database - main_db.upgrade_database(main_db.DBConnection(), databases.InitialSchema) - - configure_general() - configure_updates() - configure_wake_on_lan() - configure_nzbs() - configure_torrents() - configure_remote_paths() - configure_plex() - configure_niceness() - configure_containers() - configure_transcoder() - configure_passwords_file() - # Setup FFMPEG, FFPROBE and SEVENZIP locations if platform.system() == 'Windows': FFMPEG = os.path.join(FFMPEG_PATH, 'ffmpeg.exe') @@ -1064,6 +1029,38 @@ def initialize(section=None): logger.warning('Failed to locate ffprobe. Video corruption detection disabled!') logger.warning('Install ffmpeg with x264 support to enable this feature ...') + +def initialize(section=None): + global __INITIALIZED__ + + if __INITIALIZED__: + return False + + configure_logging() + configure_process() + configure_locale() + + # init logging + logger.ntm_log_instance.init_logging() + + configure_migration() + configure_logging_part_2() + + # initialize the main SB database + main_db.upgrade_database(main_db.DBConnection(), databases.InitialSchema) + + configure_general() + configure_updates() + configure_wake_on_lan() + configure_nzbs() + configure_torrents() + configure_remote_paths() + configure_plex() + configure_niceness() + configure_containers() + configure_transcoder() + configure_passwords_file() + configure_utility_locations() configure_sections(section) configure_torrent_class()