Fix Add and Edit show quality selection when Quality 'Custom' is used.

This commit is contained in:
JackDandy 2015-09-29 14:17:58 +01:00
parent 639fa044ae
commit 912134723d
3 changed files with 21 additions and 18 deletions

View file

@ -46,6 +46,7 @@
* Fix Episode View KeyError: 'state-title' failure for shows without a runtime
* Update py-unrar2 library 99.3 to 99.6 (2fe1e98)
* Fix py-unrar2 on unix to handle different date formats output by different unrar command line versions
* Fix Add and Edit show quality selection when Quality 'Custom' is used
[develop changelog]
Enable Alpha Ratio again now that the secure login page over https is fixed

View file

@ -64,7 +64,7 @@
<div class="manageCustom pull-left">
<h4 style="font-size:14px">Initial</h4>
#set $anyQualityList = filter(lambda x: x > $common.Quality.NONE, $common.Quality.qualityStrings)
<select id="anyQualities" name="anyQualities" multiple="multiple" size="len($anyQualityList)">
<select id="anyQualities" name="anyQualities" multiple="multiple" size="$len($anyQualityList)">
#for $curQuality in sorted($anyQualityList):
<option value="$curQuality" #if $curQuality in $anyQualities then $selected else ''#>$common.Quality.qualityStrings[$curQuality]</option>
#end for
@ -73,7 +73,7 @@
<div class="manageCustom pull-left">
<h4 style="font-size:14px">Upgrade to</h4>
#set $bestQualityList = filter(lambda x: x > $common.Quality.SDTV, $common.Quality.qualityStrings)
<select id="bestQualities" name="bestQualities" multiple="multiple" size="len($bestQualityList)">
<select id="bestQualities" name="bestQualities" multiple="multiple" size="$len($bestQualityList)">
#for $curQuality in sorted($bestQualityList):
<option value="$curQuality" #if $curQuality in $bestQualities then $selected else ''#>$common.Quality.qualityStrings[$curQuality]</option>
#end for

View file

@ -1,22 +1,24 @@
function setFromPresets (preset) {
var elCustomQuality = $('.show-if-quality-custom'),
selected = 'selected';
if (0 == preset) {
if (preset = parseInt(preset)) {
elCustomQuality.hide();
var upgrade = !0;
$('#anyQualities, #bestQualities').find('option').each(function() {
if (upgrade && 'bestQualities' === $(this).parent().attr('id')) {
upgrade = !1;
switch (preset) {
case 3: preset = 128 + 32 + 4; break;
case 164: preset = 256 + 64 + 16 + 4; break;
case 336: preset = 256; break;
default: preset = 0;
}
}
$(this).attr(selected, ((preset & parseInt($(this).val())) ? selected : false));
});
} else
elCustomQuality.show();
return;
}
elCustomQuality.hide();
$('#anyQualities').find('option').each(function() {
var result = preset & $(this).val();
$(this).attr(selected, (0 < result ? selected : false));
});
$('#bestQualities').find('option').each(function() {
var result = preset & ($(this).val() << 16);
$(this).attr(selected, (result > 0 ? selected: false));
});
}
$(document).ready(function() {
@ -24,7 +26,7 @@ $(document).ready(function() {
selected = ':selected';
elQualityPreset.change(function() {
setFromPresets($('#qualityPreset').find(selected).val());
setFromPresets($(this).find(selected).val());
});
setFromPresets(elQualityPreset.find(selected).val());