当前位置: 首页>>代码示例>>PHP>>正文


PHP kFileSyncUtils::createSyncFileLinkForKey方法代码示例

本文整理汇总了PHP中kFileSyncUtils::createSyncFileLinkForKey方法的典型用法代码示例。如果您正苦于以下问题:PHP kFileSyncUtils::createSyncFileLinkForKey方法的具体用法?PHP kFileSyncUtils::createSyncFileLinkForKey怎么用?PHP kFileSyncUtils::createSyncFileLinkForKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kFileSyncUtils的用法示例。


在下文中一共展示了kFileSyncUtils::createSyncFileLinkForKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: copyDistributionProfiles

 /**
  * @param int $fromPartnerId
  * @param int $toPartnerId
  */
 protected function copyDistributionProfiles($fromPartnerId, $toPartnerId)
 {
     $c = new Criteria();
     $c->add(DistributionProfilePeer::PARTNER_ID, $fromPartnerId);
     $distributionProfiles = DistributionProfilePeer::doSelect($c);
     foreach ($distributionProfiles as $distributionProfile) {
         $newDistributionProfile = $distributionProfile->copy();
         $newDistributionProfile->setPartnerId($toPartnerId);
         $newDistributionProfile->save();
         kFileSyncUtils::createSyncFileLinkForKey($newDistributionProfile->getSyncKey(DistributionProfile::FILE_SYNC_DISTRIBUTION_PROFILE_CONFIG), $distributionProfile->getSyncKey(DistributionProfile::FILE_SYNC_DISTRIBUTION_PROFILE_CONFIG));
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:16,代码来源:kContentDistributionObjectCopiedHandler.php

示例2: copyMetadataProfiles

 /**
  * @param int $fromPartnerId
  * @param int $toPartnerId
  */
 protected function copyMetadataProfiles($fromPartnerId, $toPartnerId)
 {
     KalturaLog::debug("Copy metadata profiles from [{$fromPartnerId}] to [{$toPartnerId}]");
     $c = new Criteria();
     $c->add(MetadataProfilePeer::PARTNER_ID, $fromPartnerId);
     $metadataProfiles = MetadataProfilePeer::doSelect($c);
     foreach ($metadataProfiles as $metadataProfile) {
         $newMetadataProfile = $metadataProfile->copy();
         $newMetadataProfile->setPartnerId($toPartnerId);
         $newMetadataProfile->save();
         kFileSyncUtils::createSyncFileLinkForKey($newMetadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_DEFINITION), $metadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_DEFINITION), false);
         kFileSyncUtils::createSyncFileLinkForKey($newMetadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_VIEWS), $metadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_VIEWS), false);
         $metadataProfileFields = MetadataProfileFieldPeer::retrieveByMetadataProfileId($metadataProfile->getId());
         foreach ($metadataProfileFields as $metadataProfileField) {
             $newMetadataProfileField = $metadataProfileField->copy();
             $newMetadataProfileField->setMetadataProfileId($newMetadataProfile->getId());
             $newMetadataProfileField->setPartnerId($toPartnerId);
             $newMetadataProfileField->save();
         }
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:25,代码来源:kMetadataObjectCopiedHandler.php

示例3: copyEventNotificationTemplates

 /**
  * @param Partner $fromPartner
  * @param Partner $toPartner
  */
 protected function copyEventNotificationTemplates(Partner $fromPartner, Partner $toPartner, $permissionRequiredOnly = false)
 {
     $fromPartnerId = $fromPartner->getId();
     $toPartnerId = $toPartner->getId();
     KalturaLog::debug("Copy event-notification templates from [{$fromPartnerId}] to [{$toPartnerId}]");
     $c = new Criteria();
     $c->add(EventNotificationTemplatePeer::PARTNER_ID, $fromPartnerId);
     $systemNameCriteria = new Criteria();
     $systemNameCriteria->add(EventNotificationTemplatePeer::PARTNER_ID, $toPartnerId);
     $systemNameCriteria->add(EventNotificationTemplatePeer::STATUS, EventNotificationTemplateStatus::ACTIVE);
     $eventNotificationTemplates = EventNotificationTemplatePeer::doSelect($c);
     foreach ($eventNotificationTemplates as $eventNotificationTemplate) {
         /* @var $eventNotificationTemplate EventNotificationTemplate */
         if ($permissionRequiredOnly && !count($eventNotificationTemplate->getRequiredCopyTemplatePermissions())) {
             continue;
         }
         if (!myPartnerUtils::isPartnerPermittedForCopy($toPartner, $eventNotificationTemplate->getRequiredCopyTemplatePermissions())) {
             continue;
         }
         if ($eventNotificationTemplate->getSystemName()) {
             $c = clone $systemNameCriteria;
             $c->add(EventNotificationTemplatePeer::SYSTEM_NAME, $eventNotificationTemplate->getSystemName());
             if (EventNotificationTemplatePeer::doCount($c)) {
                 continue;
             }
         }
         $newEventNotificationTemplate = $eventNotificationTemplate->copy();
         $newEventNotificationTemplate->setPartnerId($toPartnerId);
         $newEventNotificationTemplate->save();
         if ($eventNotificationTemplate instanceof ISyncableFile) {
             $key = $eventNotificationTemplate->getSyncKey(1);
             if (kFileSyncUtils::fileSync_exists($key)) {
                 kFileSyncUtils::createSyncFileLinkForKey($newEventNotificationTemplate->getSyncKey(1), $key);
             }
         }
     }
 }
