From cc2aceb3d80a7421e7b76ffa6d5e64cbf5d32ab7 Mon Sep 17 00:00:00 2001 From: rembo10 Date: Thu, 21 May 2015 19:14:58 -0700 Subject: [PATCH] Fix for nzbget connection url (#2135) --- CHANGELOG.md | 1 + headphones/nzbget.py | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d91fdfb..633c6400 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Highlights: * Fixed: Connecting to SABnzbd over https with python >= 2.7.9 * Fixed: Email Notifications with SSL * Fixed: Don't limit musicbrainz results to first 100 +* Fixed: nzbget url fix * Improved: Cuesplit, allow wav, ape to be split * Improved: Moved the 'freeze db' option to the advanced->misc. tab * Improved: Moved kickass searching to json api, so it doesn't throw 404 errors anymore when there are no results diff --git a/headphones/nzbget.py b/headphones/nzbget.py index 4ed18b7e..6a341a73 100644 --- a/headphones/nzbget.py +++ b/headphones/nzbget.py @@ -32,20 +32,20 @@ from headphones import logger def sendNZB(nzb): addToTop = False - nzbgetXMLrpc = "%(username)s:%(password)s@%(host)s/xmlrpc" + nzbgetXMLrpc = "%(protocol)s://%(username)s:%(password)s@%(host)s/xmlrpc" - if headphones.CONFIG.NZBGET_HOST is None: + if not headphones.CONFIG.NZBGET_HOST: logger.error(u"No NZBget host found in configuration. Please configure it.") return False if headphones.CONFIG.NZBGET_HOST.startswith('https://'): - nzbgetXMLrpc = 'https://' + nzbgetXMLrpc - headphones.CONFIG.NZBGET_HOST.replace('https://', '', 1) + protocol = 'https' + host = headphones.CONFIG.NZBGET_HOST.replace('https://', '', 1) else: - nzbgetXMLrpc = 'http://' + nzbgetXMLrpc - headphones.CONFIG.NZBGET_HOST.replace('http://', '', 1) + protocol = 'http' + host = headphones.CONFIG.NZBGET_HOST.replace('http://', '', 1) - url = nzbgetXMLrpc % {"host": headphones.CONFIG.NZBGET_HOST, "username": headphones.CONFIG.NZBGET_USERNAME, "password": headphones.CONFIG.NZBGET_PASSWORD} + url = nzbgetXMLrpc % {"protocol": protocol, "host": host, "username": headphones.CONFIG.NZBGET_USERNAME, "password": headphones.CONFIG.NZBGET_PASSWORD} nzbGetRPC = xmlrpclib.ServerProxy(url) try: