Album Quality:
Include lossless
@@ -93,5 +114,6 @@ form = '''
(For now, all changes require a restart to take effect) ''' % (http_host, http_username,
http_port, http_password, var_to_chk(launch_browser), sab_host, sab_username, sab_apikey, sab_password,
sab_category, music_download_dir, usenet_retention, var_to_chk(nzbmatrix), nzbmatrix_username, nzbmatrix_apikey,
+ var_to_chk(newznab), newznab_host, newznab_apikey, var_to_chk(nzbsorg), nzbsorg_uid, nzbsorg_hash,
var_to_chk(include_lossless), var_to_chk(flac_to_mp3), var_to_chk(move_to_itunes), path_to_itunes, var_to_chk(rename_mp3s),
var_to_chk(cleanup), var_to_chk(add_album_art))
\ No newline at end of file
diff --git a/configcreate.py b/configcreate.py
index 015a83f3..476f1922 100644
--- a/configcreate.py
+++ b/configcreate.py
@@ -28,5 +28,13 @@ def configCreate(path):
config['NZBMatrix']['nzbmatrix'] = 0
config['NZBMatrix']['nzbmatrix_username'] = ''
config['NZBMatrix']['nzbmatrix_apikey'] = ''
+ config['Newznab'] = {}
+ config['Newznab']['newznab'] = 0
+ config['Newznab']['newznab_host'] = ''
+ config['Newznab']['newznab_apikey'] = ''
+ config['NZBsorg'] = {}
+ config['NZBsorg']['nzbsorg'] = 0
+ config['NZBsorg']['nzbsorg_uid'] = ''
+ config['NZBsorg']['nzbsorg_hash'] = ''
config.write()
\ No newline at end of file
diff --git a/searcher.py b/searcher.py
index 4f55768c..d837bb8e 100644
--- a/searcher.py
+++ b/searcher.py
@@ -12,10 +12,19 @@ config = ConfigObj(config_file)
General = config['General']
NZBMatrix = config['NZBMatrix']
SABnzbd = config['SABnzbd']
+Newznab = config['Newznab']
+NZBsorg = config['NZBsorg']
+usenet_retention = General['usenet_retention']
+include_lossless = General['include_lossless']
nzbmatrix = NZBMatrix['nzbmatrix']
nzbmatrix_username = NZBMatrix['nzbmatrix_username']
nzbmatrix_apikey = NZBMatrix['nzbmatrix_apikey']
-usenet_retention = General['usenet_retention']
+newznab = Newznab['newznab']
+newznab_host = Newznab['newznab_host']
+newznab_apikey = Newznab['newznab_apikey']
+nzbsorg = NZBsorg['nzbsorg']
+nzbsorg_uid = NZBsorg['nzbsorg_uid']
+nzbsorg_hash = NZBsorg['nzbsorg_hash']
sab_host = SABnzbd['sab_host']
sab_username = SABnzbd['sab_username']
sab_password = SABnzbd['sab_password']
@@ -23,12 +32,6 @@ sab_apikey = SABnzbd['sab_apikey']
sab_category = SABnzbd['sab_category']
-if General['include_lossless'] == '1':
- categories = "23, 22"
- maxsize = 2000000000
-else:
- categories = "22"
- maxsize = 250000000
def searchNZB(albumid=None):
@@ -49,36 +52,108 @@ def searchNZB(albumid=None):
clname = string.replace(albums[0], ' & ', ' ')
clalbum = string.replace(albums[1], ' & ', ' ')
term = re.sub('[\.\-]', ' ', '%s %s %s' % (clname, clalbum, year)).encode('utf-8')
-
- params = { "page": "download",
- "username": nzbmatrix_username,
- "apikey": nzbmatrix_apikey,
- "subcat": categories,
- "age": usenet_retention,
- "english": 1,
- "ssl": 1,
- "scenename": 1,
- "term": term
- }
-
- searchURL = "http://rss.nzbmatrix.com/rss.php?" + urllib.urlencode(params)
-
- d = feedparser.parse(searchURL)
-
resultlist = []
- for item in d.entries:
- try:
- url = item.link
- title = item.title
- size = int(item.links[1]['length'])
- if size < maxsize:
- resultlist.append((title, size, url))
+ if nzbmatrix == '1':
+
+ if include_lossless == '1':
+ categories = "23,22"
+ maxsize = 2000000000
+ else:
+ categories = "22"
+ maxsize = 250000000
- except:
- print '''No results found'''
+ params = { "page": "download",
+ "username": nzbmatrix_username,
+ "apikey": nzbmatrix_apikey,
+ "subcat": categories,
+ "age": usenet_retention,
+ "english": 1,
+ "ssl": 1,
+ "scenename": 1,
+ "term": term
+ }
+
+ searchURL = "http://rss.nzbmatrix.com/rss.php?" + urllib.urlencode(params)
+
+ d = feedparser.parse(searchURL)
+
+ for item in d.entries:
+ try:
+ url = item.link
+ title = item.title
+ size = int(item.links[1]['length'])
+ if size < maxsize:
+ resultlist.append((title, size, url))
+
+ except:
+ print '''No results found'''
+
+ if newznab == '1':
+
+ if include_lossless == '1':
+ categories = "3040,3010"
+ maxsize = 2000000000
+ else:
+ categories = "3010"
+ maxsize = 250000000
+
+ params = { "t": "search",
+ "apikey": newznab_apikey,
+ "cat": categories,
+ "maxage": usenet_retention,
+ "q": term
+ }
+
+ searchURL = newznab_host + '/api?' + urllib.urlencode(params)
+
+ d = feedparser.parse(searchURL)
+
+ for item in d.entries:
+ try:
+ url = item.link
+ title = item.title
+ size = int(item.links[1]['length'])
+ if size < maxsize:
+ resultlist.append((title, size, url))
+
+ except:
+ print '''No results found'''
+
+ if nzbsorg == '1':
+
+ if include_lossless == '1':
+ categories = "3040,3010"
+ maxsize = 2000000000
+ else:
+ categories = "3010"
+ maxsize = 250000000
+
+ params = { "action": "search",
+ "dl": 1,
+ "i": nzbsorg_uid,
+ "h": nzbsorg_hash,
+ "age": usenet_retention,
+ "q": term
+ }
+
+ searchURL = 'https://secure.nzbs.org/rss.php?' + urllib.urlencode(params)
+
+ d = feedparser.parse(searchURL)
+
+ for item in d.entries:
+ try:
+ url = item.link
+ title = item.title
+ size = int(item.links[1]['length'])
+ if size < maxsize:
+ resultlist.append((title, size, url))
+
+ except:
+ print '''No results found'''
+
if len(resultlist):
bestqual = sorted(resultlist, key=lambda title: title[1], reverse=True)[0]
diff --git a/webServer.py b/webServer.py
index d6f61cac..20954c0b 100644
--- a/webServer.py
+++ b/webServer.py
@@ -342,13 +342,15 @@ class Headphones:
def configUpdate(self, http_host='127.0.0.1', http_username=None, http_port=8181, http_password=None, launch_browser=0,
sab_host=None, sab_username=None, sab_apikey=None, sab_password=None, sab_category=None, music_download_dir=None,
- usenet_retention=None, nzbmatrix=0, nzbmatrix_username=None, nzbmatrix_apikey=None, include_lossless=0,
- flac_to_mp3=0, move_to_itunes=0, path_to_itunes=None, rename_mp3s=0, cleanup=0, add_album_art=0):
+ usenet_retention=None, nzbmatrix=0, nzbmatrix_username=None, nzbmatrix_apikey=None, newznab=0, newznab_host=None, newznab_apikey=None,
+ nzbsorg=0, nzbsorg_uid=None, nzbsorg_hash=None, include_lossless=0,flac_to_mp3=0, move_to_itunes=0, path_to_itunes=None, rename_mp3s=0, cleanup=0, add_album_art=0):
configs = configobj.ConfigObj(config_file)
SABnzbd = configs['SABnzbd']
General = configs['General']
NZBMatrix = configs['NZBMatrix']
+ Newznab = configs['Newznab']
+ NZBsorg = configs['NZBsorg']
General['http_host'] = http_host
General['http_port'] = http_port
General['http_username'] = http_username
@@ -364,6 +366,12 @@ class Headphones:
NZBMatrix['nzbmatrix'] = nzbmatrix
NZBMatrix['nzbmatrix_username'] = nzbmatrix_username
NZBMatrix['nzbmatrix_apikey'] = nzbmatrix_apikey
+ Newznab['newznab'] = newznab
+ Newznab['newznab_host'] = newznab_host
+ Newznab['newznab_apikey'] = newznab_apikey
+ NZBsorg['nzbsorg'] = nzbsorg
+ NZBsorg['nzbsorg_uid'] = nzbsorg_uid
+ NZBsorg['nzbsorg_hash'] = nzbsorg_hash
General['include_lossless'] = include_lossless
General['flac_to_mp3'] = flac_to_mp3
General['move_to_itunes'] = move_to_itunes
|