diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html index 37814e06..75024800 100755 --- a/data/interfaces/default/config.html +++ b/data/interfaces/default/config.html @@ -146,13 +146,16 @@ @@ -669,6 +715,8 @@ }); initActions(); initConfigCheckbox("#launch_browser"); + initConfigCheckbox("#use_sabnzbd"); + initConfigCheckbox("#use_nzbget"); initConfigCheckbox("#useblackhole"); initConfigCheckbox("#usenewznab"); initConfigCheckbox("#usenzbsu"); diff --git a/mylar/__init__.py b/mylar/__init__.py index cd068e20..dcd239ca 100755 --- a/mylar/__init__.py +++ b/mylar/__init__.py @@ -135,6 +135,7 @@ CVINFO = False LOG_LEVEL = None POST_PROCESSING = True +USE_SABNZBD = True SAB_HOST = None SAB_USERNAME = None SAB_PASSWORD = None @@ -143,6 +144,14 @@ SAB_CATEGORY = None SAB_PRIORITY = None SAB_DIRECTORY = None +USE_NZBGET = False +NZBGET_HOST = None +NZBGET_PORT = None +NZBGET_USERNAME = None +NZBGET_PASSWORD = None +NZBGET_PRIORITY = None +NZBGET_CATEGORY = None + NZBSU = False NZBSU_APIKEY = None @@ -235,8 +244,8 @@ def initialize(): HTTP_PORT, HTTP_HOST, HTTP_USERNAME, HTTP_PASSWORD, HTTP_ROOT, LAUNCH_BROWSER, GIT_PATH, \ CURRENT_VERSION, LATEST_VERSION, CHECK_GITHUB, CHECK_GITHUB_ON_STARTUP, CHECK_GITHUB_INTERVAL, USER_AGENT, MUSIC_DIR, DESTINATION_DIR, \ DOWNLOAD_DIR, USENET_RETENTION, SEARCH_INTERVAL, NZB_STARTUP_SEARCH, INTERFACE, AUTOWANT_ALL, AUTOWANT_UPCOMING, ZERO_LEVEL, ZERO_LEVEL_N, COMIC_COVER_LOCAL, \ - LIBRARYSCAN, LIBRARYSCAN_INTERVAL, DOWNLOAD_SCAN_INTERVAL, SAB_HOST, SAB_USERNAME, SAB_PASSWORD, SAB_APIKEY, SAB_CATEGORY, SAB_PRIORITY, SAB_DIRECTORY, BLACKHOLE, BLACKHOLE_DIR, ADD_COMICS, COMIC_DIR, IMP_MOVE, IMP_RENAME, IMP_METADATA, \ - NZBSU, NZBSU_APIKEY, DOGNZB, DOGNZB_APIKEY, NZBX,\ + LIBRARYSCAN, LIBRARYSCAN_INTERVAL, DOWNLOAD_SCAN_INTERVAL, USE_SABNZBD, SAB_HOST, SAB_USERNAME, SAB_PASSWORD, SAB_APIKEY, SAB_CATEGORY, SAB_PRIORITY, SAB_DIRECTORY, BLACKHOLE, BLACKHOLE_DIR, ADD_COMICS, COMIC_DIR, IMP_MOVE, IMP_RENAME, IMP_METADATA, \ + USE_NZBGET, NZBGET_HOST, NZBGET_PORT, NZBGET_USERNAME, NZBGET_PASSWORD, NZBGET_CATEGORY, NZBGET_PRIORITY, NZBSU, NZBSU_APIKEY, DOGNZB, DOGNZB_APIKEY, NZBX,\ NEWZNAB, NEWZNAB_HOST, NEWZNAB_APIKEY, NEWZNAB_ENABLED, EXTRA_NEWZNABS,\ RAW, RAW_PROVIDER, RAW_USERNAME, RAW_PASSWORD, RAW_GROUPS, EXPERIMENTAL, \ PROWL_ENABLED, PROWL_PRIORITY, PROWL_KEYS, PROWL_ONSNATCH, NMA_ENABLED, NMA_APIKEY, NMA_PRIORITY, NMA_ONSNATCH, \ @@ -249,6 +258,7 @@ def initialize(): # Make sure all the config sections exist CheckSection('General') CheckSection('SABnzbd') + CheckSection('NZBGet') CheckSection('NZBsu') CheckSection('DOGnzb') CheckSection('Raw') @@ -334,6 +344,7 @@ def initialize(): PRE_SCRIPTS = check_setting_str(CFG, 'General', 'pre_scripts', '') POST_PROCESSING = bool(check_setting_int(CFG, 'General', 'post_processing', 1)) + USE_SABNZBD = bool(check_setting_int(CFG, 'SABnzbd', 'use_sabnzbd', 0)) SAB_HOST = check_setting_str(CFG, 'SABnzbd', 'sab_host', '') SAB_USERNAME = check_setting_str(CFG, 'SABnzbd', 'sab_username', '') SAB_PASSWORD = check_setting_str(CFG, 'SABnzbd', 'sab_password', '') @@ -348,6 +359,15 @@ def initialize(): elif SAB_PRIORITY == "3": SAB_PRIORITY = "High" elif SAB_PRIORITY == "4": SAB_PRIORITY = "Paused" else: SAB_PRIORITY = "Default" + + USE_NZBGET = bool(check_setting_int(CFG, 'NZBGet', 'use_nzbget', 0)) + NZBGET_HOST = check_setting_str(CFG, 'NZBGet', 'nzbget_host', '') + NZBGET_PORT = check_setting_str(CFG, 'NZBGet', 'nzbget_port', '') + NZBGET_USERNAME = check_setting_str(CFG, 'NZBGet', 'nzbget_username', '') + NZBGET_PASSWORD = check_setting_str(CFG, 'NZBGet', 'nzbget_password', '') + NZBGET_CATEGORY = check_setting_str(CFG, 'NZBGet', 'nzbget_category', '') + NZBGET_PRIORITY = check_setting_str(CFG, 'NZBGet', 'nzbget_priority', '') + NZBSU = bool(check_setting_int(CFG, 'NZBsu', 'nzbsu', 0)) NZBSU_APIKEY = check_setting_str(CFG, 'NZBsu', 'nzbsu_apikey', '') @@ -601,7 +621,9 @@ def config_write(): new_config['General']['pre_scripts'] = PRE_SCRIPTS new_config['General']['post_processing'] = POST_PROCESSING + new_config['SABnzbd'] = {} + new_config['SABnzbd']['use_sabnzbd'] = int(USE_SABNZBD) new_config['SABnzbd']['sab_host'] = SAB_HOST new_config['SABnzbd']['sab_username'] = SAB_USERNAME new_config['SABnzbd']['sab_password'] = SAB_PASSWORD @@ -610,6 +632,16 @@ def config_write(): new_config['SABnzbd']['sab_priority'] = SAB_PRIORITY new_config['SABnzbd']['sab_directory'] = SAB_DIRECTORY + new_config['NZBGet'] = {} + new_config['NZBGet']['use_nzbget'] = int(USE_NZBGET) + new_config['NZBGet']['nzbget_host'] = NZBGET_HOST + new_config['NZBGet']['nzbget_port'] = NZBGET_PORT + new_config['NZBGet']['nzbget_username'] = NZBGET_USERNAME + new_config['NZBGet']['nzbget_password'] = NZBGET_PASSWORD + new_config['NZBGet']['nzbget_category'] = NZBGET_CATEGORY + new_config['NZBGet']['nzbget_priority'] = NZBGET_PRIORITY + + new_config['NZBsu'] = {} new_config['NZBsu']['nzbsu'] = int(NZBSU) new_config['NZBsu']['nzbsu_apikey'] = NZBSU_APIKEY diff --git a/mylar/search.py b/mylar/search.py index c6a32c2e..832dd180 100755 --- a/mylar/search.py +++ b/mylar/search.py @@ -338,7 +338,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is findurl = "http://www.nzb.su/api?t=search&q=" + str(comsearch[findloop]) + "&apikey=" + str(apikey) + "&o=xml&cat=7030" elif nzbprov == 'newznab': #let's make sure the host has a '/' at the end, if not add it. - if host_newznab[-1] != "/": host_newznab = str(host_newznab) + "/" + if host_newznab[:-1] != "/": host_newznab = str(host_newznab) + "/" findurl = str(host_newznab) + "api?t=search&q=" + str(comsearch[findloop]) + "&apikey=" + str(apikey) + "&o=xml&cat=7030" logger.fdebug("search-url: " + str(findurl)) elif nzbprov == 'nzbx': @@ -698,57 +698,58 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is logger.fdebug("new linkapi (this should =nzbname) :" + str(linkapi)) # #test nzb.get -# if mylar.NZBGET: -# from xmlrpclib import ServerProxy -# if mylar.NZBGET_HOST[:4] = 'http': -# tmpapi = "http://" -# nzbget_host = mylar.NZBGET_HOST[7] -# elif mylar.NZBGET_HOST[:5] = 'https': -# tmpapi = "https://" -# nzbget_host = mylar.NZBGET_HOST[8] -# tmpapi = tmpapi + str(mylar.NZBGET_USERNAME) + ":" + str(mylar.NZBGET_PASSWORD) -# tmpapi = tmpapi + "@" + nzbget_host + ":" + str(mylar.NZBGET_PORT) + "/xmlrpc" -# server = ServerProxy(tmpapi) -# send_to_nzbget = server.appendurl(nzbname, mylar.NZBGET_CATEGORY, mylar.NZBGET_PRIORITY, True, str(linkapi)) -# if send_to_nzbget is True: -# logger.info("Successfully sent nzb to NZBGet!") -# else: -# logger.info("Unable to send nzb to NZBGet - check your configs.") -# #end nzb.get test + if mylar.USE_NZBGET: + from xmlrpclib import ServerProxy + if mylar.NZBGET_HOST[:4] == 'http': + tmpapi = "http://" + nzbget_host = mylar.NZBGET_HOST[7] + elif mylar.NZBGET_HOST[:5] == 'https': + tmpapi = "https://" + nzbget_host = mylar.NZBGET_HOST[8] + tmpapi = tmpapi + str(mylar.NZBGET_USERNAME) + ":" + str(mylar.NZBGET_PASSWORD) + tmpapi = tmpapi + "@" + nzbget_host + ":" + str(mylar.NZBGET_PORT) + "/xmlrpc" + server = ServerProxy(tmpapi) + send_to_nzbget = server.appendurl(nzbname, mylar.NZBGET_CATEGORY, mylar.NZBGET_PRIORITY, True, str(linkapi)) + if send_to_nzbget is True: + logger.info("Successfully sent nzb to NZBGet!") + else: + logger.info("Unable to send nzb to NZBGet - check your configs.") +# #end nzb.get test - # let's build the send-to-SAB string now: - tmpapi = str(mylar.SAB_HOST) - logger.fdebug("send-to-SAB host string: " + str(tmpapi)) - # changed to just work with direct links now... - SABtype = "/api?mode=addurl&name=" - fileURL = str(linkapi) - tmpapi = tmpapi + str(SABtype) - logger.fdebug("...selecting API type: " + str(tmpapi)) - tmpapi = tmpapi + str(fileURL) - logger.fdebug("...attaching nzb provider link: " + str(tmpapi)) - # determine SAB priority - if mylar.SAB_PRIORITY: - tmpapi = tmpapi + "&priority=" + str(sabpriority) - logger.fdebug("...setting priority: " + str(tmpapi)) - # if category is blank, let's adjust - if mylar.SAB_CATEGORY: - tmpapi = tmpapi + "&cat=" + str(mylar.SAB_CATEGORY) - logger.fdebug("...attaching category: " + str(tmpapi)) - if mylar.RENAME_FILES or mylar.POST_PROCESSING: - tmpapi = tmpapi + "&script=ComicRN.py" - logger.fdebug("...attaching rename script: " + str(tmpapi)) - #final build of send-to-SAB - tmpapi = tmpapi + "&apikey=" + str(mylar.SAB_APIKEY) + elif mylar.USE_SABNZBD: + # let's build the send-to-SAB string now: + tmpapi = str(mylar.SAB_HOST) + logger.fdebug("send-to-SAB host string: " + str(tmpapi)) + # changed to just work with direct links now... + SABtype = "/api?mode=addurl&name=" + fileURL = str(linkapi) + tmpapi = tmpapi + str(SABtype) + logger.fdebug("...selecting API type: " + str(tmpapi)) + tmpapi = tmpapi + str(fileURL) + logger.fdebug("...attaching nzb provider link: " + str(tmpapi)) + # determine SAB priority + if mylar.SAB_PRIORITY: + tmpapi = tmpapi + "&priority=" + str(sabpriority) + logger.fdebug("...setting priority: " + str(tmpapi)) + # if category is blank, let's adjust + if mylar.SAB_CATEGORY: + tmpapi = tmpapi + "&cat=" + str(mylar.SAB_CATEGORY) + logger.fdebug("...attaching category: " + str(tmpapi)) + if mylar.RENAME_FILES or mylar.POST_PROCESSING: + tmpapi = tmpapi + "&script=ComicRN.py" + logger.fdebug("...attaching rename script: " + str(tmpapi)) + #final build of send-to-SAB + tmpapi = tmpapi + "&apikey=" + str(mylar.SAB_APIKEY) - logger.fdebug("Completed send-to-SAB link: " + str(tmpapi)) + logger.fdebug("Completed send-to-SAB link: " + str(tmpapi)) - try: - urllib2.urlopen(tmpapi) - except urllib2.URLError: - logger.error(u"Unable to send nzb file to SABnzbd") - return - - logger.info(u"Successfully sent nzb file to SABnzbd") + try: + urllib2.urlopen(tmpapi) + except urllib2.URLError: + logger.error(u"Unable to send nzb file to SABnzbd") + return + + logger.info(u"Successfully sent nzb file to SABnzbd") if mylar.PROWL_ENABLED and mylar.PROWL_ONSNATCH: logger.info(u"Sending Prowl notification") diff --git a/mylar/webserve.py b/mylar/webserve.py index e3f49f8f..11690942 100755 --- a/mylar/webserve.py +++ b/mylar/webserve.py @@ -934,6 +934,7 @@ class WebInterface(object): "nzb_search_interval" : mylar.SEARCH_INTERVAL, "nzb_startup_search" : helpers.checked(mylar.NZB_STARTUP_SEARCH), "libraryscan_interval" : mylar.LIBRARYSCAN_INTERVAL, + "use_sabnzbd" : helpers.checked(mylar.USE_SABNZBD), "sab_host" : mylar.SAB_HOST, "sab_user" : mylar.SAB_USERNAME, "sab_api" : mylar.SAB_APIKEY, @@ -941,6 +942,14 @@ class WebInterface(object): "sab_cat" : mylar.SAB_CATEGORY, "sab_priority" : mylar.SAB_PRIORITY, "sab_directory" : mylar.SAB_DIRECTORY, + "use_nzbget" : helpers.checked(mylar.USE_NZBGET), + "nzbget_host" : mylar.NZBGET_HOST, + "nzbget_port" : mylar.NZBGET_PORT, + "nzbget_user" : mylar.NZBGET_USERNAME, + "nzbget_pass" : mylar.NZBGET_PASSWORD, + "nzbget_cat" : mylar.NZBGET_CATEGORY, + "nzbget_priority" : mylar.NZBGET_PRIORITY, + "use_blackhole" : helpers.checked(mylar.BLACKHOLE), "blackhole_dir" : mylar.BLACKHOLE_DIR, "usenet_retention" : mylar.USENET_RETENTION, @@ -1090,7 +1099,8 @@ class WebInterface(object): comic_config.exposed = True def configUpdate(self, http_host='0.0.0.0', http_username=None, http_port=8090, http_password=None, launch_browser=0, logverbose=0, download_scan_interval=None, nzb_search_interval=None, nzb_startup_search=0, libraryscan_interval=None, - sab_host=None, sab_username=None, sab_apikey=None, sab_password=None, sab_category=None, sab_priority=None, sab_directory=None, log_dir=None, log_level=0, blackhole=0, blackhole_dir=None, + use_sabnzbd=0, sab_host=None, sab_username=None, sab_apikey=None, sab_password=None, sab_category=None, sab_priority=None, sab_directory=None, log_dir=None, log_level=0, blackhole=0, blackhole_dir=None, + use_nzbget=0, nzbget_host=None, nzbget_port=None, nzbget_username=None, nzbget_password=None, nzbget_category=None, nzbget_priority=None, usenet_retention=None, nzbsu=0, nzbsu_apikey=None, dognzb=0, dognzb_apikey=None, nzbx=0, newznab=0, newznab_host=None, newznab_apikey=None, newznab_enabled=0, raw=0, raw_provider=None, raw_username=None, raw_password=None, raw_groups=None, experimental=0, prowl_enabled=0, prowl_onsnatch=0, prowl_keys=None, prowl_priority=None, nma_enabled=0, nma_apikey=None, nma_priority=0, nma_onsnatch=0, @@ -1106,6 +1116,7 @@ class WebInterface(object): mylar.SEARCH_INTERVAL = nzb_search_interval mylar.NZB_STARTUP_SEARCH = nzb_startup_search mylar.LIBRARYSCAN_INTERVAL = libraryscan_interval + mylar.USE_SABNZBD = use_sabnzbd mylar.SAB_HOST = sab_host mylar.SAB_USERNAME = sab_username mylar.SAB_PASSWORD = sab_password @@ -1113,6 +1124,13 @@ class WebInterface(object): mylar.SAB_CATEGORY = sab_category mylar.SAB_PRIORITY = sab_priority mylar.SAB_DIRECTORY = sab_directory + mylar.USE_NZBGET = use_nzbget + mylar.NZBGET_HOST = nzbget_host + mylar.NZBGET_USERNAME = nzbget_username + mylar.NZBGET_PASSWORD = nzbget_password + mylar.NZBGET_PORT = nzbget_port + mylar.NZBGET_CATEGORY = nzbget_category + mylar.NZBGET_PRIORITY = nzbget_priority mylar.BLACKHOLE = blackhole mylar.BLACKHOLE_DIR = blackhole_dir mylar.USENET_RETENTION = usenet_retention
-
- SABnzbd +
+
+ +
+
usually http://localhost:8080 -
+
@@ -160,6 +163,7 @@
+
@@ -177,20 +181,62 @@
- + %for prio in ['Default', 'Low', 'Normal', 'High', 'Paused']: <% if config['sab_priority'] == prio: outputselect = 'selected' else: outputselect = '' %> - + %endfor
- +
+
+ +
+
+
+ + + usually http://localhost +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+