blob: 0d90f7f140b290fa94e9a1e5e8b888d5975034ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
<?php
$base_path = realpath(__DIR__ . '/..');
// Load VideoProcessor class
require_once($base_path . '/app/VideoProcessor.php');
// Load config
$config = include_once($base_path . '/config/app.php');
// Process arguments
if (count($argv) === 1) {
$pretend = false;
} else {
if (count($argv) > 2) {
echo "Error. Too many arguments." . PHP_EOL;
exit;
}
if ($argv[1] !== '--pretend') {
echo "Error. Argument `" . $argv[1] . "` is not supported." . PHP_EOL;
exit;
}
$pretend = true;
}
$video_processor = new VideoProcessor($config);
// Lets get the list of replays
$files = glob($config['xplane_path'] . '/Output/*.avi');
echo count($files) . " video file(s) found." . PHP_EOL;
foreach ($files as $index => $file) {
$file_path_parts = explode('/', $file);
echo "[$index] " . $file_path_parts[count($file_path_parts) - 1] . PHP_EOL;
}
echo PHP_EOL . "Please enter the video(s) you want to process, or enter 'a' for all!" . PHP_EOL;
echo "For example, '0,1' will process video 0 and 1 and combine them!" . PHP_EOL;
$handle = fopen("php://stdin", "r");
$line = trim(fgets($handle), "\n");
if ($line === 'a') {
echo "Error. Not yet implemeneted." . PHP_EOL;
exit;
} elseif (strpos($line, ',') !== false) {
echo "Error. Not yet implemeneted." . PHP_EOL;
exit;
} else {
if (!array_key_exists($line, $files)) {
echo "Error: '$line' is not a valid option." . PHP_EOL;
exit;
}
$out = $video_processor->process($files[$line], $pretend);
if ($out) {
$pretend_string = $pretend ? '(Pretend) ' : '';
echo $pretend_string . "Processing complete!" . PHP_EOL;
}
}
|