/** * * @param string_path $title_meta_path * @param assoc_array $title_assoc * @return bool true on success * @desc load the title (xml) info and validate it. parameters should be in title,author,date,organization,copyright */ function get_title_info($title_meta_path, $title_filename, &$title_assoc) { if (!file_exists($title_meta_path . "/" . $title_filename)) { $title_assoc = false; return true; //no title file means no title to generate } $title_assoc = metadata2assoc_array($title_meta_path . "/" . $title_filename); if (!is_array($title_assoc)) { myerror("Title metadata file read error {$title_meta_path}/{$title_filename}\n"); } //check if we dont have any invalid properties $valid_title_elems = array("album", "title", "author", "date", "organization", "copyright"); $badmeta = ""; foreach ($title_assoc as $key => $value) { if (!in_array($key, $valid_title_elems)) { $badmeta .= "'{$key}',"; } } if ($badmeta != "") { $badmeta = "Error with metadata elements: " . $badmeta . "\n"; myerror($badmeta); } return true; }
<record_date>YYYY_MM_DD_hh\\hmm\\m</record_date> </metadata> '; die; } $recording_dir = $argv[1]; //first (and only) parameter in command line if (!file_exists($recording_dir)) { //no myerror("could not find recording directory: {$recording_dir}"); //log error } //local log file: $local_log_file = $recording_dir . "/download.log"; //now get metadata about the recording $recording_metadata = metadata2assoc_array($recording_dir . "/metadata.xml"); if ($recording_metadata === false) { myerror("bad xml or read problem on {$recording_dir}" . "/metadata.xml"); } //log to file // 'course_name' 'origin' 'record_date' 'description' 'record_type' 'moderation' $record_type = $recording_metadata['record_type']; $course_name = $recording_metadata['course_name']; $record_date = $recording_metadata['record_date']; //check for album existance if ($recording_metadata['moderation'] == "false") { $album_name = $course_name . "-pub"; } else { $album_name = $course_name . "-priv"; } if (!ezmam_album_exists($album_name)) {
/** * * @param string $album * @param string $asset * @param string $media * @return false|assoc_array * @desc returns metadata associated with a media. this returns an associative array with properties as key */ function ezmam_media_metadata_get($album, $asset, $media) { $repository_path = ezmam_repository_path(); if ($repository_path === false) { return false; } if (!ezmam_album_exists($album)) { return false; } if (!ezmam_asset_exists($album, $asset)) { return false; } if (!ezmam_media_exists($album, $asset, $media)) { return false; } $media_path = $repository_path . "/" . $album . "/" . $asset . "/" . $media . "/"; $assoc_metadata = metadata2assoc_array($media_path . "_metadata.xml"); return $assoc_metadata; }
function update_originals_meta($album, $asset, $qtinfo_filepath) { $qtinfo_assoc = metadata2assoc_array($qtinfo_filepath); //dig media name according to qtinfo filename $qtinfofile = basename($qtinfo_filepath); list($quality, $type, $qtinfo) = explode("_", $qtinfofile); // first part is high/low $media = 'original_' . $type; $media_meta = ezmam_media_metadata_get($album, $asset, $media); $media_meta['duration'] = $qtinfo_assoc['duration']; $media_meta['height'] = $qtinfo_assoc['height']; $media_meta['width'] = $qtinfo_assoc['width']; if (isset($qtinfo_assoc['videoCodec'])) { $media_meta['videocodec'] = $qtinfo_assoc['videoCodec']; } if (isset($qtinfo_assoc['audioCodec'])) { $media_meta['audiocodec'] = $qtinfo_assoc['audioCodec']; } //update originals meta print "update media metadata {$album} {$asset} {$media}\n"; ezmam_media_metadata_set($album, $asset, $media, $media_meta); }
echo "usage: " . $argv[0] . " <directory_of_recording>\n Where <directory_of_recording> should point to a directory containing download_data.xml description file (relative to {$recorder_upload_dir})\n"; die; } $recording_dir = $argv[1]; //first (and only) parameter in command line $destrecording_path = $recorder_upload_dir . "/" . $recording_dir; //did the web application do a good job of creating directory and download (meta)datas? if (!file_exists($destrecording_path)) { //no myerror("could not find recording directory: {$destrecording_path}"); //log error } //local log file: $local_log_file = $destrecording_path . "/download.log"; //now get download data to start downloading $download_meta = metadata2assoc_array($destrecording_path . "/download_data.xml"); if ($download_meta === false) { myerror("bad xml or read problem on {$destrecording_path}" . "/download_data.xml"); } //log to file $request_date = $download_meta['request_date']; $course_name = $download_meta['course_name']; $record_date = $download_meta['record_date']; $download_complete = $download_meta['download_complete']; $record_type = $download_meta['record_type']; $recorder_version = $download_meta['recorder_version']; $recorder_php_cli = $download_meta['recorder_php_cli']; $caller_ip = $download_meta['caller_ip']; // Caller contains the metadata $meta_file = $download_meta['metadata_file']; $cam_protocol = $download_meta['cam_protocol'];