$metadata = true; $outDir = ""; $outFile = ""; $play = false; $quiet = false; $referrer = ""; $rename = false; $showHeader = true; $start = 0; $update = false; $options = array(0 => array('help' => 'displays this help', 'debug' => 'show debug output', 'delete' => 'delete fragments after processing', 'fproxy' => 'force proxy for downloading of fragments', 'play' => 'dump stream to stdout for piping to media player', 'rename' => 'rename fragments sequentially before processing', 'update' => 'update the script to current git version'), 1 => array('auth' => 'authentication string for fragment requests', 'duration' => 'stop recording after specified number of seconds', 'filesize' => 'split output file in chunks of specified size (MB)', 'fragments' => 'base filename for fragments', 'fixwindow' => 'timestamp gap between frames to consider as timeshift', 'manifest' => 'manifest file for downloading of fragments', 'maxspeed' => 'maximum bandwidth consumption (KB) for fragment downloading', 'outdir' => 'destination folder for output file', 'outfile' => 'filename to use for output file', 'parallel' => 'number of fragments to download simultaneously', 'proxy' => 'proxy for downloading of manifest', 'quality' => 'selected quality level (low|medium|high) or exact bitrate', 'referrer' => 'Referer to use for emulation of browser requests', 'start' => 'start from specified fragment', 'useragent' => 'User-Agent to use for emulation of browser requests')); $cli = new CLI($options, true); // Set large enough memory limit ini_set("memory_limit", "512M"); // Check if STDOUT is available if ($cli->getParam('play')) { $play = true; $quiet = true; $showHeader = false; } if ($cli->getParam('help')) { $cli->displayHelp(); exit(0); } // Check for required extensions $required_extensions = array("bcmath", "curl", "SimpleXML"); $missing_extensions = array_diff($required_extensions, get_loaded_extensions()); if ($missing_extensions) { $msg = "You have to install the following extension(s) to continue: '" . implode("', '", $missing_extensions) . "'"; LogError($msg); }
} function ShowHeader() { $header = "KSV WeebTV Downloader"; $len = strlen($header); $width = floor((80 - $len) / 2) + $len; $format = "\n%" . $width . "s\n\n"; printf($format, $header); } // Global code starts here $format = "%-8s: %s"; $ChannelFormat = "%2d) %-22.21s"; $quiet = false; $options = array(0 => array('help' => 'displays this help', 'list' => 'display formatted channels list and exit', 'print' => 'only print the base rtmpdump command, don\'t start anything', 'quiet' => 'disables unnecessary output'), 1 => array('proxy' => 'use proxy to retrieve channel information', 'url' => 'use specified url without displaying channels list')); $cli = new CLI($options); if ($cli->getParam('quiet')) { $quiet = true; } if (!$quiet) { ShowHeader(); } $windows = strncasecmp(php_uname('s'), "Win", 3) == 0 ? true : false; if ($windows) { exec("chcp 65001"); if (file_exists("C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe")) { $vlc = "C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe"; } else { $vlc = "C:\\Program Files\\VideoLAN\\VLC\\vlc.exe"; } } else { $vlc = "vlc";
fwrite($flv, $flvHeader, $flvHeaderLen); return $flv; } // Global code starts here $avcCfgW = false; $aacCfgW = false; $beatFile = ""; $debug = false; $flv = ""; $flvData = ""; $outFile = ""; $showHeader = true; $options = array(0 => array('help' => 'displays this help', 'debug' => 'show debug output'), 1 => array('infile' => 'input beat file to convert', 'outfile' => 'filename to use for output file')); $cli = new CLI($options, true); // Process command line options if ($cli->getParam('help')) { $cli->displayHelp(); exit(0); } if (isset($cli->params['unknown'])) { $beatFile = $cli->params['unknown'][0]; } if ($cli->getParam('debug')) { $debug = true; } if ($cli->getParam('infile')) { $beatFile = $cli->getParam('infile'); } if ($cli->getParam('outfile')) { $outFile = $cli->getParam('outfile'); }
$baseTS = INVALID_TIMESTAMP; $negTS = INVALID_TIMESTAMP; $prevAudioTS = INVALID_TIMESTAMP; $prevVideoTS = INVALID_TIMESTAMP; $pAudioTagLen = 0; $pVideoTagLen = 0; $pAudioTagPos = 0; $pVideoTagPos = 0; $prevAVC_Header = false; $prevAAC_Header = false; $AVC_HeaderWritten = false; $AAC_HeaderWritten = false; ShowHeader(); $options = array(0 => array('help' => 'displays this help', 'debug' => 'show debug output', 'nometa' => 'do not save metadata in repaired file'), 1 => array('fixwindow' => 'timestamp gap between frames to consider as timeshift', 'in' => 'input filename of flv file to be repaired', 'out' => 'output filename for repaired file')); $cli = new CLI($options); if ($cli->getParam('help')) { $cli->displayHelp(); exit(0); } if ($cli->getParam('debug')) { $debug = true; } if ($cli->getParam('nometa')) { $metadata = false; } if ($cli->getParam('fixwindow')) { $fixWindow = $cli->getParam('fixwindow'); } if ($cli->getParam('in')) { $in = $cli->getParam('in'); } else {