开发者ID:AdiTal,项目名称:server,代码行数:41,代码来源:kEventNotificationObjectCopiedHandler.php

示例4: attachFileSync

 /**
  * @param AttachmentAsset $attachmentAsset
  * @param FileSyncKey $srcSyncKey
  */
 protected function attachFileSync(AttachmentAsset $attachmentAsset, FileSyncKey $srcSyncKey)
 {
     $attachmentAsset->incrementVersion();
     $attachmentAsset->save();
     $newSyncKey = $attachmentAsset->getSyncKey(AttachmentAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
     kFileSyncUtils::createSyncFileLinkForKey($newSyncKey, $srcSyncKey);
     $finalPath = kFileSyncUtils::getLocalFilePathForKey($newSyncKey);
     list($width, $height, $type, $attr) = getimagesize($finalPath);
     $attachmentAsset->setWidth($width);
     $attachmentAsset->setHeight($height);
     $attachmentAsset->setSize(kFile::fileSize($finalPath));
     $attachmentAsset->setStatus(AttachmentAsset::ASSET_STATUS_READY);
     $attachmentAsset->save();
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:18,代码来源:AttachmentAssetService.php

示例5: copyMetadataProfiles

 /**
  * @param Partner $fromPartner
  * @param Partner $toPartner
  */
 protected function copyMetadataProfiles(Partner $fromPartner, Partner $toPartner, $permissionRequiredOnly = false)
 {
     $fromPartnerId = $fromPartner->getId();
     $toPartnerId = $toPartner->getId();
     KalturaLog::debug("Copy metadata profiles from [{$fromPartnerId}] to [{$toPartnerId}]");
     $c = new Criteria();
     $c->add(MetadataProfilePeer::PARTNER_ID, $fromPartnerId);
     $systemNameCriteria = new Criteria();
     $systemNameCriteria->add(MetadataProfilePeer::PARTNER_ID, $toPartnerId);
     $systemNameCriteria->add(MetadataProfilePeer::STATUS, MetadataProfile::STATUS_ACTIVE);
     $metadataProfiles = MetadataProfilePeer::doSelect($c);
     foreach ($metadataProfiles as $metadataProfile) {
         /* @var $metadataProfile MetadataProfile */
         if ($permissionRequiredOnly && !count($metadataProfile->getRequiredCopyTemplatePermissions())) {
             continue;
         }
         if (!myPartnerUtils::isPartnerPermittedForCopy($toPartner, $metadataProfile->getRequiredCopyTemplatePermissions())) {
             continue;
         }
         if ($metadataProfile->getSystemName()) {
             $c = clone $systemNameCriteria;
             $c->add(MetadataProfilePeer::SYSTEM_NAME, $metadataProfile->getSystemName());
             if (MetadataProfilePeer::doCount($c)) {
                 continue;
             }
         }
         $newMetadataProfile = $metadataProfile->copy();
         $newMetadataProfile->setPartnerId($toPartnerId);
         $newMetadataProfile->save();
         kFileSyncUtils::createSyncFileLinkForKey($newMetadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_DEFINITION), $metadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_DEFINITION));
         kFileSyncUtils::createSyncFileLinkForKey($newMetadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_VIEWS), $metadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_VIEWS));
         kFileSyncUtils::createSyncFileLinkForKey($newMetadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_XSLT), $metadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_XSLT));
         $metadataProfileFields = MetadataProfileFieldPeer::retrieveByMetadataProfileId($metadataProfile->getId());
         foreach ($metadataProfileFields as $metadataProfileField) {
             $newMetadataProfileField = $metadataProfileField->copy();
             $newMetadataProfileField->setMetadataProfileId($newMetadataProfile->getId());
             $newMetadataProfileField->setPartnerId($toPartnerId);
             $newMetadataProfileField->save();
         }
     }
 }
开发者ID:kubrickfr,项目名称:server,代码行数:45,代码来源:kMetadataObjectCopiedHandler.php

示例6: decideThumbGenerate


