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:
@@ -15,13 +15,17 @@ class HandBrakeCluster_Rips_Source {
|
|||||||
$source_shell = escapeshellarg($this->source);
|
$source_shell = escapeshellarg($this->source);
|
||||||
$handbrake_cmd = "HandBrakeCLI -i {$source_shell} -t 0";
|
$handbrake_cmd = "HandBrakeCLI -i {$source_shell} -t 0";
|
||||||
|
|
||||||
$handbrake_pid = popen($handbrake_cmd, 'r');
|
$handbrake_pid = proc_open($handbrake_cmd, array(
|
||||||
$handbrake_output = fread($handbrake_pid, 1024);
|
0 => array("pipe", "r"),
|
||||||
while (!feof($handbrake_pid)) {
|
1 => array("pipe", "w"),
|
||||||
$handbrake_output = fread($handbrake_pid, 1024);
|
2 => array("pipe", "w")
|
||||||
}
|
), $pipes);
|
||||||
pclose($handbrake_pid);
|
|
||||||
|
|
||||||
|
$handbrake_output = stream_get_contents($pipes[2]);
|
||||||
|
fclose($pipes[0]);
|
||||||
|
fclose($pipes[1]);
|
||||||
|
fclose($pipes[2]);
|
||||||
|
proc_close($handbrake_pid);
|
||||||
|
|
||||||
// Process the output
|
// Process the output
|
||||||
$lines = explode("\n", $handbrake_output);
|
$lines = explode("\n", $handbrake_output);
|
||||||
@@ -31,12 +35,12 @@ class HandBrakeCluster_Rips_Source {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->output .= $line;
|
$this->output .= $line . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function output() {
|
public function output() {
|
||||||
return $output;
|
return $this->output;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class HandBrakeCluster_Rips_SourceLister {
|
|||||||
$dir = dir(array_shift($scan_directories));
|
$dir = dir(array_shift($scan_directories));
|
||||||
|
|
||||||
while (($entry = $dir->read()) !== false) {
|
while (($entry = $dir->read()) !== false) {
|
||||||
if ($entry == '.' || $entry == '..') {
|
if ($entry == '.' || $entry == '..' || $entry == 'lost+found') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Output</th>
|
<th>Output</th>
|
||||||
<td>{$output|escape:"html"}</td>
|
<td><pre>{$output|escape:"html"}</pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user