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

View File

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

View File

@@ -10,56 +10,127 @@
{else}
<form name="setup-rips" id="setup-rips" action="{$base_uri}rips/setup-rip/submit/" method="post">
<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="submit" name="submit" value="Queue rips" />
<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 id="available-titles">
{foreach from=$titles item=title}
<h3><a href="#">Title {$title->id()} (Duration: {$title->duration()}, Chapters: {$title->chapterCount()})</a></h3>
<div id="rips-{$title->id()}">
<fieldset>
<legend>Configure title rip options</legend>
<input type="checkbox" id="rip-title-{$title->id()}" name="rips[{$title->id()}][queue]" value="1" />
<label for="rip-title-{$title->id()}">Rip this title</label>
<hr />
<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" />
</div>
</fieldset>
<div id="available-titles">
{foreach from=$titles item=title}
<h3><a href="#">Title {$title->id()} (Duration: {$title->duration()}, Chapters: {$title->chapterCount()})</a></h3>
<div id="rips-{$title->id()}">
<fieldset>
<legend>Configure title rip options</legend>
<div>
<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>
<div>
<label for="rip-audio-{$title->id()}">Audio tracks</label>
<select id="rip-audio-{$title->id()}" name="rips[{$title->id()}][audio][]" size="5" multiple="multiple">
{foreach from=$title->audioTracks() item=audio}
<option value="{$audio->id()}">{$audio->name()} - {$audio->channels()} ch ({$audio->language()}) </option>
{/foreach}
</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>
<select id="rip-subtitle-{$title->id()}" name="rips[{$title->id()}][subtitles][]" size="5" multiple="multiple">
{foreach from=$title->subtitleTracks() item=subtitle}
<option value="{$subtitle->id()}">{$subtitle->language()}</option>
{/foreach}
</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>
<input type="text" id="rips-output-{$title->id()}" name="rips[{$title->id()}][output_filename]" value="" />
<hr />
</div>
<div>
<label for="rip-deinterlace-{$title->id()}">Deinterlacing</label>
<select id="rip-deinterlace-{$title->id()}" name="rips[{$title->id()}][deinterlace]">
<option value="0">Don't deinterlace</option>
<option value="1">Do deinterlace</option>
<option value="2" selected="selected">Selectively deinterlace</option>
<option value="0">None</option>
<option value="1">Full</option>
<option value="2" selected="selected">Selective</option>
</select>
</fieldset>
</div>
{/foreach}
</div>
</div>
</fieldset>
</div>
{/foreach}
</div>
<fieldset>
<legend>Queue rips</legend>
<input type="submit" name="submit" value="Queue rips" />
</fieldset>
</form>
@@ -69,6 +140,16 @@
$(function() {
$("#available-titles").accordion();
$("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>
{/literal}