//.........这里部分代码省略.........
             $srcAsset = flavorAssetPeer::retrieveHighestBitrateByEntryId($entry->getId());
         }
     }
     if (is_null($srcAsset)) {
         throw new APIException(APIErrors::FLAVOR_ASSET_IS_NOT_READY);
     }
     $errDescription = null;
     $mediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($srcAsset->getId());
     $destThumbParamsOutput = self::validateThumbAndMediaInfo($destThumbParams, $mediaInfo, $errDescription);
     $thumbAsset = thumbAssetPeer::retrieveByEntryIdAndParams($entry->getId(), $destThumbParams->getId());
     if ($thumbAsset) {
         $description = $thumbAsset->getDescription() . "\n" . $errDescription;
         $thumbAsset->setDescription($description);
     } else {
         $thumbAsset = new thumbAsset();
         $thumbAsset->setPartnerId($entry->getPartnerId());
         $thumbAsset->setEntryId($entry->getId());
         $thumbAsset->setDescription($errDescription);
         $thumbAsset->setFlavorParamsId($destThumbParams->getId());
     }
     $thumbAsset->incrementVersion();
     $thumbAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_CONVERTING);
     $thumbAsset->setTags($destThumbParamsOutput->getTags());
     $thumbAsset->setFileExt($destThumbParamsOutput->getFileExt());
     if (!$destThumbParamsOutput) {
         $thumbAsset->setStatus(thumbAsset::FLAVOR_ASSET_STATUS_ERROR);
         $thumbAsset->save();
         return null;
     }
     $thumbAsset->save();
     // save flavor params
     $destThumbParamsOutput->setPartnerId($entry->getPartnerId());
     $destThumbParamsOutput->setEntryId($entry->getId());
     $destThumbParamsOutput->setFlavorAssetId($thumbAsset->getId());
     $destThumbParamsOutput->setFlavorAssetVersion($thumbAsset->getVersion());
     $destThumbParamsOutput->save();
     $srcSyncKey = $srcAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     $srcAssetType = $srcAsset->getType();
     if (!$runSync) {
         $job = kJobsManager::addCapturaThumbJob($parentJob, $entry->getPartnerId(), $entry->getId(), $thumbAsset->getId(), $srcSyncKey, $srcAssetType, $destThumbParamsOutput);
         return $thumbAsset;
     }
     $errDescription = null;
     $capturedPath = self::generateThumbnail($srcAsset, $destThumbParamsOutput, $errDescription);
     // failed
     if (!$capturedPath) {
         $thumbAsset->incrementVersion();
         $thumbAsset->setStatus(thumbAsset::FLAVOR_ASSET_STATUS_ERROR);
         $thumbAsset->setDescription($thumbAsset->getDescription() . "\n{$errDescription}");
         $thumbAsset->save();
         return $thumbAsset;
     }
     $thumbAsset->incrementVersion();
     $thumbAsset->setStatus(thumbAsset::FLAVOR_ASSET_STATUS_READY);
     if (file_exists($capturedPath)) {
         list($width, $height, $type, $attr) = getimagesize($capturedPath);
         $thumbAsset->setWidth($width);
         $thumbAsset->setHeight($height);
         $thumbAsset->setSize(filesize($capturedPath));
     }
     $logPath = $capturedPath . '.log';
     if (file_exists($logPath)) {
         $thumbAsset->incLogFileVersion();
         $thumbAsset->save();
         // creats the file sync
         $logSyncKey = $thumbAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_CONVERT_LOG);
         kFileSyncUtils::moveFromFile($logPath, $logSyncKey);
         KalturaLog::debug("Log archived file to: " . kFileSyncUtils::getLocalFilePathForKey($logSyncKey));
     } else {
         $thumbAsset->save();
     }
     $syncKey = $thumbAsset->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     kFileSyncUtils::moveFromFile($capturedPath, $syncKey);
     KalturaLog::debug("Thumbnail archived file to: " . kFileSyncUtils::getLocalFilePathForKey($syncKey));
     if ($thumbAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
         // increment thumbnail version
         $entry->setThumbnail(".jpg");
         $entry->save();
         $entrySyncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
         $syncFile = kFileSyncUtils::createSyncFileLinkForKey($entrySyncKey, $syncKey, false);
         if ($syncFile) {
             // removes the DEFAULT_THUMB tag from all other thumb assets
             $entryThumbAssets = thumbAssetPeer::retrieveByEntryId($thumbAsset->getEntryId());
             foreach ($entryThumbAssets as $entryThumbAsset) {
                 if ($entryThumbAsset->getId() == $thumbAsset->getId()) {
                     continue;
                 }
                 if (!$entryThumbAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
                     continue;
                 }
                 $entryThumbAsset->removeTags(array(thumbParams::TAG_DEFAULT_THUMB));
                 $entryThumbAsset->save();
             }
         }
     }
     if (!is_null($thumbAsset->getFlavorParamsId())) {
         kFlowHelper::generateThumbnailsFromFlavor($thumbAsset->getEntryId(), null, $thumbAsset->getFlavorParamsId());
     }
     return $thumbAsset;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:101,代码来源:kBusinessPreConvertDL.php

