Updated source/rips and jobs pages to reflect code changes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$jobs = HandBrakeCluster_Job::all(HandBrakeCluster_Main::instance()->database());
|
||||
$jobs = HandBrakeCluster_Job::all();
|
||||
$this->smarty->assign('jobs', $jobs);
|
||||
|
||||
?>
|
||||
|
||||
@@ -5,36 +5,30 @@ $req = $main->request();
|
||||
$config = $main->config();
|
||||
|
||||
// Grab the name of this source
|
||||
$source_id;
|
||||
$encoded_filename = null;
|
||||
if ($req->get('submit')) {
|
||||
$this->smarty->assign('rips_submitted', true);
|
||||
$source_id = HandBrakeCluster_Main::issetelse($_POST['id'], HandBrakeCluster_Exception_InvalidParameters);
|
||||
$encoded_filename = HandBrakeCluster_Main::issetelse($_POST['id'], HandBrakeCluster_Exception_InvalidParameters);
|
||||
|
||||
// Create the jobs from the request
|
||||
$jobs = HandBrakeCluster_Job::fromPostRequest($_POST['id'], $_POST['rips']);
|
||||
|
||||
// Spawn the background client process to run all the jobs
|
||||
HandBrakeCluster_Job::runAllJobs();
|
||||
|
||||
HandBrakeCluster_Page::redirect('rips/setup-rip/queued');
|
||||
|
||||
} elseif ($req->get('queued')) {
|
||||
$this->smarty->assign('rips_submitted', true);
|
||||
|
||||
$this->smarty->assign('rips', HandBrakeCluster_Main::issetelse($_POST['rips'], HandBrakeCluster_Exception_InvalidParameters));
|
||||
} else {
|
||||
$this->smarty->assign('rips_submitted', false);
|
||||
$source_id = $req->get('id', HandBrakeCluster_Exception_InvalidParameters);
|
||||
}
|
||||
$encoded_filename = $req->get('id', HandBrakeCluster_Exception_InvalidParameters);
|
||||
|
||||
$source_path = base64_decode(str_replace('-', '/', $source_id));
|
||||
$real_source_path = realpath($source_path);
|
||||
$source = HandBrakeCluster_Rips_Source::loadEncoded($encoded_filename);
|
||||
|
||||
// Ensure the source is a valid directory, and lies below the configured source_dir
|
||||
if (!is_dir($source_path)) {
|
||||
throw new HandBrakeCluster_Exception_InvalidParameters();
|
||||
}
|
||||
|
||||
$real_source_dir = realpath($config->get('rips.source_dir'));
|
||||
if (substr($real_source_path, 0, strlen($real_source_dir)) != $real_source_dir) {
|
||||
throw new HandBrakeCluster_Exception_InvalidParameters();
|
||||
}
|
||||
|
||||
$source = HandBrakeCluster_Rips_Source::load($source_path);
|
||||
|
||||
$this->smarty->assign('source_path_encoded', $source_id);
|
||||
$this->smarty->assign('source_path', $source_path);
|
||||
$this->smarty->assign('source', $source);
|
||||
$this->smarty->assign('titles', $source->titles());
|
||||
$this->smarty->assign('longest_title', $source->longestTitle());
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -4,23 +4,8 @@ $main = HandBrakeCluster_Main::instance();
|
||||
$req = $main->request();
|
||||
$config = $main->config();
|
||||
|
||||
// Grab the name of this source
|
||||
$source_id = $req->get('id');
|
||||
$source_path = base64_decode(str_replace('-', '/', $source_id));
|
||||
$real_source_path = realpath($source_path);
|
||||
$source = HandBrakeCluster_Rips_Source::loadEncoded($req->get('id', HandBrakeCluster_Exception_InvalidParameters));
|
||||
|
||||
// Ensure the source is a valid directory, and lies below the configured source_dir
|
||||
if (!is_dir($source_path)) {
|
||||
return;
|
||||
}
|
||||
$real_source_dir = realpath($config->get('rips.source_dir'));
|
||||
if (substr($real_source_path, 0, strlen($real_source_dir)) != $real_source_dir) {
|
||||
return;
|
||||
}
|
||||
|
||||
$source = HandBrakeCluster_Rips_Source::load($source_path);
|
||||
|
||||
$this->smarty->assign('source_path', $source_path);
|
||||
$this->smarty->assign('source', $source);
|
||||
$this->smarty->assign('titles', $source->titles());
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ $sources = $lister->sources();
|
||||
|
||||
$sources_cached = array();
|
||||
foreach ($sources as $source) {
|
||||
$sources_cached[$source] = HandBrakeCluster_Rips_Source::isCached($source);
|
||||
$sources_cached[$source->filename()] = HandBrakeCluster_Rips_Source::isCached($source->filename());
|
||||
}
|
||||
|
||||
$this->smarty->assign('sources', $sources);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
{assign var=current_status value=$job->currentStatus()}
|
||||
<tr>
|
||||
<td><a href="{$base_uri}/job-details/id/{$job->id()}" title="View job details">{$job->name()}</a></td>
|
||||
<td>{$job->destination()}</td>
|
||||
<td>{$job->destinationFilename()}</td>
|
||||
<td>{$job->title()}</td>
|
||||
<td>{$current_status->statusName()}</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
<h2>Setup Rips</h2>
|
||||
|
||||
{if $rips_submitted}
|
||||
<p>
|
||||
Processing rips now...
|
||||
</p>
|
||||
<h3>Jobs Queued</h3>
|
||||
|
||||
<pre>{$rips|var_dump}</pre>
|
||||
<p>
|
||||
The rips have been queued, and processing has begun in the background. View the <a href="{$base_uri}jobs/" title="View running jobs">Jobs</a> page
|
||||
to see a list of running jobs, or the <a href="{$base_uri}logs/" title="View logs">logs</a> page for more detailed progress information.
|
||||
</p>
|
||||
{else}
|
||||
<form name="setup-rips" id="setup-rips" action="{$base_uri}rips/setup-rip/submit/" method="post">
|
||||
<fieldset>
|
||||
<legend>Configure titles to rip</legend>
|
||||
|
||||
<input type="hidden" name="id" value="{$source_path_encoded}" />
|
||||
<input type="hidden" name="id" value="{$source->filenameEncoded()|escape:"html"}" />
|
||||
|
||||
<input type="submit" name="submit" value="Queue rips" />
|
||||
|
||||
@@ -25,9 +26,6 @@
|
||||
<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>
|
||||
|
||||
<input type="checkbox" id="rip-chapters-{$title->id()}" name="rips[{$title->id()}][include-chapters]" value="{$title->id()}" checked="checked" />
|
||||
<label for="rip-title-{$title->id()}">Include chapter markers</label>
|
||||
|
||||
<hr />
|
||||
|
||||
<label for="rip-audio-{$title->id()}">Audio tracks</label>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Source</th>
|
||||
<td>{$source_path|escape:"html"}</td>
|
||||
<td>{$source->filename()|escape:"html"}</td>
|
||||
</tr>
|
||||
{if $titles}
|
||||
<tr>
|
||||
|
||||
@@ -10,10 +10,12 @@
|
||||
</p>
|
||||
<ul>
|
||||
{foreach from=$sources item=source}
|
||||
{assign var='source_filename' value=$source->filename()}
|
||||
{assign var='source_filename_encoded' value=$source->filenameEncoded()}
|
||||
<li>
|
||||
[ <a href="{$base_uri}rips/source-details/id/{$source|base64_encode|replace:"/":"-"}" title="Browse source details">Browse</a> |
|
||||
<a href="{$base_uri}rips/setup-rip/id/{$source|base64_encode|replace:"/":"-"}" title="Rip this source">Rip</a> ]
|
||||
{$source|escape:'html'}{if $sources_cached.$source} (cached){/if}
|
||||
[ <a href="{$base_uri}rips/source-details/id/{$source_filename_encoded}" title="Browse source details">Browse</a> |
|
||||
<a href="{$base_uri}rips/setup-rip/id/{$source_filename_encoded}" title="Rip this source">Rip</a> ]
|
||||
{$source_filename|escape:'html'}{if $sources_cached.$source_filename} (cached){/if}
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user