Fixed call to handbrake, and printout of response

Added an ignore on 'lost+found' directories in the Source Lister, since
by default only root has access to this dir, which was causing
permission denied errors.
This commit is contained in:
2010-03-21 03:43:47 +00:00
parent 3207c28b5c
commit ed3ef8c01d
3 changed files with 19 additions and 15 deletions

View File

@@ -15,13 +15,17 @@ class HandBrakeCluster_Rips_Source {
$source_shell = escapeshellarg($this->source);
$handbrake_cmd = "HandBrakeCLI -i {$source_shell} -t 0";
$handbrake_pid = popen($handbrake_cmd, 'r');
$handbrake_output = fread($handbrake_pid, 1024);
while (!feof($handbrake_pid)) {
$handbrake_output = fread($handbrake_pid, 1024);
}
pclose($handbrake_pid);
$handbrake_pid = proc_open($handbrake_cmd, array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("pipe", "w")
), $pipes);
$handbrake_output = stream_get_contents($pipes[2]);
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
proc_close($handbrake_pid);
// Process the output
$lines = explode("\n", $handbrake_output);
@@ -31,12 +35,12 @@ class HandBrakeCluster_Rips_Source {
continue;
}
$this->output .= $line;
$this->output .= $line . "\n";
}
}
public function output() {
return $output;
return $this->output;
}
};

View File

@@ -23,7 +23,7 @@ class HandBrakeCluster_Rips_SourceLister {
$dir = dir(array_shift($scan_directories));
while (($entry = $dir->read()) !== false) {
if ($entry == '.' || $entry == '..') {
if ($entry == '.' || $entry == '..' || $entry == 'lost+found') {
continue;
}

View File

@@ -16,7 +16,7 @@
</tr>
<tr>
<th>Output</th>
<td>{$output|escape:"html"}</td>
<td><pre>{$output|escape:"html"}</pre></td>
</tr>
</tbody>
</table>