示例7: addEntryFromFlavorAsset

 protected function addEntryFromFlavorAsset(KalturaBaseEntry $newEntry, entry $srcEntry, flavorAsset $srcFlavorAsset)
 {
     $newEntry->type = $srcEntry->getType();
     if ($newEntry->name === null) {
         $newEntry->name = $srcEntry->getName();
     }
     if ($newEntry->description === null) {
         $newEntry->description = $srcEntry->getDescription();
     }
     if ($newEntry->creditUrl === null) {
         $newEntry->creditUrl = $srcEntry->getSourceLink();
     }
     if ($newEntry->creditUserName === null) {
         $newEntry->creditUserName = $srcEntry->getCredit();
     }
     if ($newEntry->tags === null) {
         $newEntry->tags = $srcEntry->getTags();
     }
     $newEntry->sourceType = KalturaSourceType::SEARCH_PROVIDER;
     $newEntry->searchProviderType = KalturaSearchProviderType::KALTURA;
     $dbEntry = $this->prepareEntryForInsert($newEntry);
     $dbEntry->setSourceId($srcEntry->getId());
     $kshow = $this->createDummyKShow();
     $kshowId = $kshow->getId();
     $msg = null;
     $flavorAsset = kFlowHelper::createOriginalFlavorAsset($this->getPartnerId(), $dbEntry->getId(), $msg);
     if (!$flavorAsset) {
         KalturaLog::err("Flavor asset not created for entry [" . $dbEntry->getId() . "] reason [{$msg}]");
         if ($dbEntry->getStatus() == entryStatus::NO_CONTENT) {
             $dbEntry->setStatus(entryStatus::ERROR_CONVERTING);
             $dbEntry->save();
         }
         throw new KalturaAPIException(KalturaErrors::ORIGINAL_FLAVOR_ASSET_NOT_CREATED, $msg);
     }
     $srcSyncKey = $srcFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     $newSyncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     kFileSyncUtils::createSyncFileLinkForKey($newSyncKey, $srcSyncKey);
     kEventsManager::raiseEvent(new kObjectAddedEvent($flavorAsset));
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry);
     $newEntry->fromObject($dbEntry, $this->getResponseProfile());
     return $newEntry;
 }
开发者ID:DBezemer,项目名称:server,代码行数:42,代码来源:KalturaEntryService.php

示例8: handleCaptureThumbFinished

 /**
  * @param BatchJob $dbBatchJob
  * @param kCaptureThumbJobData $data
  * @param BatchJob $twinJob
  * @return BatchJob
  */
 public static function handleCaptureThumbFinished(BatchJob $dbBatchJob, kCaptureThumbJobData $data, BatchJob $twinJob = null)
 {
     KalturaLog::debug("Captire thumbnail finished with destination file: " . $data->getThumbPath());
     if ($dbBatchJob->getAbort()) {
         return $dbBatchJob;
     }
     // verifies that thumb asset created
     if (!$data->getThumbAssetId()) {
         throw new APIException(APIErrors::INVALID_THUMB_ASSET_ID, $data->getThumbAssetId());
     }
     $thumbAsset = thumbAssetPeer::retrieveById($data->getThumbAssetId());
     // verifies that thumb asset exists
     if (!$thumbAsset) {
         throw new APIException(APIErrors::INVALID_THUMB_ASSET_ID, $data->getThumbAssetId());
     }
     $thumbAsset->incrementVersion();
     $thumbAsset->setStatus(thumbAsset::FLAVOR_ASSET_STATUS_READY);
     if (file_exists($data->getThumbPath())) {
         list($width, $height, $type, $attr) = getimagesize($data->getThumbPath());
         $thumbAsset->setWidth($width);
         $thumbAsset->setHeight($height);
         $thumbAsset->setSize(filesize($data->getThumbPath()));
     }
     $logPath = $data->getThumbPath() . '.log';
     if (file_exists($logPath)) {
         $thumbAsset->incLogFileVersion();
         $thumbAsset->save();
         // creats the file sync
         $logSyncKey = $thumbAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_CONVERT_LOG);
         try {
             kFileSyncUtils::moveFromFile($logPath, $logSyncKey);
         } catch (Exception $e) {
             $err = 'Saving conversion log: ' . $e->getMessage();
             KalturaLog::err($err);
             $desc = $dbBatchJob->getDescription() . "\n" . $err;
             $dbBatchJob->getDescription($desc);
         }
     } else {
         $thumbAsset->save();
     }
     $syncKey = $thumbAsset->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     kFileSyncUtils::moveFromFile($data->getThumbPath(), $syncKey);
     $data->setThumbPath(kFileSyncUtils::getLocalFilePathForKey($syncKey));
     KalturaLog::debug("Thumbnail archived file to: " . $data->getThumbPath());
     // save the data changes to the db
     $dbBatchJob->setData($data);
     $dbBatchJob->save();
     if ($thumbAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
         $entry = $dbBatchJob->getEntry(false, false);
         if (!$entry) {
             throw new APIException(APIErrors::INVALID_ENTRY, $dbBatchJob, $dbBatchJob->getEntryId());
         }
         // increment thumbnail version
         $entry->setThumbnail(".jpg");
         $entry->save();
         $entrySyncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
         $syncFile = kFileSyncUtils::createSyncFileLinkForKey($entrySyncKey, $syncKey, false);
         if ($syncFile) {
             // removes the DEFAULT_THUMB tag from all other thumb assets
             $entryThumbAssets = thumbAssetPeer::retrieveByEntryId($thumbAsset->getEntryId());
             foreach ($entryThumbAssets as $entryThumbAsset) {
                 if ($entryThumbAsset->getId() == $thumbAsset->getId()) {
                     continue;
                 }
                 if (!$entryThumbAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
                     continue;
                 }
                 $entryThumbAsset->removeTags(array(thumbParams::TAG_DEFAULT_THUMB));
                 $entryThumbAsset->save();
             }
         }
     }
     if (!is_null($thumbAsset->getFlavorParamsId())) {
         kFlowHelper::generateThumbnailsFromFlavor($dbBatchJob->getEntryId(), $dbBatchJob, $thumbAsset->getFlavorParamsId());
     }
     return $dbBatchJob;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:83,代码来源:kFlowHelper.php

