コード例 #1
0
$stream->duration = $duration;
$mvTitle = new MV_Title('Stream:' . $stream_name);
if (!$mvTitle->doesStreamExist()) {
    print $stream_name . " does not exist ... creating\n";
    // print 'do stream desc'."\n";
    if (!isset($MVStreams)) {
        $MVStreams = array();
    }
    // init the stream (legacy from old stream insert system)
    $MVStreams[$stream->name] = new MV_Stream($stream);
    do_add_stream($mvTitle, $stream);
}
$stream_id = $mvTitle->getStreamId();
print 'got stream id: ' . $stream_id . "\n";
//check for & update stream files:
do_stream_file_check($stream);
$filedir = '/video/metavid/mvprime_stream_images/' . MV_StreamImage::getRelativeImagePath($stream_id);
if (!is_dir($filedir)) {
    shell_exec("mkdir {$filedir}");
    shell_exec("chmod -R 777 {$filedir}");
}
echo "working on: {$filename} \n";
$ocroutput = "";
//@@TODO we should do sequential output and parse the OCR file if it already exists.
//make sure we can write to the ocr file:
$ocrfileloc = "{$workingdir}/{$stream_name}.ocr";
$fh = @fopen($ocrfileloc, 'a') or die("\nError: can't write to ocr file\n");
fclose($fh);
//gets duration from ffmpeg
$dbw = $dbr = wfGetDB(DB_MASTER);
for ($i = 0; $i < $duration; $i += $interval) {
コード例 #2
0
     do_stream_insert('all_sync_past_date');
     break;
 case 'people':
     $force = isset($options['force']) ? true : false;
     $person_name = isset($args[1]) ? $args[1] : '';
     do_people_insert('', $person_name, $force);
     break;
 case 'bill':
     $bill_key = isset($args[1]) ? $args[1] : '';
     do_bill_insert($bill_key);
     break;
 case 'interest':
     do_people_insert($lookUpInterest = true);
     break;
 case 'file_check':
     do_stream_file_check();
     break;
 case 'do_stream_date_check':
     do_stream_date_check();
     break;
 case 'do_remove_orphaned_streams':
     do_remove_orphaned_streams();
     break;
 case 'update_templates':
     $force = isset($options['force']) ? true : false;
     include_once 'metavid_gov_templates.php';
     upTemplates($force);
     break;
     // by default treat the argument as a stream name:
 // by default treat the argument as a stream name:
 case 'mvd_consistancy_check':
コード例 #3
0
function do_stream_insert($mode, $stream_name = '')
{
    global $mvgIP, $MVStreams, $options, $args, $wgDBname;
    $dbr = wfGetDB(DB_SLAVE);
    if ($mode == 'all') {
        $sql = "SELECT * FROM `metavid`.`streams` WHERE `sync_status`='in_sync'";
    } elseif ($mode == 'files') {
        $sql = "SELECT * FROM `metavid`.`streams` WHERE `trascoded` != 'none'";
    } elseif ($mode == 'all_in_wiki') {
        $sql = "SELECT `metavid`.`streams`.* FROM `{$wgDBname}`.`mv_streams` LEFT JOIN `metavid`.`streams` ON (`{$wgDBname}`.`mv_streams`.`name` = `metavid`.`streams`.`name`) ";
    } elseif ($mode == 'all_sync_past_date') {
        print "doing all after: " . $args[$options['date']] . "\n";
        list($month, $day, $year) = explode('/', $args[$options['date']]);
        $date_time = mktime(0, 0, 0, $month, $day, $year);
        $sql = "SELECT * FROM `metavid`.`streams` WHERE `sync_status`= 'in_sync' AND `adj_start_time` > {$date_time}";
    } else {
        $sql = "SELECT * FROM `metavid`.`streams` WHERE `name` LIKE '{$stream_name}'";
    }
    $res = $dbr->query($sql);
    if ($dbr->numRows($res) == 0) {
        die('could not find stream: ' . $stream_name . "\n");
    }
    // load all stream names:
    while ($row = $dbr->fetchObject($res)) {
        $streams[] = $row;
    }
    print "working on " . count($streams) . ' streams' . "\n";
    foreach ($streams as $stream) {
        print "on stream {$stream->name} \n";
        $force = isset($options['force']) ? true : false;
        // init the stream
        $MVStreams[$stream->name] = new MV_Stream($stream);
        // check if the stream has already been added to the wiki (if not add it)
        $mvTitle = new MV_Title('Stream:' . $stream->name);
        if (!$mvTitle->doesStreamExist()) {
            // print 'do stream desc'."\n";
            do_add_stream($mvTitle, $stream);
            echo "stream " . $mvTitle->getStreamName() . " added \n";
        } else {
            do_update_wiki_page($stream->name, mv_semantic_stream_desc($mvTitle, $stream), MV_NS_STREAM, $force);
            // $updated = ' updated' echo "stream " . $mvTitle->getStreamName() . " already present $updated\n";
        }
        if ($mode != 'all_in_wiki') {
            // add duration and start_time attr
            do_stream_attr_check($stream);
        }
        // do insert/copy all media images
        if (!isset($options['skipimage'])) {
            do_process_images($stream, $force);
            print "done with images\n";
        }
        if (!isset($options['skipfiles'])) {
            // check for files (make sure they match with metavid db values
            do_stream_file_check($stream);
        }
        if (!isset($options['skiptext'])) {
            // process all stream text:
            do_process_text($stream, $force);
        }
        if (!isset($options['skipSpeechMeta'])) {
            // do annoative track for continus speches
            do_annotate_speeches($stream, $force);
        }
    }
}