Added jquery hide/show to encoding options, fixed options resetting to default

This commit is contained in:
Remy
2011-08-25 17:41:23 -07:00
parent 56a1e80fef
commit dba0de76e3
4 changed files with 79 additions and 19 deletions

View File

@@ -260,12 +260,13 @@
<tr>
<td>
<h2>Re-Encoding Options:</h2>
<br>
<h3><input type="checkbox" name="encode" value="1" ${config['encode']}/> Re-encode downloads during postprocessing</h3>
<i class="smalltext">Note: this option requires the lame or ffmpeg encoder</i>
<br>
<h3><input type="checkbox" name="encoderlossless" value="1" ${config['encoderlossless']}/> Re-encode only LossLess format (.flac)</h3>
<br><br>
<br><br>
<h3><input type="checkbox" name="encode" id="encode" value="1" ${config['encode']}/> Re-encode downloads during postprocessing</h3>
<br>
<div id="encoderoptions">
<h4><input type="checkbox" name="encoderlossless" value="1" ${config['encoderlossless']}/> Only re-encode lossless files (.flac)</h4>
<br>
<%
if config['encoder'] == 'lame':
lameselect = 'selected="selected"'
@@ -345,13 +346,14 @@
</select></h4>
<br>
<br>
<h3>Advance Encode Options:</h3>
<h3>Advanced Encoding Options:</h3>
<h4>
(ignores audio properties)
</h4>
<input type="text" name="advancedencoder" value="${config['advancedencoder']}" size="43">
<br>
<h3>Path to Encoder:</h3><input type="text" name="encoderfolder" value="${config['encoderfolder']}" size="43">
</div>
</td>
</tr>
</table>
@@ -361,3 +363,30 @@
(Web Interface changes require a restart to take effect)</h3>
</form>
</%def>
<%def name="javascriptIncludes()">
<script>
$(document).ready(function()
{
if ($("#encode").is(":checked"))
{
$("#encoderoptions").show();
}
else
{
$("#encoderoptions").hide();
}
$("#encode").click(function(){
if ($("#encode").is(":checked"))
{
$("#encoderoptions").show("fast");
}
else
{
$("#encoderoptions").hide("fast");
}
});
});
</script>
</%def>

View File

@@ -260,12 +260,13 @@
<tr>
<td>
<h2>Re-Encoding Options:</h2>
<br>
<h3><input type="checkbox" name="encode" value="1" ${config['encode']}/> Re-encode downloads during postprocessing</h3>
<i class="smalltext">Note: this option requires the lame or ffmpeg encoder</i>
<br>
<h3><input type="checkbox" name="encoderlossless" value="1" ${config['encoderlossless']}/> Re-encode only LossLess format (.flac)</h3>
<br><br>
<br><br>
<h3><input type="checkbox" name="encode" id="encode" value="1" ${config['encode']}/> Re-encode downloads during postprocessing</h3>
<br>
<div id="encoderoptions">
<h4><input type="checkbox" name="encoderlossless" value="1" ${config['encoderlossless']}/> Only re-encode lossless files (.flac)</h4>
<br>
<%
if config['encoder'] == 'lame':
lameselect = 'selected="selected"'
@@ -291,6 +292,7 @@
%endfor
</select></h4>
<br>
<h3>Audio Properties:</h3>
<br>
<h4>VBR/CBR: <select name="encodervbrcbr">
@@ -344,12 +346,14 @@
</select></h4>
<br>
<br>
<h3>Advance Encode Options:</h3>
<h3>Advanced Encoding Options:</h3>
<h4>
(ignores audio properties)
</h4>
<input type="text" name="advancedencoder" value="${config['advancedencoder']}" size="43"><br>
<input type="text" name="advancedencoder" value="${config['advancedencoder']}" size="43">
<br>
<h3>Path to Encoder:</h3><input type="text" name="encoderfolder" value="${config['encoderfolder']}" size="43">
</div>
</td>
</tr>
</table>
@@ -359,3 +363,30 @@
(Web Interface changes require a restart to take effect)</h3>
</form>
</%def>
<%def name="javascriptIncludes()">
<script>
$(document).ready(function()
{
if ($("#encode").is(":checked"))
{
$("#encoderoptions").show();
}
else
{
$("#encoderoptions").hide();
}
$("#encode").click(function(){
if ($("#encode").is(":checked"))
{
$("#encoderoptions").show("fast");
}
else
{
$("#encoderoptions").hide("fast");
}
});
});
</script>
</%def>

View File

@@ -122,7 +122,7 @@ ADVANCEDENCODER = None
ENCODEROUTPUTFORMAT = None
ENCODERQUALITY = None
ENCODERVBRCBR = None
ENCODERLOSSLESS = True
ENCODERLOSSLESS = False
def CheckSection(sec):
""" Check if INI section exists, if not create it """
@@ -182,7 +182,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, \
NZBSORG, NZBSORG_UID, NZBSORG_HASH, NEWZBIN, NEWZBIN_UID, NEWZBIN_PASSWORD, LASTFM_USERNAME, INTERFACE, FOLDER_PERMISSIONS, \
ENCODERFOLDER, ENCODER, BITRATE, SAMPLINGFREQUENCY, ENCODE, ADVANCEDENCODER, ENCODEROUTPUTFORMAT, ENCODERQUALITY, ENCODERVBRVBR, \
ENCODERFOLDER, ENCODER, BITRATE, SAMPLINGFREQUENCY, ENCODE, ADVANCEDENCODER, ENCODEROUTPUTFORMAT, ENCODERQUALITY, ENCODERVBRCBR, \
ENCODERLOSSLESS
if __INITIALIZED__:
@@ -272,7 +272,7 @@ def initialize():
ENCODE = bool(check_setting_int(CFG, 'General', 'encode', 0))
ADVANCEDENCODER = check_setting_str(CFG, 'General', 'advancedencoder', '')
ENCODEROUTPUTFORMAT = check_setting_str(CFG, 'General', 'encoderoutputformat', 'mp3')
ENCODERQUALITY = check_setting_int(CFG, 'General', 'vorbisquality', 5)
ENCODERQUALITY = check_setting_int(CFG, 'General', 'encoderquality', 2)
ENCODERVBRCBR = check_setting_str(CFG, 'General', 'encodervbrcbr', 'cbr')
ENCODERLOSSLESS = bool(check_setting_int(CFG, 'General', 'encoderlossless', 1))

View File

@@ -357,9 +357,9 @@ class WebInterface(object):
"encoderfolder": headphones.ENCODERFOLDER,
"advancedencoder": headphones.ADVANCEDENCODER,
"encoderoutputformat": headphones.ENCODEROUTPUTFORMAT,
"samplingfrequency": int(headphones.SAMPLINGFREQUENCY),
"encodervbrcbr": (headphones.ENCODERVBRCBR),
"encoderquality": int(headphones.ENCODERQUALITY),
"samplingfrequency": headphones.SAMPLINGFREQUENCY,
"encodervbrcbr": headphones.ENCODERVBRCBR,
"encoderquality": headphones.ENCODERQUALITY,
"encoderlossless": checked(headphones.ENCODERLOSSLESS)
}
return serve_template(templatename="config.html", title="Settings", config=config)