Initial changes to get NZBget working alongside sab & blackhole (mostly UI change, but updated logic

This commit is contained in:
rembo10
2013-07-06 01:01:59 +05:30
parent d41ee52af3
commit ad079e9ac9
3 changed files with 86 additions and 55 deletions
+71 -40
View File
@@ -104,9 +104,12 @@
<div id="tabs-2">
<table class="configtable" summary="Download Settings">
<tr>
<td>
<fieldset>
<legend>SABnzbd</legend>
<td>
<fieldset>
<legend>Usenet</legend>
<input type="radio" name="nzb_downloader" id="nzb_downloader_sabnzbd" value="0" ${config['nzb_downloader_sabnzbd']}>Sabnzbd <input type="radio" name="nzb_downloader" id="nzb_downloader_nzbget" value="1" ${config['nzb_downloader_nzbget']}> NZBget <input type="radio" name="nzb_downloader" id="nzb_downloader_blackhole" value="2" ${config['nzb_downloader_blackhole']}> Blackhole
</fieldset>
<fieldset id="sabnzbd_options">
<div class="row">
<label>SABnzbd Host:</label>
<input type="text" name="sab_host" value="${config['sab_host']}" size="30">
@@ -116,7 +119,7 @@
<label>SABnzbd Username</label>
<input type="text" name="sab_username" value="${config['sab_user']}" size="20">
</div>
<div class="row">
<div class="row">
<label>SABnzbd Password:</label>
<input type="password" name="sab_password" value="${config['sab_pass']}" size="20">
</div>
@@ -128,20 +131,9 @@
<label>SABnzbd Category:</label>
<input type="text" name="sab_category" value="${config['sab_cat']}" size="20">
</div>
</fieldset>
<fieldset>
<legend>Downloads</legend>
<div class="row">
<label>Music Download Directory:</label>
<input type="text" name="download_dir" value="${config['download_dir']}" size="50">
<small>Full path where SAB or NZBget downloads your music. e.g. /Users/name/Downloads/music</small>
</div>
</fieldset>
</td>
</fieldset>
<td>
<fieldset>
<legend>NZBget</legend>
<fieldset id="nzbget_options">
<div class="row">
<label>NZBget Host:</label>
<input type="text" name="nzbget_host" value="${config['nzbget_host']}" size="30">
@@ -151,7 +143,7 @@
<label>NZBget Username</label>
<input type="text" name="nzbget_username" value="${config['nzbget_user']}" size="20">
</div>
<div class="row">
<div class="row">
<label>NZBget Password:</label>
<input type="password" name="nzbget_password" value="${config['nzbget_pass']}" size="20">
</div>
@@ -160,8 +152,27 @@
<input type="text" name="nzbget_category" value="${config['nzbget_cat']}" size="20">
</div>
</fieldset>
</td>
<fieldset id="nzb_download_dir">
<div class="row">
<label>Music Download Directory:</label>
<input type="text" name="download_dir" value="${config['download_dir']}" size="50">
<small>Full path where SAB or NZBget downloads your music. e.g. /Users/name/Downloads/music</small>
</div>
</fieldset>
<fieldset id="blackhole_options">
<div class="row">
<label>Black Hole Directory</label>
<input type="text" name="blackhole_dir" value="${config['blackhole_dir']}" size="50">
<small>Folder your Download program watches for NZBs</small>
</div>
</fieldset>
<div class="checkbox row">
<input type="text" name="usenet_retention" value="${config['usenet_retention']}" size="5"><label>Usenet Retention</label>
</div>
</td>
<td>
<fieldset>
<legend>Torrents</legend>
@@ -185,22 +196,6 @@
<input type="checkbox" name="keep_torrent_files" value="1" ${config['keep_torrent_files']}>
</div>
</fieldset>
<fieldset>
<legend>Usenet</legend>
<div class="row checkbox">
<input id="useblackhole" type="checkbox" name="blackhole" value=1 ${config['use_blackhole']} /><label>Use Black Hole</label>
</div>
<div class="config">
<div class="row">
<label>Black Hole Directory</label>
<input type="text" name="blackhole_dir" value="${config['blackhole_dir']}" size="50">
<small>Folder your Download program watches for NZBs</small>
</div>
</div>
<div class="checkbox row">
<input type="text" name="usenet_retention" value="${config['usenet_retention']}" size="5"><label>Usenet Retention</label>
</div>
</fieldset>
</td>
</tr>
@@ -367,9 +362,9 @@
<fieldset>
<legend>Quality</legend>
<div class="row radio clearfix">
<input type="radio" name="preferred_quality" value="0" ${config['pref_qual_0']} /><label>Highest Quality excluding Lossless</label>
<input type="radio" name="preferred_quality" value="1" ${config['pref_qual_1']} /><label>Highest Quality including Lossless</label>
<input type="radio" name="preferred_quality" value="3" ${config['pref_qual_3']} /><label>Lossless Only</label>
<input type="radio" name="preferred_quality" id="preferred_quality0" value="0" ${config['pref_qual_0']} /><label>Highest Quality excluding Lossless</label>
<input type="radio" name="preferred_quality" id="preferred_quality1" value="1" ${config['pref_qual_1']} /><label>Highest Quality including Lossless</label>
<input type="radio" name="preferred_quality" id="preferred_quality3" value="3" ${config['pref_qual_3']} /><label>Lossless Only</label>
<input type="radio" id="preferred_bitrate" name="preferred_quality" value="2" ${config['pref_qual_2']} />Preferred Bitrate: <input type="text" class="override-float" name="preferred_bitrate" value="${config['pref_bitrate']}" size="3">kbps<br>
<div id="preferred_bitrate_options">
Reject if <strong>less than</strong> <input type="text" class="override-float" name="preferred_bitrate_low_buffer" value="${config['pref_bitrate_low']}" size="3">% or <strong>more than</strong> <input type="text" class="override-float" name="preferred_bitrate_high_buffer" value="${config['pref_bitrate_high']}" size="3">% of the target size (leave blank for no limit)<br><br>
@@ -1042,16 +1037,52 @@
{
$("#preferred_bitrate_options").hide();
}
if ($("#nzb_downloader_sabnzbd").is(":checked"))
{
$("#sabnzbd_options,#nzb_download_dir").show();
$("#nzbget_options,#blackhole_options").hide();
}
if ($("#nzb_downloader_nzbget").is(":checked"))
{
$("#sabnzbd_options,#blackhole_options").hide();
$("#nzbget_options,#nzb_download_dir").show();
}
if ($("#nzb_downloader_blackhole").is(":checked"))
{
$("#sabnzbd_options,#nzbget_options,#nzb_download_dir").hide();
$("#blackhole_options").show();
}
$('input[type=radio]').change(function(){
if ($("#preferred_bitrate").is(":checked"))
{
$("#preferred_bitrate_options").slideDown("fast");
}
else
if ($("#preferred_quality0").is(":checked"))
{
$("#preferred_bitrate_options").slideUp("fast");
}
if ($("#preferred_quality1").is(":checked"))
{
$("#preferred_bitrate_options").slideUp("fast");
}
if ($("#preferred_quality3").is(":checked"))
{
$("#preferred_bitrate_options").slideUp("fast");
}
if ($("#nzb_downloader_sabnzbd").is(":checked"))
{
$("#nzbget_options,#blackhole_options").fadeOut("fast", function() { $("#sabnzbd_options,#nzb_download_dir").fadeIn() });
}
if ($("#nzb_downloader_nzbget").is(":checked"))
{
$("#sabnzbd_options,#blackhole_options").fadeOut("fast", function() { $("#nzbget_options,#nzb_download_dir").fadeIn() });
}
if ($("#nzb_downloader_blackhole").is(":checked"))
{
$("#sabnzbd_options,#nzbget_options,#nzb_download_dir").fadeOut("fast", function() { $("#blackhole_options").fadeIn() });
}
});
$("#mirror").change(handleNewServerSelection);
+10 -2
View File
@@ -109,6 +109,7 @@ ADD_ALBUM_ART = False
ALBUM_ART_FORMAT = None
EMBED_ALBUM_ART = False
EMBED_LYRICS = False
NZB_DOWNLOADER = None
DOWNLOAD_DIR = None
BLACKHOLE = None
BLACKHOLE_DIR = None
@@ -294,7 +295,7 @@ def initialize():
LIBRARYSCAN, LIBRARYSCAN_INTERVAL, DOWNLOAD_SCAN_INTERVAL, SAB_HOST, SAB_USERNAME, SAB_PASSWORD, SAB_APIKEY, SAB_CATEGORY, \
NZBGET_USERNAME, NZBGET_PASSWORD, NZBGET_CATEGORY, NZBGET_HOST, 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, NZBX, \
PREFERRED_WORDS, REQUIRED_WORDS, IGNORED_WORDS, \
NZB_DOWNLOADER, PREFERRED_WORDS, REQUIRED_WORDS, IGNORED_WORDS, \
LASTFM_USERNAME, INTERFACE, FOLDER_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, \
@@ -375,6 +376,7 @@ def initialize():
ALBUM_ART_FORMAT = check_setting_str(CFG, 'General', 'album_art_format', 'folder')
EMBED_ALBUM_ART = bool(check_setting_int(CFG, 'General', 'embed_album_art', 0))
EMBED_LYRICS = bool(check_setting_int(CFG, 'General', 'embed_lyrics', 0))
NZB_DOWNLOADER = check_setting_int(CFG, 'General', 'nzb_downloader', 0)
DOWNLOAD_DIR = check_setting_str(CFG, 'General', 'download_dir', '')
BLACKHOLE = bool(check_setting_int(CFG, 'General', 'blackhole', 0))
BLACKHOLE_DIR = check_setting_str(CFG, 'General', 'blackhole_dir', '')
@@ -552,6 +554,12 @@ def initialize():
if ENCODERFOLDER:
ENCODER_PATH = os.path.join(ENCODERFOLDER, ENCODER)
CONFIG_VERSION = '3'
if CONFIG_VERSION == '3':
#Update the BLACKHOLE option to the NZB_DOWNLOADER format
if BLACKHOLE:
NZB_DOWNLOADER = 2
CONFIG_VERSION = '4'
if not LOG_DIR:
LOG_DIR = os.path.join(DATA_DIR, 'logs')
@@ -712,8 +720,8 @@ def config_write():
new_config['General']['album_art_format'] = ALBUM_ART_FORMAT
new_config['General']['embed_album_art'] = int(EMBED_ALBUM_ART)
new_config['General']['embed_lyrics'] = int(EMBED_LYRICS)
new_config['General']['nzb_downloader'] = NZB_DOWNLOADER
new_config['General']['download_dir'] = DOWNLOAD_DIR
new_config['General']['blackhole'] = int(BLACKHOLE)
new_config['General']['blackhole_dir'] = BLACKHOLE_DIR
new_config['General']['usenet_retention'] = USENET_RETENTION
new_config['General']['include_extras'] = int(INCLUDE_EXTRAS)
+5 -13
View File
@@ -579,13 +579,13 @@ class WebInterface(object):
"nzbget_user" : headphones.NZBGET_USERNAME,
"nzbget_pass" : headphones.NZBGET_PASSWORD,
"nzbget_cat" : headphones.NZBGET_CATEGORY,
"nzb_downloader_sabnzbd" : radio(headphones.NZB_DOWNLOADER, 0),
"nzb_downloader_nzbget" : radio(headphones.NZB_DOWNLOADER, 1),
"nzb_downloader_blackhole" : radio(headphones.NZB_DOWNLOADER, 2),
"download_dir" : headphones.DOWNLOAD_DIR,
"use_blackhole" : checked(headphones.BLACKHOLE),
"blackhole_dir" : headphones.BLACKHOLE_DIR,
"usenet_retention" : headphones.USENET_RETENTION,
# "use_nzbmatrix" : checked(headphones.NZBMATRIX),
# "nzbmatrix_user" : headphones.NZBMATRIX_USERNAME,
# "nzbmatrix_api" : headphones.NZBMATRIX_APIKEY,
"use_newznab" : checked(headphones.NEWZNAB),
"newznab_host" : headphones.NEWZNAB_HOST,
"newznab_api" : headphones.NEWZNAB_APIKEY,
@@ -594,9 +594,6 @@ class WebInterface(object):
"use_nzbsorg" : checked(headphones.NZBSORG),
"nzbsorg_uid" : headphones.NZBSORG_UID,
"nzbsorg_hash" : headphones.NZBSORG_HASH,
# "use_newzbin" : checked(headphones.NEWZBIN),
# "newzbin_uid" : headphones.NEWZBIN_UID,
# "newzbin_pass" : headphones.NEWZBIN_PASSWORD,
"use_nzbsrus" : checked(headphones.NZBSRUS),
"nzbsrus_uid" : headphones.NZBSRUS_UID,
"nzbsrus_apikey" : headphones.NZBSRUS_APIKEY,
@@ -708,7 +705,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,
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, nzbget_host=None, nzbget_username='nzbget', nzbget_password=None, nzbget_category=None, download_dir=None, blackhole=0, blackhole_dir=None, usenet_retention=None, newznab=0, newznab_host=None, newznab_apikey=None,
sab_category=None, nzbget_host=None, nzbget_username='nzbget', nzbget_password=None, nzbget_category=None, nzb_downloader=0, 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, nzbx=0, 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=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,
@@ -740,13 +737,11 @@ class WebInterface(object):
headphones.NZBGET_USERNAME = nzbget_username
headphones.NZBGET_PASSWORD = nzbget_password
headphones.NZBGET_CATEGORY = nzbget_category
headphones.NZB_DOWNLOADER = int(nzb_downloader)
headphones.DOWNLOAD_DIR = download_dir
headphones.BLACKHOLE = blackhole
headphones.BLACKHOLE_DIR = blackhole_dir
headphones.USENET_RETENTION = usenet_retention
# headphones.NZBMATRIX = nzbmatrix
# headphones.NZBMATRIX_USERNAME = nzbmatrix_username
# headphones.NZBMATRIX_APIKEY = nzbmatrix_apikey
headphones.NEWZNAB = newznab
headphones.NEWZNAB_HOST = newznab_host
headphones.NEWZNAB_APIKEY = newznab_apikey
@@ -754,9 +749,6 @@ class WebInterface(object):
headphones.NZBSORG = nzbsorg
headphones.NZBSORG_UID = nzbsorg_uid
headphones.NZBSORG_HASH = nzbsorg_hash
# headphones.NEWZBIN = newzbin
# headphones.NEWZBIN_UID = newzbin_uid
# headphones.NEWZBIN_PASSWORD = newzbin_password
headphones.NZBSRUS = nzbsrus
headphones.NZBSRUS_UID = nzbsrus_uid
headphones.NZBSRUS_APIKEY = nzbsrus_apikey