Added UI for additional rip options

This commit is contained in:
2010-06-08 18:04:14 +01:00
parent aba31daaa0
commit 9881fb7cea
3 changed files with 125 additions and 38 deletions

View File

@@ -116,12 +116,11 @@ class HandBrakeCluster_Job {
return $jobs; return $jobs;
} }
public static function fromPostRequest($source_id, $config) { public static function fromPostRequest($source_id, $global_options, $titles) {
$source_filename = base64_decode(str_replace('-', '/', HandBrakeCluster_Main::issetelse($source_id, HandBrakeCluster_Exception_InvalidParameters))); $source = HandBrakeCluster_Rips_Source::loadEncoded(HandBrakeCluster_Main::issetelse($source_id, HandBrakeCluster_Exception_InvalidParameters));
$source = HandBrakeCluster_Rips_Source::load($source_filename);
$jobs = array(); $jobs = array();
foreach ($config as $title => $details) { foreach ($titles as $title => $details) {
if (HandBrakeCluster_Main::issetelse($details['queue'])) { if (HandBrakeCluster_Main::issetelse($details['queue'])) {
$job = new HandBrakeCluster_Job( $job = new HandBrakeCluster_Job(
$source, $source,
@@ -130,11 +129,11 @@ class HandBrakeCluster_Job {
$source->filename(), $source->filename(),
HandBrakeCluster_Main::issetelse($details['output_filename'], HandBrakeCluster_Exception_InvalidParameters), HandBrakeCluster_Main::issetelse($details['output_filename'], HandBrakeCluster_Exception_InvalidParameters),
$title, $title,
'mkv', // @todo Make this configurable $global_options['format'],
'x264', // @todo Make this configurable $global_options['video-codec'],
0, // @todo Make this configurable $global_options['video-width'],
0, // @todo Make this configurable $global_options['video-height'],
0.61, // @todo Make this configurable $global_options['quantizer'],
HandBrakeCluster_Main::issetelse($details['deinterlace'], 2), HandBrakeCluster_Main::issetelse($details['deinterlace'], 2),
implode(',', HandBrakeCluster_Main::issetelse($details['audio'], array())), implode(',', HandBrakeCluster_Main::issetelse($details['audio'], array())),
implode(',', array_pad(array(), count($details['audio']), 'ac3')), // @todo Make this configurable implode(',', array_pad(array(), count($details['audio']), 'ac3')), // @todo Make this configurable

View File

@@ -104,3 +104,10 @@ label {
width: 16px; width: 16px;
} }
table#setup-rips input,select {
}
#quantizer-slider {
width: 20em;
}

View File

@@ -10,11 +10,51 @@
{else} {else}
<form name="setup-rips" id="setup-rips" action="{$base_uri}rips/setup-rip/submit/" method="post"> <form name="setup-rips" id="setup-rips" action="{$base_uri}rips/setup-rip/submit/" method="post">
<fieldset> <fieldset>
<legend>Configure titles to rip</legend> <legend>Configure global rip options</legend>
<input type="hidden" name="id" value="{$source->filenameEncoded()|escape:"html"}" /> <input type="hidden" name="id" value="{$source->filenameEncoded()|escape:"html"}" />
<div>
<label for="global-output-directory">Output directory</label>
<input type="text" id="global-ouput-directory" name="rip-options[output-directory]" value="{$default_output_dir}" />
</div>
<div>
<label for="global-format">Output format</label>
<select id="global-format" name="rip-options[format]">
<option value="mkv" selected="selected">MKV</option>
</select>
</div>
<div>
<label for="global-video-codec">Video codec</label>
<select id="global-video-codec" name="rip-options[video-codec]">
<option value="x264" selected="selected">x264</option>
</select>
</div>
<div>
<label for="global-video-width">Video width</label>
<input type="text" id="global-video-width" name="rip-options[video-width]" value="0" />
<em>(Use 0 to leave size unchanged from source.)</em>
</div>
<div>
<label for="global-video-height">Video height</label>
<input type="text" id="global-video-width" name="rip-options[video-width]" value="0" />
<em>(Use 0 to leave size unchanged from source.)</em>
</div>
<div>
<label for="global-quantizer">Quantizer</label>
<input type="text" id="global-quantizer" name="rip-options[quantizer]" value="" readonly="readonly" />
<em>(Defaults to 0.61, x264's quantizer value for 20)</em>
<div id="quantizer-slider"></div>
</div>
<div>
<input type="submit" name="submit" value="Queue rips" /> <input type="submit" name="submit" value="Queue rips" />
</div>
</fieldset>
<div id="available-titles"> <div id="available-titles">
{foreach from=$titles item=title} {foreach from=$titles item=title}
@@ -23,11 +63,12 @@
<fieldset> <fieldset>
<legend>Configure title rip options</legend> <legend>Configure title rip options</legend>
<input type="checkbox" id="rip-title-{$title->id()}" name="rips[{$title->id()}][queue]" value="1" /> <div>
<label for="rip-title-{$title->id()}">Rip this title</label> <label for="rip-title-{$title->id()}">Rip this title</label>
<input type="checkbox" id="rip-title-{$title->id()}" name="rips[{$title->id()}][queue]" value="1" />
</div>
<hr /> <div>
<label for="rip-audio-{$title->id()}">Audio tracks</label> <label for="rip-audio-{$title->id()}">Audio tracks</label>
<select id="rip-audio-{$title->id()}" name="rips[{$title->id()}][audio][]" size="5" multiple="multiple"> <select id="rip-audio-{$title->id()}" name="rips[{$title->id()}][audio][]" size="5" multiple="multiple">
{foreach from=$title->audioTracks() item=audio} {foreach from=$title->audioTracks() item=audio}
@@ -35,6 +76,20 @@
{/foreach} {/foreach}
</select> </select>
<table class="audio-tracks">
<caption>Selected audio tracks</caption>
<thead>
<th>Track</th>
<th>Encoder</th>
<th>Name</th>
</thead>
<tbody>
</tbody>
</table>
</div>
<div>
<label for="rip-subtitle-{$title->id()}">Subtitle tracks</label> <label for="rip-subtitle-{$title->id()}">Subtitle tracks</label>
<select id="rip-subtitle-{$title->id()}" name="rips[{$title->id()}][subtitles][]" size="5" multiple="multiple"> <select id="rip-subtitle-{$title->id()}" name="rips[{$title->id()}][subtitles][]" size="5" multiple="multiple">
{foreach from=$title->subtitleTracks() item=subtitle} {foreach from=$title->subtitleTracks() item=subtitle}
@@ -42,24 +97,40 @@
{/foreach} {/foreach}
</select> </select>
<hr /> <table class="subtitle-tracks">
<caption>Selected subtitle tracks</caption>
<thead>
<th>Track</th>
<th>Language</th>
<th>Format</th>
</thead>
<tbody>
</tbody>
</table>
</div>
<div>
<label for="rips-output-{$title->id()}">Output filename</label> <label for="rips-output-{$title->id()}">Output filename</label>
<input type="text" id="rips-output-{$title->id()}" name="rips[{$title->id()}][output_filename]" value="" /> <input type="text" id="rips-output-{$title->id()}" name="rips[{$title->id()}][output_filename]" value="" />
</div>
<hr /> <div>
<label for="rip-deinterlace-{$title->id()}">Deinterlacing</label>
<select id="rip-deinterlace-{$title->id()}" name="rips[{$title->id()}][deinterlace]"> <select id="rip-deinterlace-{$title->id()}" name="rips[{$title->id()}][deinterlace]">
<option value="0">Don't deinterlace</option> <option value="0">None</option>
<option value="1">Do deinterlace</option> <option value="1">Full</option>
<option value="2" selected="selected">Selectively deinterlace</option> <option value="2" selected="selected">Selective</option>
</select> </select>
</div>
</fieldset> </fieldset>
</div> </div>
{/foreach} {/foreach}
</div> </div>
<fieldset>
<legend>Queue rips</legend>
<input type="submit" name="submit" value="Queue rips" /> <input type="submit" name="submit" value="Queue rips" />
</fieldset> </fieldset>
</form> </form>
@@ -69,6 +140,16 @@
$(function() { $(function() {
$("#available-titles").accordion(); $("#available-titles").accordion();
$("input:submit").button(); $("input:submit").button();
$("#quantizer-slider").slider({
value:0.61,
min: 0,
max: 1.0,
step: 0.01,
slide: function(event, ui) {
$("#output-quantizer").val(ui.value);
}
});
$("#output-quantizer").val($("#quantizer-slider").slider("value"));
}); });
</script> </script>
{/literal} {/literal}