Esempio n. 1
0
/**
 * @package ezcast.ezmanager.lib.upload
 */
function media_submit_create_metadata($tmp_name, $metadata)
{
    global $submit_upload_dir;
    // Sanity checks
    if (!is_dir($submit_upload_dir)) {
        ezmam_last_error($submit_upload_dir . ' is not a directory');
        return false;
    }
    if (!$metadata) {
        ezmam_last_error('not metadata provided');
        return false;
    }
    // 1) create directory
    $folder_path = $submit_upload_dir . '/' . $tmp_name;
    if (file_exists($folder_path)) {
        ezmam_last_error('Asset already exists. Wait one minute before retrying.');
        return false;
    }
    mkdir($folder_path);
    // 2) put metadata into xml file
    $res = assoc_array2metadata_file($metadata, $folder_path . '/metadata.xml');
    if (!$res) {
        ezmam_last_error('ezmam_media_submit_create_metadata: could not save metadata');
        return false;
    }
    return true;
}
Esempio n. 2
0
/**
 * saves the status of the processing
 * @global string $procdirpath path of the processing directory
 * @global array $processing_assoc info of current processing
 * @param string $status
 * @return bool
 */
function processing_status($status)
{
    global $processing, $processing_assoc;
    $processing_assoc['status'] = $status;
    $res = assoc_array2metadata_file($processing_assoc, $processing . '/processing.xml');
    return $res;
}
/**
 * generate the title.xml file in render_dir for title processing
 * @global string $organization_name
 * @param string $album
 * @param string $asset_meta
 * @param string $render_dir
 */
function submit_itm_set_title($album_meta, $asset_meta, $render_dir)
{
    global $organization_name, $copyright, $title_duration;
    //get date
    $human_date = get_user_friendly_date($asset_meta['record_date'], ' ', true, 'fr', false);
    $asset_title = $asset_meta['title'];
    //medium short titles should break after album name
    if (strlen($asset_title) <= 24) {
        $asset_title = str_replace(' ', utf8_encode(chr(160)), $asset_title);
    }
    //original title with no breaking spaces
    $title_info = array('album' => '[' . suffix_remove($album_meta['name']) . '] ' . $album_meta['description'], 'title' => suffix_remove($album) . " " . $asset_title, 'author' => $asset_meta['author'], 'date' => $human_date, 'organization' => $organization_name, 'copyright' => $copyright);
    //write the title xml file to the "shared directory"
    $res = assoc_array2metadata_file($title_info, $render_dir . "/title.xml");
    if (!$res) {
        myerror("couldnt write title metadata to {$render_dir}/title.xml");
    }
    return $res;
}