if ($series) { $smarty->assign('SERIES_DATA', $series->getAllWithIcon()); } // roles and contacts $smarty->assign('ROLES', $prg->getRoles()); // genre $smarty->assign('GENRE', $vocabularies->getGenreName($prg->get('genre_id'))); // topics //$smarty->assign('TOPICS', $prg->getTopics()); CP 201106: commented out because if active no topics are shown // language $smarty->assign('LANGUAGE', $prg->getLanguagesLocalized()); // rights sections $smarty->assign('RIGHTS', $prg->getAssociatedObjects('sotf_rights', 'start_time')); //check for recently converted files or transcoding in progress if ($prg->isVideoPrg()) { sotf_VideoFile::processTranscodingQueue($repository, $prg); } // content files $mainContentFiles = $prg->getAssociatedObjects('sotf_media_files', 'main_content DESC, filename'); $to = count($mainContentFiles); $flv_found = false; //ADDED BY Martin Schmidt for ($i = 0; $i < $to; $i++) { if ($prg->isLocal()) { // if local, we check if file disappeared in the meantime $path = $prg->getFilePath($mainContentFiles[$i]); if (!is_readable($path)) { debug("DISAPPEARED FILE", $path); unset($mainContentFiles[$i]); continue; }
$still_found = sotf_VideoFile::searchForStill($prg); if (!$still_found && $createstills) { sotf_VideoFile::createStills($files[0]->path, $files[0]->duration, $id); } } if ($missing) { // there was a missing file description, so we have to restart the whole process $page->redirectSelf(); exit; } $checker =& new sotf_ContentCheck($prgAudiolist); //todo $prgAudioList MEANT CONTENT $checker = $checker->selectType(); //check for recently converted files or transcoding in progress if ($video && $prgAudiolist->count()) { $list_changed = sotf_VideoFile::processTranscodingQueue($repository, $prg, $checker); if ($list_changed) { $page->redirectSelf(); exit; } } // compare with required formats $PRG_AUDIO = array(); for ($i = 0; $i < count($config[$checker->prefix . 'Formats']); $i++) { $PRG_AUDIO[$i] = array("format" => $checker->getFormatFileName($i), "index" => $i, "flv" => preg_match("/flv/", $checker->getFormatFileName($i))); if ($checker->reqs[$i][0]) { $fname = $prgAudiolist->list[$checker->reqs[$i][1]]->name; $PRG_AUDIO[$i] = array_merge($PRG_AUDIO[$i], $mainAudio[$fname]); //$PRG_AUDIO[$i]['name'] = $fname; unset($mainAudio[$fname]); } else {
function saveFileInfo($filepath, $mainContent = false) { global $db; // convert boolean into pgsql format if ($mainContent) { $mainContent = 'true'; } else { $mainContent = 'false'; } // get audio properties of file $file = new sotf_AudioFile($filepath); //ADDED BY BUDDHAFLY 06-02-20 if ($file->isVideo()) { $file = new sotf_VideoFile($filepath); } //-------------------------- // find if this is an existing file if ($file->isAudio() || $file->isVideo()) { //CHANGED BY BUDDHAFLY 06-02-20 $fileInfo = new sotf_NodeObject('sotf_media_files'); } else { $fileInfo = new sotf_NodeObject('sotf_other_files'); } $fileInfo->set("prog_id", $this->id); $fileInfo->set("filename", $file->name); $fileInfo->find(); // save file info into database //ADDED BY BUDDHAFLY 06-02-20 if ($file->isVideo()) { $fileInfo->set('play_length', round($file->duration)); $fileInfo->set('type', $file->type); if (is_numeric($file->bitrate)) { // constant bitrate $fileInfo->set('kbps', round($file->bitrate)); $fileInfo->set('vbr', 'f'); } else { // variable bitrate $fileInfo->set('kbps', round($file->average_bitrate)); $fileInfo->set('vbr', 't'); } $fileInfo->set('format', $file->getFormatFilename()); $fileInfo->set('main_content', $mainContent); $fileInfo->set('codec', $file->codec); $fileInfo->set('frame_rate', $file->frame_rate); $fileInfo->set('resolution_x', $file->resolution_x); $fileInfo->set('resolution_y', $file->resolution_y); $fileInfo->set('pixel_aspect_ratio', $file->pixel_aspect_ratio); //manage access rights for video $fileInfo->set('download_access', 't'); $fileInfo->set('stream_access', 'f'); } else { if ($file->isAudio()) { $fileInfo->set('play_length', round($file->duration)); $fileInfo->set('type', $file->type); if (is_numeric($file->bitrate)) { // constant bitrate $fileInfo->set('kbps', round($file->bitrate)); $fileInfo->set('vbr', 'f'); } else { // variable bitrate $fileInfo->set('kbps', round($file->average_bitrate)); $fileInfo->set('vbr', 't'); } $fileInfo->set('format', $file->getFormatFilename()); $fileInfo->set('main_content', $mainContent); } } $fstat = stat($filepath); $fileInfo->set('filesize', $fstat['size']); $fileInfo->set('last_modified', $db->getTimestampTz($fstat['mtime'])); $fileInfo->set('mime_type', $file->mimetype); $success = $fileInfo->save(); //if(!$success) // raiseError("could not write into database"); // change id3 tags in file $this->saveID3($file); return $fileInfo->id; }