Added xld option to config page

This commit is contained in:
rembo10
2012-10-30 16:38:01 -04:00
parent 6eab3b47e4
commit 705b56c696
4 changed files with 69 additions and 28 deletions

View File

@@ -417,7 +417,7 @@
<fieldset>
<legend>Re-Encoding Options</legend>
<small class="heading"><span style="float: left; margin-right: .3em; margin-top: 4px;" class="ui-icon ui-icon-info"></span>Note: this option requires the lame or ffmpeg encoder</small>
<small class="heading"><span style="float: left; margin-right: .3em; margin-top: 4px;" class="ui-icon ui-icon-info"></span>Note: this option requires the lame, ffmpeg or xld encoder</small>
<div class="checkbox row clearfix">
<input type="checkbox" name="music_encoder" id="music_encoder" value="1" ${config['music_encoder']}/><label>Re-encode downloads during postprocessing</label>
</div>
@@ -434,35 +434,42 @@
if config['encoder'] == 'lame':
lameselect = 'selected="selected"'
ffmpegselect = ''
else:
xldselect = ''
elif config['encoder'] == 'ffmpeg':
lameselect = ''
ffmpegselect = 'selected="selected"'
xldselect = ''
else:
lameselect = ''
ffmpegselect = ''
xldselect = 'selected="selected"'
%>
<div class="row">
<label>Encoder</label>
<select name="encoder">
<select name="encoder" id="encoder">
<option value="lame" ${lameselect}>lame</option>
<option value="ffmpeg" ${ffmpegselect}>ffmpeg</option>
<option value="xld" ${xldselect}>xld</option>
</select>
</div>
<div class="row">
<label>Format</label>
<select name="encoderoutputformat">
%for x in ['mp3', 'ogg', 'm4a']:
<%
if config['encoderoutputformat'] == x:
outputselect = 'selected'
else:
outputselect = ''
%>
<option value=${x} ${outputselect}>${x}</option>
%endfor
</select>
</div>
</fieldset>
<div id="lameffmpegproperties">
<fieldset>
<legend>Audio Properties</legend>
<div class="row">
<label>Format</label>
<select name="encoderoutputformat">
%for x in ['mp3', 'ogg', 'm4a']:
<%
if config['encoderoutputformat'] == x:
outputselect = 'selected'
else:
outputselect = ''
%>
<option value=${x} ${outputselect}>${x}</option>
%endfor
</select>
</div>
<div class="row">
<label>VBR/CBR</label>
<select name="encodervbrcbr">
@@ -536,7 +543,12 @@
</div>
</fieldset>
</div>
<div id="xldproperties">
<div class="row">
<label>XLD Profile</label>
<input type="text" name="xldprofile" value="${config['xldprofile']}" size="43">
</div>
</td>
<td>
@@ -760,7 +772,12 @@
$("#hpserveroptions").slideUp();
};
handleNewSelection = function () {
hideEncoderDivs = function () {
$("#lameffmpegproperties").slideUp();
$("#xldproperties").slideUp();
};
handleNewServerSelection = function () {
hideServerDivs();
@@ -774,6 +791,23 @@
}
};
handleNewEncoderSelection = function () {
hideEncoderDivs();
switch ($(this).val()) {
case 'xld':
$("#xldproperties").slideDown();
break;
case 'ffmpeg':
$("#lameffmpegproperties").slideDown();
break;
case 'lame':
$("#lameffmpegproperties").slideDown();
break;
}
};
function openExtrasDialog() {
$("#dialog").dialog({ close: function(){
var elem = '<input type="button" data-success="Changes saved successfully">';
@@ -914,8 +948,11 @@
}
});
$("#mirror").change(handleNewSelection);
handleNewSelection.apply($("#mirror"));
$("#mirror").change(handleNewServerSelection);
handleNewServerSelection.apply($("#mirror"));
$("#encoder").change(handleNewEncoderSelection);
handleNewEncoderSelection.apply($("#encoder"));
var deletedNewznabs = 0;

View File

@@ -168,6 +168,7 @@ FOLDER_PERMISSIONS = None
MUSIC_ENCODER = False
ENCODERFOLDER = None
ENCODER = None
XLDPROFILE = None
BITRATE = None
SAMPLINGFREQUENCY = None
ADVANCEDENCODER = None
@@ -261,7 +262,7 @@ def initialize():
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,\
NZBSORG, NZBSORG_UID, NZBSORG_HASH, NEWZBIN, NEWZBIN_UID, NEWZBIN_PASSWORD, LASTFM_USERNAME, INTERFACE, FOLDER_PERMISSIONS, \
ENCODERFOLDER, ENCODER, BITRATE, SAMPLINGFREQUENCY, MUSIC_ENCODER, ADVANCEDENCODER, ENCODEROUTPUTFORMAT, ENCODERQUALITY, \
ENCODERFOLDER, ENCODER, XLDPROFILE, BITRATE, SAMPLINGFREQUENCY, MUSIC_ENCODER, ADVANCEDENCODER, ENCODEROUTPUTFORMAT, ENCODERQUALITY, \
ENCODERVBRCBR, ENCODERLOSSLESS, DELETE_LOSSLESS_FILES, PROWL_ENABLED, PROWL_PRIORITY, PROWL_KEYS, PROWL_ONSNATCH, MIRRORLIST, \
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, \
@@ -397,6 +398,7 @@ def initialize():
ENCODERFOLDER = check_setting_str(CFG, 'General', 'encoderfolder', '')
ENCODER = check_setting_str(CFG, 'General', 'encoder', 'ffmpeg')
XLDPROFILE = check_setting_str(CFG, 'General', 'xldprofile', '')
BITRATE = check_setting_int(CFG, 'General', 'bitrate', 192)
SAMPLINGFREQUENCY= check_setting_int(CFG, 'General', 'samplingfrequency', 44100)
MUSIC_ENCODER = bool(check_setting_int(CFG, 'General', 'music_encoder', 0))
@@ -723,6 +725,7 @@ def config_write():
new_config['General']['music_encoder'] = int(MUSIC_ENCODER)
new_config['General']['encoder'] = ENCODER
new_config['General']['xldprofile'] = XLDPROFILE
new_config['General']['bitrate'] = int(BITRATE)
new_config['General']['samplingfrequency'] = int(SAMPLINGFREQUENCY)
new_config['General']['encoderfolder'] = ENCODERFOLDER

View File

@@ -29,8 +29,7 @@ except ImportError:
# xld
if headphones.ADVANCEDENCODER.lower().startswith('xld'):
XLDPROFILE = headphones.ADVANCEDENCODER[4:]
if headphones.ENCODER == 'xld':
import getXldProfile
XLD = True
else:
@@ -42,7 +41,7 @@ def encode(albumPath):
if XLD:
global xldProfile
(xldProfile, xldFormat, xldBitrate) = getXldProfile.getXldProfile(XLDPROFILE)
(xldProfile, xldFormat, xldBitrate) = getXldProfile.getXldProfile(headphones.XLDPROFILE)
if not xldFormat:
logger.error(u'Details for xld profile "%s" not found, will not be reencoded' % (xldProfile))
return None

View File

@@ -623,6 +623,7 @@ class WebInterface(object):
"interface_list" : interface_list,
"music_encoder": checked(headphones.MUSIC_ENCODER),
"encoder": headphones.ENCODER,
"xldprofile": headphones.XLDPROFILE,
"bitrate": int(headphones.BITRATE),
"encoderfolder": headphones.ENCODERFOLDER,
"advancedencoder": headphones.ADVANCEDENCODER,
@@ -683,8 +684,8 @@ class WebInterface(object):
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,
destination_dir=None, lossless_destination_dir=None, folder_format=None, file_format=None, include_extras=0, single=0, ep=0, compilation=0, soundtrack=0, live=0,
remix=0, spokenword=0, audiobook=0, autowant_upcoming=False, autowant_all=False, interface=None, log_dir=None, cache_dir=None, music_encoder=0, encoder=None, bitrate=None,
samplingfrequency=None, encoderfolder=None, advancedencoder=None, encoderoutputformat=None, encodervbrcbr=None, encoderquality=None, encoderlossless=0,
remix=0, spokenword=0, audiobook=0, autowant_upcoming=False, autowant_all=False, interface=None, log_dir=None, cache_dir=None, music_encoder=0, encoder=None, xldprofile=None,
bitrate=None, samplingfrequency=None, encoderfolder=None, advancedencoder=None, encoderoutputformat=None, encodervbrcbr=None, encoderquality=None, encoderlossless=0,
delete_lossless_files=0, prowl_enabled=0, prowl_onsnatch=0, prowl_keys=None, prowl_priority=0, xbmc_enabled=0, xbmc_host=None, xbmc_username=None, xbmc_password=None,
xbmc_update=0, xbmc_notify=0, nma_enabled=False, nma_apikey=None, nma_priority=0, nma_onsnatch=0, synoindex_enabled=False, mirror=None, customhost=None, customport=None,
customsleep=None, hpuser=None, hppass=None, preferred_bitrate_high_buffer=None, preferred_bitrate_low_buffer=None, cache_sizemb=0, **kwargs):
@@ -760,6 +761,7 @@ class WebInterface(object):
headphones.CACHE_DIR = cache_dir
headphones.MUSIC_ENCODER = music_encoder
headphones.ENCODER = encoder
headphones.XLDPROFILE = xldprofile
headphones.BITRATE = int(bitrate)
headphones.SAMPLINGFREQUENCY = int(samplingfrequency)
headphones.ENCODERFOLDER = encoderfolder