示例9: decideThumbGenerate


//.........这里部分代码省略.........
             $destThumbParamsOutput->setDensity($partner->getDefThumbDensity());
         }
     }
     $thumbAsset = assetPeer::retrieveByEntryIdAndParams($entry->getId(), $destThumbParams->getId());
     if ($thumbAsset) {
         $description = $thumbAsset->getDescription() . "\n" . $errDescription;
         $thumbAsset->setDescription($description);
     } else {
         $thumbAsset = new thumbAsset();
         $thumbAsset->setPartnerId($entry->getPartnerId());
         $thumbAsset->setEntryId($entry->getId());
         $thumbAsset->setDescription($errDescription);
         $thumbAsset->setFlavorParamsId($destThumbParams->getId());
     }
     $thumbAsset->incrementVersion();
     $thumbAsset->setTags($destThumbParamsOutput->getTags());
     $thumbAsset->setFileExt($destThumbParamsOutput->getFileExt());
     if ($thumbAsset->getStatus() != asset::ASSET_STATUS_READY) {
         $thumbAsset->setStatus(asset::ASSET_STATUS_CONVERTING);
     }
     //Sets the default thumb if this the only default thumb
     kBusinessPreConvertDL::setIsDefaultThumb($thumbAsset);
     if (!$destThumbParamsOutput) {
         $thumbAsset->setStatus(thumbAsset::FLAVOR_ASSET_STATUS_ERROR);
         $thumbAsset->save();
         return null;
     }
     $thumbAsset->save();
     // save flavor params
     $destThumbParamsOutput->setPartnerId($entry->getPartnerId());
     $destThumbParamsOutput->setEntryId($entry->getId());
     $destThumbParamsOutput->setFlavorAssetId($thumbAsset->getId());
     $destThumbParamsOutput->setFlavorAssetVersion($thumbAsset->getVersion());
     $destThumbParamsOutput->save();
     $srcSyncKey = $srcAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     $srcAssetType = $srcAsset->getType();
     if (!$runSync) {
         $job = kJobsManager::addCapturaThumbJob($parentJob, $entry->getPartnerId(), $entry->getId(), $thumbAsset->getId(), $srcSyncKey, $srcAsset->getId(), $srcAssetType, $destThumbParamsOutput);
         return $thumbAsset;
     }
     $errDescription = null;
     // Since this method is called when trying to crop an existing thumbnail, need to add this check - thumbAssets have no mediaInfo.
     $capturedPath = self::generateThumbnail($srcAsset, $destThumbParamsOutput, $errDescription, $mediaInfo ? $mediaInfo->getVideoRotation() : null);
     // failed
     if (!$capturedPath) {
         $thumbAsset->incrementVersion();
         $thumbAsset->setStatus(thumbAsset::FLAVOR_ASSET_STATUS_ERROR);
         $thumbAsset->setDescription($thumbAsset->getDescription() . "\n{$errDescription}");
         $thumbAsset->save();
         return $thumbAsset;
     }
     $thumbAsset->incrementVersion();
     $thumbAsset->setStatus(thumbAsset::FLAVOR_ASSET_STATUS_READY);
     if (file_exists($capturedPath)) {
         list($width, $height, $type, $attr) = getimagesize($capturedPath);
         $thumbAsset->setWidth($width);
         $thumbAsset->setHeight($height);
         $thumbAsset->setSize(filesize($capturedPath));
     }
     $logPath = $capturedPath . '.log';
     if (file_exists($logPath)) {
         $thumbAsset->incLogFileVersion();
         $thumbAsset->save();
         // creats the file sync
         $logSyncKey = $thumbAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_CONVERT_LOG);
         kFileSyncUtils::moveFromFile($logPath, $logSyncKey);
         KalturaLog::debug("Log archived file to: " . kFileSyncUtils::getLocalFilePathForKey($logSyncKey));
     } else {
         $thumbAsset->save();
     }
     $syncKey = $thumbAsset->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     kFileSyncUtils::moveFromFile($capturedPath, $syncKey);
     KalturaLog::debug("Thumbnail archived file to: " . kFileSyncUtils::getLocalFilePathForKey($syncKey));
     if ($thumbAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
         // increment thumbnail version
         $entry->setThumbnail(".jpg");
         $entry->setCreateThumb(false);
         $entry->save();
         $entrySyncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
         $syncFile = kFileSyncUtils::createSyncFileLinkForKey($entrySyncKey, $syncKey);
         if ($syncFile) {
             // removes the DEFAULT_THUMB tag from all other thumb assets
             $entryThumbAssets = assetPeer::retrieveThumbnailsByEntryId($thumbAsset->getEntryId());
             foreach ($entryThumbAssets as $entryThumbAsset) {
                 if ($entryThumbAsset->getId() == $thumbAsset->getId()) {
                     continue;
                 }
                 if (!$entryThumbAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
                     continue;
                 }
                 $entryThumbAsset->removeTags(array(thumbParams::TAG_DEFAULT_THUMB));
                 $entryThumbAsset->save();
             }
         }
     }
     if (!is_null($thumbAsset->getFlavorParamsId())) {
         kFlowHelper::generateThumbnailsFromFlavor($thumbAsset->getEntryId(), null, $thumbAsset->getFlavorParamsId());
     }
     return $thumbAsset;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:101,代码来源:kBusinessPreConvertDL.php

