コード例 #1
0
    $extension = file_extension($file_name);
    $id = unique_id('media' . $file_name . $file_size);
    $coder_filename = $moviemasher_coder->getOption('CoderFilename');
    $attributes = '';
    if (!$moviemasher_file->uploadsLocally()) {
        try {
            // File == S3 or similar service
            $attributes .= $moviemasher_file->uploadAttributes($file_name, $file_size, $path_media . $id . '/' . $coder_filename);
            $attributes .= ' url="media/php/encode';
        } catch (Exception $ex) {
            $err = xml_safe($ex->getMessage());
        }
    } else {
        $attributes .= ' upload="media/php/upload';
    }
    $attributes .= '.php?id=' . $id . '&u=' . authenticated_userid() . '"';
    $xml = '<moviemasher ' . $attributes . ' />';
}
if (!$err) {
    $meta = array();
    $meta['label'] = $file_name;
    $meta['type'] = $type;
    $meta['extension'] = $extension;
    if ($moviemasher_client->progressesLocally()) {
        $xml_string = '';
        $xml_string .= '<Progress>' . "\n";
        $xml_string .= "\t" . '<PercentDone>2</PercentDone>' . "\n";
        $xml_string .= "\t" . '<Date>' . http_date_string() . '</Date>' . "\n";
        $xml_string .= "\t" . '<Status>Queued</Status>' . "\n";
        $xml_string .= '</Progress>' . "\n";
        $meta['progress'] = $xml_string;
コード例 #2
0
    if (!($job && $id)) {
        $err = 'Parameters job, id required';
    }
}
// make sure required configuration options have been set
if (!$err) {
    $uploads_locally = $moviemasher_file->uploadsLocally();
    $renders_locally = $moviemasher_client->rendersLocally();
    $path_media = $moviemasher_client->getOption('PathMedia');
    if (!$path_media) {
        $err = 'Configuration option PathMedia required';
    }
}
// get job status from Movie Masher Server, and check for error
if (!$err) {
    $path_media .= authenticated_userid() . '/';
    $start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start'];
    try {
        $get_target = $job;
        if ($moviemasher_client->progressesLocally()) {
            $media_host = $uploads_locally ? $renders_locally ? $moviemasher_file->getOption('HostLocal') : $moviemasher_file->getOption('Host') : $moviemasher_file->getOption('HostMedia');
            $get_target = 'http://' . $media_host . '/' . $path_media . $id . '/';
            $get_target = meta_file_path('progress', $get_target);
        }
        $progress = $moviemasher_client->get('encode', $get_target);
    } catch (Exception $ex) {
        $err = xml_safe($ex->getMessage());
    }
}
if (!$err) {
    $attrs = '';
コード例 #3
0
    $path_media = $moviemasher->getOption('PathMedia');
    $path_site = $moviemasher->getOption('PathSite');
    $dir_host = $moviemasher->getOption('DirHost');
    if (!($dir_host && $path_media && $path_site)) {
        $err = 'Configuration options DirHost, PathMedia, PathSite required';
    }
}
// try reading in XML file
if (!$err) {
    $file = 'media';
    switch ($group) {
        case 'mash':
        case 'video':
        case 'audio':
        case 'image':
            $file = $path_media . authenticated_userid() . '/' . $file;
            break;
        default:
            $file = $path_site . 'media/xml/' . $file . '_' . $group;
    }
    $path = $dir_host . $file . '.xml';
    // if file doesn't exist, assume user hasn't uploaded anything yet
    if (file_exists($path)) {
        $xml_str = @file_get_contents($path, 1);
    } else {
        $xml_str = '<moviemasher></moviemasher>' . "\n";
    }
    if (!$xml_str) {
        $err = 'Problem reading ' . $path;
    } else {
        $media_xml = @simplexml_load_string($xml_str);