diff --git a/src/nzbmonkey.py b/src/nzbmonkey.py index 1266988..2e33f46 100644 --- a/src/nzbmonkey.py +++ b/src/nzbmonkey.py @@ -277,7 +277,7 @@ def __init__(self, nzb_file, max_missing_files=2, max_missing_segments_percent=2 self.regexes = { 'file_count_subject_1': re.compile(r'.*?[(\[](\d{1,4})/(\d{1,4})[)\]].*?\((\d{1,4})/(\d{1,5})\)', re.I), - 'file_count_subject_2': re.compile(r'.*?[\[](\d{1,4})/(\d{1,5})[\]]', re.I), + 'file_count_subject_2': re.compile(r'.*?\[(\d{1,4})/(\d{1,5})\]', re.I), 'segment_count_subject': re.compile(r'.*?\((\d{1,4})/(\d{1,5})\)$', re.I)} self.max_missing_files = int(max_missing_files) @@ -763,14 +763,6 @@ def search_nzb(header, password, search_engines, best_nzb, max_missing_files, ma 'downloadUrl': 'http://www.binsearch.info/?action=nzb&{id}=1&server=2', 'skip_segment_debug': False }, - 'nzbking': - { - 'name': 'NZBKing', - 'searchUrl': 'https://www.nzbking.com/search/?q={0}', - 'regex': r'href="/nzb:(?P.*?)/".*"', - 'downloadUrl': 'https://www.nzbking.com/nzb:{id}/', - 'skip_segment_debug': True - }, 'nzbindex': { 'name': 'NZBIndex', @@ -778,14 +770,6 @@ def search_nzb(header, password, search_engines, best_nzb, max_missing_files, ma 'regex': r'https:\/\/nzbindex\.com\/download\/(?P\d{8,})\/?<\/link>', 'downloadUrl': 'https://nzbindex.com/download/{id}.nzb?r[]={id}', 'skip_segment_debug': False - }, - 'newzleech': - { - 'name': 'Newzleech', - 'searchUrl': 'https://www.newzleech.com/?m=search&q={0}', - 'regex': r'class="subject">\d+)', - 'downloadUrl': 'https://www.newzleech.com/?m=gen&dl=1&post={id}', - 'skip_segment_debug': False } } @@ -1499,9 +1483,7 @@ def main(): {'binsearch': cfg['Searchengines'].as_int('binsearch'), 'binsearch_alternative': cfg['Searchengines'].as_int('binsearch_alternative'), - 'nzbking': cfg['Searchengines'].as_int('nzbking'), - 'nzbindex': cfg['Searchengines'].as_int('nzbindex'), - 'newzleech': cfg['Searchengines'].as_int('newzleech')}, + 'nzbindex': cfg['Searchengines'].as_int('nzbindex')}, cfg['NZBCheck'].as_bool('best_nzb'), cfg['NZBCheck'].get('max_missing_files', 2), cfg['NZBCheck'].get('max_missing_segments_percent', 2.5), @@ -1542,7 +1524,7 @@ def main(): if ExeTypes.SABNZBD.name == exe_target: scheme = 'https' if exe_target_cfg.as_bool('ssl') else 'http' - req_url = '{0}://{1}:{2}/{3}/api?mode=queue&output=json' \ + req_url = '{0}://{1}:{2}/{3}/api?mode=get_cats&output=json' \ '&apikey={4}'.format(scheme, exe_target_cfg.get('host', 'localhost'), exe_target_cfg.get('port', '8080'), @@ -1550,16 +1532,18 @@ def main(): exe_target_cfg.get('nzbkey', '')) try: - res = json.loads(requests.get(req_url, verify=False, timeout=REQUESTS_TIMEOUT * 2).text) - if 'error' in res.keys() and res['error'].lower() == 'api key incorrect': - print(Col.FAIL + ' - Please use the API KEY not the NZB KEY in your config!' + Col.OFF) + res = requests.get(req_url, verify=False, timeout=REQUESTS_TIMEOUT * 2) + if res.status_code == 403: + print_and_wait(Col.FAIL + ' - Please use the API KEY not the NZB KEY in your config!' + Col.OFF, WAITING_TIME_LONG) raise EnvironmentError - if 'queue' not in res.keys(): + res = json.loads(res.text) + + if 'categories' not in res.keys(): print(Col.FAIL + ' - Reading categories failed!' + Col.OFF) raise EnvironmentError - sabcats = res['queue']['categories'] + sabcats = res['categories'] for sabcat in sabcats: if sabcat != '*': cat_choice.append(sabcat) @@ -1567,7 +1551,6 @@ def main(): except (EnvironmentError, ValueError): cat_choice = [] - # Ask NZBGet for categories if ExeTypes.NZBGET.name == exe_target: diff --git a/src/nzbmonkeyspec.py b/src/nzbmonkeyspec.py index 553c429..3a25932 100644 --- a/src/nzbmonkeyspec.py +++ b/src/nzbmonkeyspec.py @@ -106,13 +106,9 @@ def getSpec(): # 0 = disabled; 1-9 = enabled; 1-9 are also the order in which the search engines are used # More than 1 server with the same order number is allowed # Enable Binsearch -binsearch = integer(default = 1) +binsearch = integer(default = 2) # Enable Binsearch - Alternative Server -binsearch_alternative = integer(default = 1) +binsearch_alternative = integer(default = 2) # Enable NZBIndex nzbindex = integer(default = 1) -# Enable NZBKing -nzbking = integer(default = 1) -# Enable Newzleech -newzleech = integer(default = 1) """.split('\n')) diff --git a/src/version.py b/src/version.py index 0dbf583..91f97bd 100644 --- a/src/version.py +++ b/src/version.py @@ -1,6 +1,10 @@ # -*- coding: utf-8 -*- """ History +v0.2.8 +- Fix #40 SABnzbd API compatibility +- Remove NZBKing (Rip!) + v0.2.7 - Fix #15 (Linux KDE/Plasma konsole option removed, thx @PietroPizzi69) - Provider fail save (thx @kwaaak) @@ -87,5 +91,5 @@ """ -__version__ = '0.2.7' +__version__ = '0.2.8' __requires__ = ['pyperclip', 'requests', 'configobj', 'colorama', 'cryptography']