示例10: decideSourceFlavorConvert

 private static function decideSourceFlavorConvert($entryId, assetParams $sourceFlavor = null, flavorAsset $originalFlavorAsset, $conversionProfileId, $flavors, mediaInfo $mediaInfo = null, BatchJob $parentJob, BatchJob $convertProfileJob)
 {
     if ($sourceFlavor && ($sourceFlavor->getOperators() || $sourceFlavor->getConversionEngines()) && $originalFlavorAsset->getInterFlowCount() == null) {
         KalturaLog::log("Source flavor asset requires conversion");
         self::adjustAssetParams($entryId, array($sourceFlavor));
         $srcSyncKey = $originalFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
         $errDescription = null;
         $sourceFlavorOutput = self::validateFlavorAndMediaInfo($sourceFlavor, $mediaInfo, $errDescription);
         if (!$sourceFlavorOutput) {
             if (!$errDescription) {
                 $errDescription = "Failed to create flavor params output from source flavor";
             }
             $originalFlavorAsset->setDescription($originalFlavorAsset->getDescription() . "\n{$errDescription}");
             $originalFlavorAsset->setStatus(flavorAsset::ASSET_STATUS_ERROR);
             $originalFlavorAsset->save();
             kBatchManager::updateEntry($entryId, entryStatus::ERROR_CONVERTING);
             kJobsManager::updateBatchJob($convertProfileJob, BatchJob::BATCHJOB_STATUS_FAILED);
             return false;
         }
     } elseif ($mediaInfo) {
         /*
          * Check whether there is a need for an intermediate source pre-processing
          */
         $sourceFlavorOutput = KDLWrap::GenerateIntermediateSource($mediaInfo, $flavors);
         if (!$sourceFlavorOutput) {
             return true;
         }
         $srcSyncKey = $originalFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
         $errDescription = null;
         /*
          * Save the original source asset in another asset, in order 
          * to prevent its liquidated by the inter-source asset.
          * But, do it only if the conversion profile contains source flavor
          */
         if ($sourceFlavor) {
             $sourceAsset = assetPeer::retrieveById($mediaInfo->getFlavorAssetId());
             $copyFlavorParams = assetParamsPeer::retrieveBySystemName(self::SAVE_ORIGINAL_SOURCE_FLAVOR_PARAM_SYS_NAME);
             if (!$copyFlavorParams) {
                 throw new APIException(APIErrors::OBJECT_NOT_FOUND);
             }
             $asset = $sourceAsset->copy();
             $asset->setFlavorParamsId($copyFlavorParams->getId());
             $asset->setFromAssetParams($copyFlavorParams);
             $asset->setStatus(flavorAsset::ASSET_STATUS_READY);
             $asset->setIsOriginal(0);
             $asset->setTags($copyFlavorParams->getTags());
             $asset->incrementVersion();
             $asset->save();
             kFileSyncUtils::createSyncFileLinkForKey($asset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET), $sourceAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET));
             $origFileSync = kFileSyncUtils::getLocalFileSyncForKey($sourceAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET));
             $asset->setSize(intval($origFileSync->getFileSize() / 1000));
             $asset->save();
         }
     }
     /*
      * '_passthrough' controls whether the source is to be 'passthrough' although there 
      * is a source flavor that contains transcoder settings.
      * Looks for a '_passthrough' flag on the source's flavor params output.
      */
     if (!$sourceFlavorOutput || $sourceFlavorOutput->_passthrough == true) {
         return true;
     }
     // save flavor params
     $sourceFlavorOutput->setPartnerId($sourceFlavorOutput->getPartnerId());
     $sourceFlavorOutput->setEntryId($entryId);
     $sourceFlavorOutput->setFlavorAssetId($originalFlavorAsset->getId());
     $sourceFlavorOutput->setFlavorAssetVersion($originalFlavorAsset->getVersion());
     $sourceFlavorOutput->save();
     if ($errDescription) {
         $originalFlavorAsset->setDescription($originalFlavorAsset->getDescription() . "\n{$errDescription}");
     }
     $errDescription = kBusinessConvertDL::parseFlavorDescription($sourceFlavorOutput);
     if ($errDescription) {
         $originalFlavorAsset->setDescription($originalFlavorAsset->getDescription() . "\n{$errDescription}");
     }
     // decided by the business logic layer
     if ($sourceFlavorOutput->_create_anyway) {
         KalturaLog::log("Flavor [" . $sourceFlavorOutput->getFlavorParamsId() . "] selected to be created anyway");
     } else {
         if (!$sourceFlavorOutput->IsValid()) {
             KalturaLog::log("Flavor [" . $sourceFlavorOutput->getFlavorParamsId() . "] is invalid");
             $originalFlavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR);
             $originalFlavorAsset->save();
             $errDescription = "Source flavor could not be converted";
             self::setError($errDescription, $convertProfileJob, BatchJobType::CONVERT_PROFILE, $convertProfileJob->getEntryId());
             return false;
         }
         if ($sourceFlavorOutput->_force) {
             KalturaLog::log("Flavor [" . $sourceFlavorOutput->getFlavorParamsId() . "] is forced");
         } elseif ($sourceFlavorOutput->_isNonComply) {
             KalturaLog::log("Flavor [" . $sourceFlavorOutput->getFlavorParamsId() . "] is none-comply");
         } else {
             KalturaLog::log("Flavor [" . $sourceFlavorOutput->getFlavorParamsId() . "] is valid");
         }
     }
     $originalFlavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_CONVERTING);
     if (isset($sourceFlavor)) {
         $originalFlavorAsset->addTags($sourceFlavor->getTagsArray());
         $originalFlavorAsset->setFileExt($sourceFlavorOutput->getFileExt());
         $originalFlavorAsset->save();
//.........这里部分代码省略.........
开发者ID:DBezemer,项目名称:server,代码行数:101,代码来源:kBusinessPreConvertDL.php

示例11: setAsDefaultThumbAsset

 public static function setAsDefaultThumbAsset($thumbAsset)
 {
     /* @var $thumbAsset thumbAsset */
     $entry = $thumbAsset->getentry();
     if (!$entry) {
         throw new kCoreException("Could not retrieve entry ID [" . $thumbAsset->getEntryId() . "] from ThumbAsset ID [" . $thumbAsset->getId() . "]", APIErrors::ENTRY_ID_NOT_FOUND);
     }
     if (!$thumbAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
         /* @var $thumbAsset KalturaThumbAsset */
         $thumbAsset->addTags(array(thumbParams::TAG_DEFAULT_THUMB));
         $thumbAsset->save();
         KalturaLog::info("Setting entry [" . $thumbAsset->getEntryId() . "] default ThumbAsset to [" . $thumbAsset->getId() . "]");
     }
     $entry->setThumbnail(".jpg");
     $entry->setCreateThumb(false, $thumbAsset);
     $entry->save();
     $thumbSyncKey = $thumbAsset->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     $entrySyncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
     kFileSyncUtils::createSyncFileLinkForKey($entrySyncKey, $thumbSyncKey);
 }
开发者ID:dozernz,项目名称:server,代码行数:20,代码来源:kBusinessConvertDL.php

示例12: revertAction

 /**
  * Update an existing metadata object definition file
  *
  * @action revert
  * @param int $id
  * @param int $toVersion
  * @return KalturaMetadataProfile
  * @throws MetadataErrors::METADATA_PROFILE_NOT_FOUND
  * @throws MetadataErrors::METADATA_FILE_NOT_FOUND
  * @throws MetadataErrors::METADATA_UNABLE_TO_TRANSFORM
  */
 function revertAction($id, $toVersion)
 {
     $dbMetadataProfile = MetadataProfilePeer::retrieveByPK($id);
     if (!$dbMetadataProfile) {
         throw new KalturaAPIException(MetadataErrors::METADATA_PROFILE_NOT_FOUND, $id);
     }
     $oldKey = $dbMetadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_DEFINITION, $toVersion);
     if (!kFileSyncUtils::fileSync_exists($oldKey)) {
         throw new KalturaAPIException(MetadataErrors::METADATA_FILE_NOT_FOUND, $oldKey);
     }
     $dbMetadataProfile->incrementFileSyncVersion();
     $dbMetadataProfile->incrementVersion();
     $dbMetadataProfile->save();
     $key = $dbMetadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_DEFINITION);
     kFileSyncUtils::createSyncFileLinkForKey($key, $oldKey);
     kMetadataManager::parseProfileSearchFields($this->getPartnerId(), $dbMetadataProfile);
     MetadataPeer::setUseCriteriaFilter(false);
     $metadatas = MetadataPeer::retrieveByProfile($id, $toVersion);
     foreach ($metadatas as $metadata) {
         // validate object exists
         $object = kMetadataManager::getObjectFromPeer($metadata);
         if (!$object) {
             continue;
         }
         $metadata->incrementVersion();
         $oldKey = $metadata->getSyncKey(Metadata::FILE_SYNC_METADATA_DATA, $toVersion);
         if (!kFileSyncUtils::fileSync_exists($oldKey)) {
             continue;
         }
         $xml = kFileSyncUtils::file_get_contents($oldKey, true, false);
         if (!$xml) {
             continue;
         }
         $errorMessage = '';
         if (!kMetadataManager::validateMetadata($dbMetadataProfile->getId(), $xml, $errorMessage)) {
             continue;
         }
         $metadata->setMetadataProfileVersion($dbMetadataProfile->getVersion());
         $metadata->setStatus(Metadata::STATUS_VALID);
         $metadata->save();
         $key = $metadata->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_DEFINITION);
         kFileSyncUtils::createSyncFileLinkForKey($key, $oldKey);
     }
     $metadataProfile = new KalturaMetadataProfile();
     $metadataProfile->fromObject($dbMetadataProfile, $this->getResponseProfile());
     return $metadataProfile;
 }
