From 182a542bdaea4048b98faddf29b59be1b9b273ff Mon Sep 17 00:00:00 2001 From: Labrys of Knossos Date: Fri, 18 Jan 2019 23:48:41 -0500 Subject: [PATCH] Refactor QBITTORENT* --- core/__init__.py | 18 +++++++++--------- core/utils/torrents.py | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/__init__.py b/core/__init__.py index 874632b8..4acda833 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -164,10 +164,10 @@ DELUGE_PORT = None DELUGE_USER = None DELUGE_PASSWORD = None -QBITTORRENTHOST = None -QBITTORRENTPORT = None -QBITTORRENTUSR = None -QBITTORRENTPWD = None +QBITTORRENT_HOST = None +QBITTORRENT_PORT = None +QBITTORRENT_USER = None +QBITTORRENT_PASSWORD = None PLEXSSL = None PLEXHOST = None @@ -269,7 +269,7 @@ def initialize(section=None): DELETE_ORIGINAL, TORRENT_CHMOD_DIRECTORY, PASSWORDSFILE, USER_DELAY, USER_SCRIPT, USER_SCRIPT_CLEAN, USER_SCRIPT_MEDIAEXTENSIONS, \ USER_SCRIPT_PARAM, USER_SCRIPT_RUNONCE, USER_SCRIPT_SUCCESSCODES, DOWNLOADINFO, CHECK_MEDIA, SAFE_MODE, \ TORRENT_DEFAULTDIR, TORRENT_RESUME_ON_FAILURE, NZB_DEFAULTDIR, REMOTEPATHS, LOG_ENV, PID_FILE, MYAPP, ACHANNELS, ACHANNELS2, ACHANNELS3, \ - PLEXSSL, PLEXHOST, PLEXPORT, PLEXTOKEN, PLEXSEC, TORRENT_RESUME, PAR2CMD, QBITTORRENTHOST, QBITTORRENTPORT, QBITTORRENTUSR, QBITTORRENTPWD + PLEXSSL, PLEXHOST, PLEXPORT, PLEXTOKEN, PLEXSEC, TORRENT_RESUME, PAR2CMD, QBITTORRENT_HOST, QBITTORRENT_PORT, QBITTORRENT_USER, QBITTORRENT_PASSWORD if __INITIALIZED__: return False @@ -420,10 +420,10 @@ def initialize(section=None): DELUGE_USER = CFG['Torrent']['DelugeUSR'] # mysecretusr DELUGE_PASSWORD = CFG['Torrent']['DelugePWD'] # mysecretpwr - QBITTORRENTHOST = CFG['Torrent']['qBittorrenHost'] # localhost - QBITTORRENTPORT = int(CFG['Torrent']['qBittorrentPort']) # 8080 - QBITTORRENTUSR = CFG['Torrent']['qBittorrentUSR'] # mysecretusr - QBITTORRENTPWD = CFG['Torrent']['qBittorrentPWD'] # mysecretpwr + QBITTORRENT_HOST = CFG['Torrent']['qBittorrenHost'] # localhost + QBITTORRENT_PORT = int(CFG['Torrent']['qBittorrentPort']) # 8080 + QBITTORRENT_USER = CFG['Torrent']['qBittorrentUSR'] # mysecretusr + QBITTORRENT_PASSWORD = CFG['Torrent']['qBittorrentPWD'] # mysecretpwr REMOTEPATHS = CFG['Network']['mount_points'] or [] if REMOTEPATHS: diff --git a/core/utils/torrents.py b/core/utils/torrents.py index 867df7ee..c20ba97f 100644 --- a/core/utils/torrents.py +++ b/core/utils/torrents.py @@ -41,9 +41,9 @@ def create_torrent_class(client_agent): if client_agent == 'qbittorrent': try: - logger.debug('Connecting to {0}: http://{1}:{2}'.format(client_agent, core.QBITTORRENTHOST, core.QBITTORRENTPORT)) - tc = qBittorrentClient('http://{0}:{1}/'.format(core.QBITTORRENTHOST, core.QBITTORRENTPORT)) - tc.login(core.QBITTORRENTUSR, core.QBITTORRENTPWD) + logger.debug('Connecting to {0}: http://{1}:{2}'.format(client_agent, core.QBITTORRENT_HOST, core.QBITTORRENT_PORT)) + tc = qBittorrentClient('http://{0}:{1}/'.format(core.QBITTORRENT_HOST, core.QBITTORRENT_PORT)) + tc.login(core.QBITTORRENT_USER, core.QBITTORRENT_PASSWORD) except Exception: logger.error('Failed to connect to qBittorrent')