mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-20 16:03:59 +01:00
Added nzbx.co as a provider, added a timeout to the git check stuff on startup
This commit is contained in:
@@ -271,6 +271,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<legend>nzbX</legend>
|
||||||
|
<div class="row checkbox">
|
||||||
|
<input id="usenzbx" type="checkbox" name="nzbx" onclick="initConfigCheckbox($(this));" value="1" ${config['use_nzbx']} /><label>Use nzbX</label>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
@@ -1029,6 +1035,7 @@
|
|||||||
initConfigCheckbox("#usenewznab");
|
initConfigCheckbox("#usenewznab");
|
||||||
initConfigCheckbox("#usenzbsrus");
|
initConfigCheckbox("#usenzbsrus");
|
||||||
initConfigCheckbox("#usenzbsorg");
|
initConfigCheckbox("#usenzbsorg");
|
||||||
|
initConfigCheckbox("#usenzbx");
|
||||||
initConfigCheckbox("#usewaffles");
|
initConfigCheckbox("#usewaffles");
|
||||||
initConfigCheckbox("#userutracker");
|
initConfigCheckbox("#userutracker");
|
||||||
initConfigCheckbox("#usewhatcd");
|
initConfigCheckbox("#usewhatcd");
|
||||||
|
|||||||
+13
-5
@@ -148,6 +148,8 @@ NZBSRUS = False
|
|||||||
NZBSRUS_UID = None
|
NZBSRUS_UID = None
|
||||||
NZBSRUS_APIKEY = None
|
NZBSRUS_APIKEY = None
|
||||||
|
|
||||||
|
NZBX = False
|
||||||
|
|
||||||
LASTFM_USERNAME = None
|
LASTFM_USERNAME = None
|
||||||
|
|
||||||
LOSSY_MEDIA_FORMATS = ["mp3", "aac", "ogg", "ape", "m4a"]
|
LOSSY_MEDIA_FORMATS = ["mp3", "aac", "ogg", "ape", "m4a"]
|
||||||
@@ -275,11 +277,11 @@ def initialize():
|
|||||||
TORRENTBLACKHOLE_DIR, NUMBEROFSEEDERS, ISOHUNT, KAT, MININOVA, WAFFLES, WAFFLES_UID, WAFFLES_PASSKEY, \
|
TORRENTBLACKHOLE_DIR, NUMBEROFSEEDERS, ISOHUNT, KAT, MININOVA, WAFFLES, WAFFLES_UID, WAFFLES_PASSKEY, \
|
||||||
RUTRACKER, RUTRACKER_USER, RUTRACKER_PASSWORD, WHATCD, WHATCD_USERNAME, WHATCD_PASSWORD, DOWNLOAD_TORRENT_DIR, \
|
RUTRACKER, RUTRACKER_USER, RUTRACKER_PASSWORD, WHATCD, WHATCD_USERNAME, WHATCD_PASSWORD, DOWNLOAD_TORRENT_DIR, \
|
||||||
LIBRARYSCAN, LIBRARYSCAN_INTERVAL, DOWNLOAD_SCAN_INTERVAL, SAB_HOST, SAB_USERNAME, SAB_PASSWORD, SAB_APIKEY, SAB_CATEGORY, \
|
LIBRARYSCAN, LIBRARYSCAN_INTERVAL, DOWNLOAD_SCAN_INTERVAL, SAB_HOST, SAB_USERNAME, SAB_PASSWORD, SAB_APIKEY, SAB_CATEGORY, \
|
||||||
NZBMATRIX, NZBMATRIX_USERNAME, NZBMATRIX_APIKEY, NEWZNAB, NEWZNAB_HOST, NEWZNAB_APIKEY, NEWZNAB_ENABLED, EXTRA_NEWZNABS,\
|
NZBMATRIX, NZBMATRIX_USERNAME, NZBMATRIX_APIKEY, NEWZNAB, NEWZNAB_HOST, NEWZNAB_APIKEY, NEWZNAB_ENABLED, EXTRA_NEWZNABS, \
|
||||||
NZBSORG, NZBSORG_UID, NZBSORG_HASH, NEWZBIN, NEWZBIN_UID, NEWZBIN_PASSWORD, NZBSRUS, NZBSRUS_UID, NZBSRUS_APIKEY, LASTFM_USERNAME, INTERFACE, FOLDER_PERMISSIONS, \
|
NZBSORG, NZBSORG_UID, NZBSORG_HASH, NEWZBIN, NEWZBIN_UID, NEWZBIN_PASSWORD, NZBSRUS, NZBSRUS_UID, NZBSRUS_APIKEY, NZBX, \
|
||||||
ENCODERFOLDER, ENCODER_PATH, ENCODER, XLDPROFILE, BITRATE, SAMPLINGFREQUENCY, MUSIC_ENCODER, ADVANCEDENCODER, ENCODEROUTPUTFORMAT, ENCODERQUALITY, \
|
LASTFM_USERNAME, INTERFACE, FOLDER_PERMISSIONS, ENCODERFOLDER, ENCODER_PATH, ENCODER, XLDPROFILE, BITRATE, SAMPLINGFREQUENCY, \
|
||||||
ENCODERVBRCBR, ENCODERLOSSLESS, DELETE_LOSSLESS_FILES, PROWL_ENABLED, PROWL_PRIORITY, PROWL_KEYS, PROWL_ONSNATCH, \
|
MUSIC_ENCODER, ADVANCEDENCODER, ENCODEROUTPUTFORMAT, ENCODERQUALITY, ENCODERVBRCBR, ENCODERLOSSLESS, DELETE_LOSSLESS_FILES, \
|
||||||
PUSHOVER_ENABLED, PUSHOVER_PRIORITY, PUSHOVER_KEYS, PUSHOVER_ONSNATCH, MIRRORLIST, \
|
PROWL_ENABLED, PROWL_PRIORITY, PROWL_KEYS, PROWL_ONSNATCH, PUSHOVER_ENABLED, PUSHOVER_PRIORITY, PUSHOVER_KEYS, PUSHOVER_ONSNATCH, MIRRORLIST, \
|
||||||
MIRROR, CUSTOMHOST, CUSTOMPORT, CUSTOMSLEEP, HPUSER, HPPASS, XBMC_ENABLED, XBMC_HOST, XBMC_USERNAME, XBMC_PASSWORD, XBMC_UPDATE, \
|
MIRROR, CUSTOMHOST, CUSTOMPORT, CUSTOMSLEEP, HPUSER, HPPASS, XBMC_ENABLED, XBMC_HOST, XBMC_USERNAME, XBMC_PASSWORD, XBMC_UPDATE, \
|
||||||
XBMC_NOTIFY, NMA_ENABLED, NMA_APIKEY, NMA_PRIORITY, NMA_ONSNATCH, SYNOINDEX_ENABLED, ALBUM_COMPLETION_PCT, PREFERRED_BITRATE_HIGH_BUFFER, \
|
XBMC_NOTIFY, NMA_ENABLED, NMA_APIKEY, NMA_PRIORITY, NMA_ONSNATCH, SYNOINDEX_ENABLED, ALBUM_COMPLETION_PCT, PREFERRED_BITRATE_HIGH_BUFFER, \
|
||||||
PREFERRED_BITRATE_LOW_BUFFER,CACHE_SIZEMB
|
PREFERRED_BITRATE_LOW_BUFFER,CACHE_SIZEMB
|
||||||
@@ -294,6 +296,7 @@ def initialize():
|
|||||||
CheckSection('Newznab')
|
CheckSection('Newznab')
|
||||||
CheckSection('NZBsorg')
|
CheckSection('NZBsorg')
|
||||||
CheckSection('NZBsRus')
|
CheckSection('NZBsRus')
|
||||||
|
CheckSection('nzbX')
|
||||||
CheckSection('Newzbin')
|
CheckSection('Newzbin')
|
||||||
CheckSection('Waffles')
|
CheckSection('Waffles')
|
||||||
CheckSection('Rutracker')
|
CheckSection('Rutracker')
|
||||||
@@ -416,6 +419,8 @@ def initialize():
|
|||||||
NZBSRUS = bool(check_setting_int(CFG, 'NZBsRus', 'nzbsrus', 0))
|
NZBSRUS = bool(check_setting_int(CFG, 'NZBsRus', 'nzbsrus', 0))
|
||||||
NZBSRUS_UID = check_setting_str(CFG, 'NZBsRus', 'nzbsrus_uid', '')
|
NZBSRUS_UID = check_setting_str(CFG, 'NZBsRus', 'nzbsrus_uid', '')
|
||||||
NZBSRUS_APIKEY = check_setting_str(CFG, 'NZBsRus', 'nzbsrus_apikey', '')
|
NZBSRUS_APIKEY = check_setting_str(CFG, 'NZBsRus', 'nzbsrus_apikey', '')
|
||||||
|
|
||||||
|
NZBX = bool(check_setting_int(CFG, 'nzbX', 'nzbx', 0))
|
||||||
|
|
||||||
LASTFM_USERNAME = check_setting_str(CFG, 'General', 'lastfm_username', '')
|
LASTFM_USERNAME = check_setting_str(CFG, 'General', 'lastfm_username', '')
|
||||||
|
|
||||||
@@ -748,6 +753,9 @@ def config_write():
|
|||||||
new_config['NZBsRus']['nzbsrus'] = int(NZBSRUS)
|
new_config['NZBsRus']['nzbsrus'] = int(NZBSRUS)
|
||||||
new_config['NZBsRus']['nzbsrus_uid'] = NZBSRUS_UID
|
new_config['NZBsRus']['nzbsrus_uid'] = NZBSRUS_UID
|
||||||
new_config['NZBsRus']['nzbsrus_apikey'] = NZBSRUS_APIKEY
|
new_config['NZBsRus']['nzbsrus_apikey'] = NZBSRUS_APIKEY
|
||||||
|
|
||||||
|
new_config['nzbX'] = {}
|
||||||
|
new_config['nzbX']['nzbx'] = int(NZBX)
|
||||||
|
|
||||||
new_config['Prowl'] = {}
|
new_config['Prowl'] = {}
|
||||||
new_config['Prowl']['prowl_enabled'] = int(PROWL_ENABLED)
|
new_config['Prowl']['prowl_enabled'] = int(PROWL_ENABLED)
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ from lib.pygazelle import format as gazelleformat
|
|||||||
from lib.pygazelle import media as gazellemedia
|
from lib.pygazelle import media as gazellemedia
|
||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
from xml.parsers.expat import ExpatError
|
from xml.parsers.expat import ExpatError
|
||||||
|
import lib.simplejson as json
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
import gzip
|
import gzip
|
||||||
|
|
||||||
@@ -425,6 +426,55 @@ def searchNZB(albumid=None, new=False, losslessOnly=False):
|
|||||||
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
logger.error(u"An unknown error occurred trying to parse the feed: %s" % e)
|
logger.error(u"An unknown error occurred trying to parse the feed: %s" % e)
|
||||||
|
|
||||||
|
if headphones.NZBX:
|
||||||
|
provider = "nzbx"
|
||||||
|
if headphones.PREFERRED_QUALITY == 3 or losslessOnly:
|
||||||
|
categories = "3040"
|
||||||
|
elif headphones.PREFERRED_QUALITY:
|
||||||
|
categories = "3040,3010"
|
||||||
|
else:
|
||||||
|
categories = "3010"
|
||||||
|
|
||||||
|
if albums['Type'] == 'Other':
|
||||||
|
categories = "3030"
|
||||||
|
logger.info("Album type is audiobook/spokenword. Using audiobook category")
|
||||||
|
|
||||||
|
params = { "source" : "headphones",
|
||||||
|
"cat": categories,
|
||||||
|
"q": term
|
||||||
|
}
|
||||||
|
|
||||||
|
searchURL = 'https://nzbx.co/api/search?' + urllib.urlencode(params)
|
||||||
|
|
||||||
|
logger.info(u'Parsing results from <a href="%s">nzbx.co</a>' % searchURL)
|
||||||
|
|
||||||
|
try:
|
||||||
|
data = urllib2.urlopen(searchURL, timeout=20).read()
|
||||||
|
except urllib2.URLError, e:
|
||||||
|
logger.warn('Error fetching data from nzbx.co: %s' % str(e))
|
||||||
|
data = False
|
||||||
|
|
||||||
|
if data:
|
||||||
|
|
||||||
|
d = json.loads(data)
|
||||||
|
|
||||||
|
if not len(d):
|
||||||
|
logger.info(u"No results found from nzbx.co for %s" % term)
|
||||||
|
pass
|
||||||
|
|
||||||
|
else:
|
||||||
|
for item in d:
|
||||||
|
try:
|
||||||
|
url = item['nzb']
|
||||||
|
title = item['name']
|
||||||
|
size = item['size']
|
||||||
|
|
||||||
|
resultlist.append((title, size, url, provider))
|
||||||
|
logger.info('Found %s. Size: %s' % (title, helpers.bytes_to_mb(size)))
|
||||||
|
|
||||||
|
except Exception, e:
|
||||||
|
logger.error(u"An unknown error occurred trying to parse the feed: %s" % e)
|
||||||
|
|
||||||
# if headphones.NEWZBIN:
|
# if headphones.NEWZBIN:
|
||||||
# provider = "newzbin"
|
# provider = "newzbin"
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ def checkGithub():
|
|||||||
url = 'https://api.github.com/repos/%s/headphones/commits/%s' % (headphones.GIT_USER, headphones.GIT_BRANCH)
|
url = 'https://api.github.com/repos/%s/headphones/commits/%s' % (headphones.GIT_USER, headphones.GIT_BRANCH)
|
||||||
logger.info('Retrieving latest version information from github')
|
logger.info('Retrieving latest version information from github')
|
||||||
try:
|
try:
|
||||||
result = urllib2.urlopen(url).read()
|
result = urllib2.urlopen(url, timeout=20).read()
|
||||||
git = simplejson.JSONDecoder().decode(result)
|
git = simplejson.JSONDecoder().decode(result)
|
||||||
headphones.LATEST_VERSION = git['sha']
|
headphones.LATEST_VERSION = git['sha']
|
||||||
except:
|
except:
|
||||||
@@ -122,7 +122,7 @@ def checkGithub():
|
|||||||
url = 'https://api.github.com/repos/%s/headphones/compare/%s...%s' % (headphones.GIT_USER, headphones.CURRENT_VERSION, headphones.LATEST_VERSION)
|
url = 'https://api.github.com/repos/%s/headphones/compare/%s...%s' % (headphones.GIT_USER, headphones.CURRENT_VERSION, headphones.LATEST_VERSION)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = urllib2.urlopen(url).read()
|
result = urllib2.urlopen(url, timeout=20).read()
|
||||||
git = simplejson.JSONDecoder().decode(result)
|
git = simplejson.JSONDecoder().decode(result)
|
||||||
headphones.COMMITS_BEHIND = git['total_commits']
|
headphones.COMMITS_BEHIND = git['total_commits']
|
||||||
except:
|
except:
|
||||||
|
|||||||
@@ -594,6 +594,7 @@ class WebInterface(object):
|
|||||||
"use_nzbsrus" : checked(headphones.NZBSRUS),
|
"use_nzbsrus" : checked(headphones.NZBSRUS),
|
||||||
"nzbsrus_uid" : headphones.NZBSRUS_UID,
|
"nzbsrus_uid" : headphones.NZBSRUS_UID,
|
||||||
"nzbsrus_apikey" : headphones.NZBSRUS_APIKEY,
|
"nzbsrus_apikey" : headphones.NZBSRUS_APIKEY,
|
||||||
|
"use_nzbx" : checked(headphones.NZBX),
|
||||||
"torrentblackhole_dir" : headphones.TORRENTBLACKHOLE_DIR,
|
"torrentblackhole_dir" : headphones.TORRENTBLACKHOLE_DIR,
|
||||||
"download_torrent_dir" : headphones.DOWNLOAD_TORRENT_DIR,
|
"download_torrent_dir" : headphones.DOWNLOAD_TORRENT_DIR,
|
||||||
"numberofseeders" : headphones.NUMBEROFSEEDERS,
|
"numberofseeders" : headphones.NUMBEROFSEEDERS,
|
||||||
@@ -697,7 +698,7 @@ class WebInterface(object):
|
|||||||
def configUpdate(self, http_host='0.0.0.0', http_username=None, http_port=8181, http_password=None, launch_browser=0, api_enabled=0, api_key=None,
|
def configUpdate(self, http_host='0.0.0.0', http_username=None, http_port=8181, http_password=None, launch_browser=0, api_enabled=0, api_key=None,
|
||||||
download_scan_interval=None, nzb_search_interval=None, libraryscan_interval=None, sab_host=None, sab_username=None, sab_apikey=None, sab_password=None,
|
download_scan_interval=None, nzb_search_interval=None, libraryscan_interval=None, sab_host=None, sab_username=None, sab_apikey=None, sab_password=None,
|
||||||
sab_category=None, download_dir=None, blackhole=0, blackhole_dir=None, usenet_retention=None, newznab=0, newznab_host=None, newznab_apikey=None,
|
sab_category=None, download_dir=None, blackhole=0, blackhole_dir=None, usenet_retention=None, newznab=0, newznab_host=None, newznab_apikey=None,
|
||||||
newznab_enabled=0, nzbsorg=0, nzbsorg_uid=None, nzbsorg_hash=None, nzbsrus=0, nzbsrus_uid=None, nzbsrus_apikey=None, preferred_quality=0, preferred_bitrate=None,
|
newznab_enabled=0, nzbsorg=0, nzbsorg_uid=None, nzbsorg_hash=None, nzbsrus=0, nzbsrus_uid=None, nzbsrus_apikey=None, nzbx=None, preferred_quality=0, preferred_bitrate=None,
|
||||||
detect_bitrate=0, move_files=0, torrentblackhole_dir=None, download_torrent_dir=None,
|
detect_bitrate=0, move_files=0, torrentblackhole_dir=None, download_torrent_dir=None,
|
||||||
numberofseeders=10, use_isohunt=0, use_kat=0, use_mininova=0, waffles=0, waffles_uid=None, waffles_passkey=None, whatcd=0, whatcd_username=None, whatcd_password=None,
|
numberofseeders=10, use_isohunt=0, use_kat=0, use_mininova=0, waffles=0, waffles_uid=None, waffles_passkey=None, whatcd=0, whatcd_username=None, whatcd_password=None,
|
||||||
rutracker=0, rutracker_user=None, rutracker_password=None, rename_files=0, correct_metadata=0, cleanup_files=0, add_album_art=0, embed_album_art=0, embed_lyrics=0,
|
rutracker=0, rutracker_user=None, rutracker_password=None, rename_files=0, correct_metadata=0, cleanup_files=0, add_album_art=0, embed_album_art=0, embed_lyrics=0,
|
||||||
@@ -744,6 +745,7 @@ class WebInterface(object):
|
|||||||
headphones.NZBSRUS = nzbsrus
|
headphones.NZBSRUS = nzbsrus
|
||||||
headphones.NZBSRUS_UID = nzbsrus_uid
|
headphones.NZBSRUS_UID = nzbsrus_uid
|
||||||
headphones.NZBSRUS_APIKEY = nzbsrus_apikey
|
headphones.NZBSRUS_APIKEY = nzbsrus_apikey
|
||||||
|
headphones.NZBX = nzbx
|
||||||
headphones.TORRENTBLACKHOLE_DIR = torrentblackhole_dir
|
headphones.TORRENTBLACKHOLE_DIR = torrentblackhole_dir
|
||||||
headphones.NUMBEROFSEEDERS = numberofseeders
|
headphones.NUMBEROFSEEDERS = numberofseeders
|
||||||
headphones.DOWNLOAD_TORRENT_DIR = download_torrent_dir
|
headphones.DOWNLOAD_TORRENT_DIR = download_torrent_dir
|
||||||
|
|||||||
Reference in New Issue
Block a user