开发者ID:DBezemer,项目名称:server,代码行数:58,代码来源:MetadataProfileService.php

示例13: saveOriginalSource

 private static function saveOriginalSource($mediaInfo)
 {
     $sourceAsset = assetPeer::retrieveById($mediaInfo->getFlavorAssetId());
     $copyFlavorParams = assetParamsPeer::retrieveBySystemName(self::SAVE_ORIGINAL_SOURCE_FLAVOR_PARAM_SYS_NAME);
     if (!$copyFlavorParams) {
         throw new APIException(APIErrors::OBJECT_NOT_FOUND);
     }
     $asset = $sourceAsset->copy();
     $asset->setFlavorParamsId($copyFlavorParams->getId());
     $asset->setFromAssetParams($copyFlavorParams);
     $asset->setStatus(flavorAsset::ASSET_STATUS_READY);
     $asset->setIsOriginal(0);
     $asset->setTags($copyFlavorParams->getTags());
     $asset->incrementVersion();
     $asset->save();
     kFileSyncUtils::createSyncFileLinkForKey($asset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET), $sourceAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET));
     $origFileSync = kFileSyncUtils::getLocalFileSyncForKey($sourceAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET));
     $asset->setSize(intval($origFileSync->getFileSize() / 1000));
     $asset->save();
 }
