mirror of
https://github.com/rembo10/headphones.git
synced 2026-04-04 20:19:27 +01:00
Merge remote-tracking branch 'seif/omgwtfnzbs' into develop
This commit is contained in:
@@ -362,6 +362,22 @@
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>omgwtfnzbs</legend>
|
||||
<div class="row checkbox">
|
||||
<input id="useomgwtfnzbs" type="checkbox" name="omgwtfnzbs" onclick="initConfigCheckbox($(this));" value="1" ${config['use_omgwtfnzbs']} /><label>Use omgwtfnzbs</label>
|
||||
</div>
|
||||
<div class="config">
|
||||
<div class="row">
|
||||
<label>omgwtfnzbs UID</label>
|
||||
<input type="text" name="omgwtfnzbs_uid" value="${config['omgwtfnzbs_uid']}" size="10">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>omgwtfnzbs API Key</label>
|
||||
<input type="text" name="omgwtfnzbs_apikey" value="${config['omgwtfnzbs_apikey']}" size="10">
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</td>
|
||||
<td>
|
||||
<fieldset>
|
||||
@@ -1267,6 +1283,7 @@
|
||||
initConfigCheckbox("#usenewznab");
|
||||
initConfigCheckbox("#usenzbsrus");
|
||||
initConfigCheckbox("#usenzbsorg");
|
||||
initConfigCheckbox("#useomgwtfnzbs");
|
||||
initConfigCheckbox("#usepiratebay");
|
||||
initConfigCheckbox("#usewaffles");
|
||||
initConfigCheckbox("#userutracker");
|
||||
|
||||
@@ -168,6 +168,10 @@ NZBSRUS = False
|
||||
NZBSRUS_UID = None
|
||||
NZBSRUS_APIKEY = None
|
||||
|
||||
OMGWTFNZBS = False
|
||||
OMGWTFNZBS_UID = None
|
||||
OMGWTFNZBS_APIKEY = None
|
||||
|
||||
PREFERRED_WORDS = None
|
||||
IGNORED_WORDS = None
|
||||
REQUIRED_WORDS = None
|
||||
@@ -307,8 +311,9 @@ def initialize():
|
||||
LIBRARYSCAN, LIBRARYSCAN_INTERVAL, DOWNLOAD_SCAN_INTERVAL, UPDATE_DB_INTERVAL, MB_IGNORE_AGE, SAB_HOST, SAB_USERNAME, SAB_PASSWORD, SAB_APIKEY, SAB_CATEGORY, \
|
||||
NZBGET_USERNAME, NZBGET_PASSWORD, NZBGET_CATEGORY, NZBGET_HOST, HEADPHONES_INDEXER, NZBMATRIX, TRANSMISSION_HOST, TRANSMISSION_USERNAME, TRANSMISSION_PASSWORD, \
|
||||
UTORRENT_HOST, UTORRENT_USERNAME, UTORRENT_PASSWORD, NEWZNAB, NEWZNAB_HOST, NEWZNAB_APIKEY, NEWZNAB_ENABLED, EXTRA_NEWZNABS, \
|
||||
NZBSORG, NZBSORG_UID, NZBSORG_HASH, NZBSRUS, NZBSRUS_UID, NZBSRUS_APIKEY, NZB_DOWNLOADER, TORRENT_DOWNLOADER, PREFERRED_WORDS, REQUIRED_WORDS, IGNORED_WORDS, \
|
||||
LASTFM_USERNAME, INTERFACE, FOLDER_PERMISSIONS, FILE_PERMISSIONS, ENCODERFOLDER, ENCODER_PATH, ENCODER, XLDPROFILE, BITRATE, SAMPLINGFREQUENCY, \
|
||||
NZBSORG, NZBSORG_UID, NZBSORG_HASH, NZBSRUS, NZBSRUS_UID, NZBSRUS_APIKEY, OMGWTFNZBS, OMGWTFNZBS_UID, OMGWTFNZBS_APIKEY, \
|
||||
NZB_DOWNLOADER, TORRENT_DOWNLOADER, PREFERRED_WORDS, REQUIRED_WORDS, IGNORED_WORDS, LASTFM_USERNAME, \
|
||||
INTERFACE, FOLDER_PERMISSIONS, FILE_PERMISSIONS, ENCODERFOLDER, ENCODER_PATH, ENCODER, XLDPROFILE, BITRATE, SAMPLINGFREQUENCY, \
|
||||
MUSIC_ENCODER, ADVANCEDENCODER, ENCODEROUTPUTFORMAT, ENCODERQUALITY, ENCODERVBRCBR, ENCODERLOSSLESS, DELETE_LOSSLESS_FILES, \
|
||||
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, \
|
||||
@@ -328,6 +333,7 @@ def initialize():
|
||||
CheckSection('Newznab')
|
||||
CheckSection('NZBsorg')
|
||||
CheckSection('NZBsRus')
|
||||
CheckSection('omgwtfnzbs')
|
||||
CheckSection('Waffles')
|
||||
CheckSection('Rutracker')
|
||||
CheckSection('What.cd')
|
||||
@@ -469,6 +475,10 @@ def initialize():
|
||||
NZBSRUS_UID = check_setting_str(CFG, 'NZBsRus', 'nzbsrus_uid', '')
|
||||
NZBSRUS_APIKEY = check_setting_str(CFG, 'NZBsRus', 'nzbsrus_apikey', '')
|
||||
|
||||
OMGWTFNZBS = bool(check_setting_int(CFG, 'omgwtfnzbs', 'omgwtfnzbs', 0))
|
||||
OMGWTFNZBS_UID = check_setting_str(CFG, 'omgwtfnzbs', 'omgwtfnzbs_uid', '')
|
||||
OMGWTFNZBS_APIKEY = check_setting_str(CFG, 'omgwtfnzbs', 'omgwtfnzbs_apikey', '')
|
||||
|
||||
PREFERRED_WORDS = check_setting_str(CFG, 'General', 'preferred_words', '')
|
||||
IGNORED_WORDS = check_setting_str(CFG, 'General', 'ignored_words', '')
|
||||
REQUIRED_WORDS = check_setting_str(CFG, 'General', 'required_words', '')
|
||||
@@ -848,6 +858,11 @@ def config_write():
|
||||
new_config['NZBsRus']['nzbsrus_uid'] = NZBSRUS_UID
|
||||
new_config['NZBsRus']['nzbsrus_apikey'] = NZBSRUS_APIKEY
|
||||
|
||||
new_config['omgwtfnzbs'] = {}
|
||||
new_config['omgwtfnzbs']['omgwtfnzbs'] = int(OMGWTFNZBS)
|
||||
new_config['omgwtfnzbs']['omgwtfnzbs_uid'] = OMGWTFNZBS_UID
|
||||
new_config['omgwtfnzbs']['omgwtfnzbs_apikey'] = OMGWTFNZBS_APIKEY
|
||||
|
||||
new_config['General']['preferred_words'] = PREFERRED_WORDS
|
||||
new_config['General']['ignored_words'] = IGNORED_WORDS
|
||||
new_config['General']['required_words'] = REQUIRED_WORDS
|
||||
|
||||
@@ -118,7 +118,7 @@ def searchforalbum(albumid=None, new=False, lossless=False):
|
||||
|
||||
for result in results:
|
||||
foundNZB = "none"
|
||||
if (headphones.HEADPHONES_INDEXER or headphones.NEWZNAB or headphones.NZBSORG or headphones.NZBSRUS) and (headphones.SAB_HOST or headphones.BLACKHOLE_DIR or headphones.NZBGET_HOST):
|
||||
if (headphones.HEADPHONES_INDEXER or headphones.NEWZNAB or headphones.NZBSORG or headphones.NZBSRUS or headphones.OMGWTFNZBS) and (headphones.SAB_HOST or headphones.BLACKHOLE_DIR or headphones.NZBGET_HOST):
|
||||
if result['Status'] == "Wanted Lossless":
|
||||
foundNZB = searchNZB(result['AlbumID'], new, losslessOnly=True)
|
||||
else:
|
||||
@@ -135,7 +135,7 @@ def searchforalbum(albumid=None, new=False, lossless=False):
|
||||
|
||||
foundNZB = "none"
|
||||
|
||||
if (headphones.HEADPHONES_INDEXER or headphones.NEWZNAB or headphones.NZBSORG or headphones.NZBSRUS) and (headphones.SAB_HOST or headphones.BLACKHOLE_DIR or headphones.NZBGET_HOST):
|
||||
if (headphones.HEADPHONES_INDEXER or headphones.NEWZNAB or headphones.NZBSORG or headphones.NZBSRUS or headphones.OMGWTFNZBS) and (headphones.SAB_HOST or headphones.BLACKHOLE_DIR or headphones.NZBGET_HOST):
|
||||
foundNZB = searchNZB(albumid, new, lossless)
|
||||
|
||||
if (headphones.KAT or headphones.PIRATEBAY or headphones.ISOHUNT or headphones.MININOVA or headphones.WAFFLES or headphones.RUTRACKER or headphones.WHATCD) and foundNZB == "none":
|
||||
@@ -439,6 +439,65 @@ def searchNZB(albumid=None, new=False, losslessOnly=False):
|
||||
except Exception, e:
|
||||
logger.error(u"An unknown error occurred trying to parse the feed: %s" % e)
|
||||
|
||||
|
||||
if headphones.OMGWTFNZBS:
|
||||
|
||||
provider = "omgwtfnzbs"
|
||||
|
||||
if headphones.PREFERRED_QUALITY == 3 or losslessOnly:
|
||||
categories = "22"
|
||||
elif headphones.PREFERRED_QUALITY:
|
||||
categories = "22,7"
|
||||
else:
|
||||
categories = "7"
|
||||
|
||||
if albums['Type'] == 'Other':
|
||||
categories = "29"
|
||||
logger.info("Album type is audiobook/spokenword. Searching all music categories")
|
||||
|
||||
params = { "user": headphones.OMGWTFNZBS_UID,
|
||||
"api": headphones.OMGWTFNZBS_APIKEY,
|
||||
"catid": categories,
|
||||
"retention": headphones.USENET_RETENTION,
|
||||
"search": term
|
||||
}
|
||||
|
||||
searchURL = 'http://api.omgwtfnzbs.org/json/?' + urllib.urlencode(params)
|
||||
|
||||
# Add a user-agent
|
||||
request = urllib2.Request(searchURL)
|
||||
request.add_header('User-Agent', 'headphones/0.0 +https://github.com/rembo10/headphones')
|
||||
opener = urllib2.build_opener()
|
||||
|
||||
logger.info(u'Parsing results from <a href="%s">omgwtfnzbs</a>' % searchURL)
|
||||
|
||||
try:
|
||||
data = opener.open(request).read()
|
||||
except Exception, e:
|
||||
logger.warn('Error fetching data from omgwtfnzbs: %s' % e)
|
||||
data = False
|
||||
|
||||
if data:
|
||||
|
||||
d = json.loads(data)
|
||||
|
||||
if 'notice' in data:
|
||||
logger.info(u"No results returned from omgwtfnzbs: %s" % d['notice'])
|
||||
pass
|
||||
|
||||
else:
|
||||
for item in d:
|
||||
try:
|
||||
url = item['getnzb']
|
||||
title = item['release']
|
||||
size = int(item['sizebytes'])
|
||||
|
||||
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 results: %s" % e)
|
||||
|
||||
# attempt to verify that this isn't a substring result
|
||||
# when looking for "Foo - Foo" we don't want "Foobar"
|
||||
# this should be less of an issue when it isn't a self-titled album so we'll only check vs artist
|
||||
|
||||
@@ -859,6 +859,9 @@ class WebInterface(object):
|
||||
"use_nzbsrus" : checked(headphones.NZBSRUS),
|
||||
"nzbsrus_uid" : headphones.NZBSRUS_UID,
|
||||
"nzbsrus_apikey" : headphones.NZBSRUS_APIKEY,
|
||||
"use_omgwtfnzbs" : checked(headphones.OMGWTFNZBS),
|
||||
"omgwtfnzbs_uid" : headphones.OMGWTFNZBS_UID,
|
||||
"omgwtfnzbs_apikey" : headphones.OMGWTFNZBS_APIKEY,
|
||||
"preferred_words" : headphones.PREFERRED_WORDS,
|
||||
"ignored_words" : headphones.IGNORED_WORDS,
|
||||
"required_words" : headphones.REQUIRED_WORDS,
|
||||
@@ -972,7 +975,7 @@ class WebInterface(object):
|
||||
download_scan_interval=None, update_db_interval=None, mb_ignore_age=None, nzb_search_interval=None, libraryscan_interval=None, sab_host=None, sab_username=None, sab_apikey=None, sab_password=None,
|
||||
sab_category=None, nzbget_host=None, nzbget_username=None, nzbget_password=None, nzbget_category=None, transmission_host=None, transmission_username=None, transmission_password=None,
|
||||
utorrent_host=None, utorrent_username=None, utorrent_password=None, nzb_downloader=0, torrent_downloader=0, download_dir=None, blackhole_dir=None, usenet_retention=None,
|
||||
use_headphones_indexer=0, 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,
|
||||
use_headphones_indexer=0, 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, omgwtfnzbs=0, omgwtfnzbs_uid=None, omgwtfnzbs_apikey=None,
|
||||
preferred_words=None, required_words=None, ignored_words=None, preferred_quality=0, preferred_bitrate=None, detect_bitrate=0, move_files=0, torrentblackhole_dir=None, download_torrent_dir=None,
|
||||
numberofseeders=None, use_piratebay=0, piratebay_proxy_url=None, 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, album_art_format=None, embed_album_art=0, embed_lyrics=0,
|
||||
@@ -1031,6 +1034,9 @@ class WebInterface(object):
|
||||
headphones.NZBSRUS = nzbsrus
|
||||
headphones.NZBSRUS_UID = nzbsrus_uid
|
||||
headphones.NZBSRUS_APIKEY = nzbsrus_apikey
|
||||
headphones.OMGWTFNZBS = omgwtfnzbs
|
||||
headphones.OMGWTFNZBS_UID = omgwtfnzbs_uid
|
||||
headphones.OMGWTFNZBS_APIKEY = omgwtfnzbs_apikey
|
||||
headphones.PREFERRED_WORDS = preferred_words
|
||||
headphones.IGNORED_WORDS = ignored_words
|
||||
headphones.REQUIRED_WORDS = required_words
|
||||
|
||||
Reference in New Issue
Block a user