本文整理匯總了PHP中myEntryUtils::createThumbnailFromEntry方法的典型用法代碼示例。如果您正苦於以下問題:PHP myEntryUtils::createThumbnailFromEntry方法的具體用法?PHP myEntryUtils::createThumbnailFromEntry怎麽用?PHP myEntryUtils::createThumbnailFromEntry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類myEntryUtils
的用法示例。
在下文中一共展示了myEntryUtils::createThumbnailFromEntry方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
if (!$puser_kuser) {
$this->addError(APIErrors::INVALID_USER_ID, $puser_id);
return;
}
$time_offset = $this->getPM("time_offset");
$entry_ids = $this->getPM("entry_ids");
$detailed = $this->getP("detailed", false);
$separator = $this->getP("separator", ",");
$id_arr = explode($separator, $entry_ids);
$limit = 50;
$id_arr = array_splice($id_arr, 0, $limit);
$entries = entryPeer::retrieveByPKs($id_arr);
$updated_entries = array();
if (!$entries) {
$this->addError(APIErrors::INVALID_ENTRY_IDS, $entry_ids);
} else {
foreach ($entries as $entry) {
if (!myEntryUtils::createThumbnailFromEntry($entry, $entry, $time_offset)) {
$this->addError(APIErrors::INVALID_ENTRY_TYPE, "ENTRY_TYPE_MEDIACLIP [" . $entry->getId() . "]");
continue;
}
$updated_entries[] = $entry;
myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE_THUMBNAIL, $entry);
$wrapper = objectWrapperBase::getWrapperClass($entry, objectWrapperBase::DETAIL_LEVEL_DETAILED);
$wrapper->removeFromCache("entry", $entry->getId());
}
}
$this->addMsg("entries", objectWrapperBase::getWrapperClass($updated_entries, objectWrapperBase::DETAIL_LEVEL_REGULAR));
}
示例2: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
if (!$puser_kuser) {
$this->addError(APIErrors::INVALID_USER_ID, $puser_id);
return;
}
$entry_id = $this->getPM("entry_id");
$entry = entryPeer::retrieveByPK($entry_id);
// TODO - verify the user is allowed to modify the entry
$source_entry_id = $this->getP("source_entry_id");
if ($source_entry_id) {
$source_entry = entryPeer::retrieveByPK($source_entry_id);
if (!$source_entry) {
return;
}
} else {
$source_entry = $entry;
}
$time_offset = $this->getP("time_offset", -1);
if (!myEntryUtils::createThumbnailFromEntry($entry, $source_entry, $time_offset)) {
$this->addError(APIErrors::INVALID_ENTRY_TYPE, "ENTRY_TYPE_MEDIACLIP");
return;
}
if ($entry->getType() == entryType::MIX) {
/*
$roughcutPath = myContentStorage::getFSContentRootPath() . $entry->getDataPath(); // replaced__getDataPath
$xml_doc = new DOMDocument();
$xml_doc->load( $roughcutPath );
if (myMetadataUtils::updateThumbUrl($xml_doc, $entry->getThumbnailUrl()))
$xml_doc->save($roughcutPath);
*/
$sync_key = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
$xml_doc = new DOMDocument();
$xml_doc->loadXML(kFileSyncUtils::file_get_contents($sync_key));
if (myMetadataUtils::updateThumbUrl($xml_doc, $entry->getThumbnailUrl())) {
$entry->setMetadata(null, $xml_doc->saveXML(), true, null, null);
//$entry->getVersion() );
}
myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE_THUMBNAIL, $entry);
}
$wrapper = objectWrapperBase::getWrapperClass($entry, objectWrapperBase::DETAIL_LEVEL_DETAILED);
$wrapper->removeFromCache("entry", $entry->getId());
$this->addMsg("entry", $wrapper);
}
示例3: updateThumbnailForEntryFromSourceEntry
protected function updateThumbnailForEntryFromSourceEntry($entryId, $sourceEntryId, $timeOffset, $entryType = null, $flavorParamsId = null)
{
$dbEntry = entryPeer::retrieveByPK($entryId);
if (!$dbEntry || $entryType !== null && $dbEntry->getType() != $entryType) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
}
$sourceDbEntry = entryPeer::retrieveByPK($sourceEntryId);
if (!$sourceDbEntry || $sourceDbEntry->getType() != KalturaEntryType::MEDIA_CLIP) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $sourceDbEntry);
}
// if session is not admin, we should check that the user that is updating the thumbnail is the one created the entry
if (!$this->getKs() || !$this->getKs()->isAdmin()) {
if (strtolower($dbEntry->getPuserId()) !== strtolower($this->getKs()->user)) {
throw new KalturaAPIException(KalturaErrors::PERMISSION_DENIED_TO_UPDATE_ENTRY);
}
}
$updateThumbnailResult = myEntryUtils::createThumbnailFromEntry($dbEntry, $sourceDbEntry, $timeOffset, $flavorParamsId);
if (!$updateThumbnailResult) {
throw new KalturaAPIException(KalturaErrors::INTERNAL_SERVERL_ERROR);
}
try {
$wrapper = objectWrapperBase::getWrapperClass($dbEntry);
$wrapper->removeFromCache("entry", $dbEntry->getId());
} catch (Exception $e) {
KalturaLog::err($e);
}
myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE_THUMBNAIL, $dbEntry, $dbEntry->getPartnerId(), $dbEntry->getPuserId(), null, null, $entryId);
$ks = $this->getKs();
$isAdmin = false;
if ($ks) {
$isAdmin = $ks->isAdmin();
}
$mediaEntry = KalturaEntryFactory::getInstanceByType($dbEntry->getType(), $isAdmin);
$mediaEntry->fromObject($dbEntry, $this->getResponseProfile());
return $mediaEntry;
}
示例4: updateConvertedEntry
private function updateConvertedEntry($ok, $entry, kConversionResult $conv_res)
{
$file_before_conversion = $conv_res->conv_cmd->source_file;
$file_after_conversion = $conv_res->conv_cmd->target_file;
// TODO -get all targets
if ($ok == true) {
// TODO - write all targets not only primary one
KalturaLog::debug("File [{$file_before_conversion}] converted OK to [{$file_after_conversion}]");
try {
// TODO - do we need to create the helpers eagerly ??
// $this->createFlvWrappersForTargets( $conv_res );
} catch (Exception $ex) {
KalturaLog::debug("Error while creating helper files for [{$file_after_conversion}]");
}
$entry->setStatusReady();
} else {
KalturaLog::debug("Problem converting file [{$file_before_conversion}]");
$entry->setStatus(entryStatus::ERROR_CONVERTING);
}
$this->updateConversionInDb($entry, $conv_res);
// loop until the file is really ready - sometimes the size of the file or the mtime is wrong
for ($i = 0; $i < 15; $i++) {
clearstatcache();
if (!file_exists($file_after_conversion) || filesize($file_after_conversion) == 0) {
// KalturaLog::debug ( "Entry id [" . $entry->getId() . "] printing file stats: " . print_r( stat ($file_after_conversion ) , true ) );
KalturaLog::debug("Entry id [" . $entry->getId() . "]. no such file [{$file_after_conversion}]. Sleeping for 1 second for the [{$i}] time.");
sleep(2);
} else {
break;
}
}
KalturaLog::debug("Entry id [" . $entry->getId() . "] setting duration");
$entry->setLengthInMsecs(kConversionHelper::getFlvDuration($file_after_conversion));
KalturaLog::debug("Entry id [" . $entry->getId() . "] duration [" . $entry->getLengthInMsecs() . "]");
// how could it be otherwise ??
if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_VIDEO) {
// TODO - move out of this function if the partner is required for more configurations
$partner = PartnerPeer::retrieveByPK($entry->getPartnerId());
// TODO - make sure the width & height of the target are part of the kConversionReulst
// if ( $conversion_info ) $entry->setDimensions ( $conversion_info->video_width , $conversion_info->video_height );
$offset = $entry->getBestThumbOffset($partner->getDefThumbOffset());
KalturaLog::debug("Entry id [" . $entry->getId() . "] Thumb offset: [{$offset}]");
// first create the thumb for the entry
myEntryUtils::createThumbnailFromEntry($entry, $entry, $offset);
// then make sure it will propage to the roughcut if needed
myEntryUtils::createRoughcutThumbnailFromEntry($entry, false);
$entry->updateVideoDimensions();
KalturaLog::debug("Entry id [" . $entry->getId() . "] dimensions: [" . $entry->getWidth() . "x" . $entry->getHeight() . "]");
}
// send notification - regardless its status
myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE, $entry);
$entry->save();
}