开发者ID:dozernz,项目名称:server,代码行数:20,代码来源:kBusinessPreConvertDL.php

示例14: attachFileSync

 /**
  * @param flavorAsset $flavorAsset
  * @param FileSyncKey $srcSyncKey
  */
 protected function attachFileSync(flavorAsset $flavorAsset, FileSyncKey $srcSyncKey)
 {
     $flavorAsset->incrementVersion();
     $flavorAsset->save();
     $newSyncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     kFileSyncUtils::createSyncFileLinkForKey($newSyncKey, $srcSyncKey);
     $fileSync = kFileSyncUtils::getLocalFileSyncForKey($newSyncKey, false);
     $fileSync = kFileSyncUtils::resolve($fileSync);
     if (!$flavorAsset->isLocalReadyStatus()) {
         $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_QUEUED);
     }
     $flavorAsset->setSize($fileSync->getFileSize());
     $flavorAsset->save();
 }
开发者ID:DBezemer,项目名称:server,代码行数:18,代码来源:FlavorAssetService.php

示例15: attachFileSync

 /**
  * @param FileAsset $dbFileAsset
  * @param FileSyncKey $srcSyncKey
  */
 protected function attachFileSync(FileAsset $dbFileAsset, FileSyncKey $srcSyncKey)
 {
     $dbFileAsset->incrementVersion();
     $dbFileAsset->save();
     $newSyncKey = $dbFileAsset->getSyncKey(FileAsset::FILE_SYNC_ASSET);
     kFileSyncUtils::createSyncFileLinkForKey($newSyncKey, $srcSyncKey);
     $fileSync = kFileSyncUtils::getLocalFileSyncForKey($newSyncKey, false);
     $fileSync = kFileSyncUtils::resolve($fileSync);
     $dbFileAsset->setStatus(FileAssetStatus::READY);
     $dbFileAsset->setSize($fileSync->getFileSize());
     $dbFileAsset->save();
 }
开发者ID:DBezemer,项目名称:server,代码行数:16,代码来源:FileAssetService.php


注:本文中的kFileSyncUtils::createSyncFileLinkForKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。