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


PHP assetPeer::getNewAsset方法代码示例

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


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

示例1: attachAssetParamsResourceContainer

 /**
  * @param kAssetParamsResourceContainer $resource
  * @param entry $dbEntry
  * @param asset $dbAsset
  * @return asset
  * @throws KalturaErrors::FLAVOR_PARAMS_ID_NOT_FOUND
  */
 protected function attachAssetParamsResourceContainer(kAssetParamsResourceContainer $resource, entry $dbEntry, asset $dbAsset = null)
 {
     $assetParams = assetParamsPeer::retrieveByPK($resource->getAssetParamsId());
     if (!$assetParams) {
         throw new KalturaAPIException(KalturaErrors::FLAVOR_PARAMS_ID_NOT_FOUND, $resource->getAssetParamsId());
     }
     if (!$dbAsset) {
         $dbAsset = assetPeer::retrieveByEntryIdAndParams($dbEntry->getId(), $resource->getAssetParamsId());
     }
     $isNewAsset = false;
     if (!$dbAsset) {
         $isNewAsset = true;
         $dbAsset = assetPeer::getNewAsset($assetParams->getType());
         $dbAsset->setPartnerId($dbEntry->getPartnerId());
         $dbAsset->setEntryId($dbEntry->getId());
         $dbAsset->setStatus(asset::FLAVOR_ASSET_STATUS_QUEUED);
         $dbAsset->setFlavorParamsId($resource->getAssetParamsId());
         $dbAsset->setFromAssetParams($assetParams);
         if ($assetParams->hasTag(assetParams::TAG_SOURCE)) {
             $dbAsset->setIsOriginal(true);
         }
     }
     $dbAsset->incrementVersion();
     $dbAsset->save();
     $dbAsset = $this->attachResource($resource->getResource(), $dbEntry, $dbAsset);
     if ($dbAsset && $isNewAsset && $dbAsset->getStatus() != asset::FLAVOR_ASSET_STATUS_IMPORTING) {
         kEventsManager::raiseEvent(new kObjectAddedEvent($dbAsset));
     }
     return $dbAsset;
 }
开发者ID:DBezemer,项目名称:server,代码行数:37,代码来源:KalturaEntryService.php

示例2: ingestAsset

 private function ingestAsset(entry $entry, $dbAsset, $filename)
 {
     $flavorParamsId = $dbAsset->getFlavorParamsId();
     $flavorParams = assetParamsPeer::retrieveByPKNoFilter($flavorParamsId);
     // is first chunk
     $recordedAsset = assetPeer::retrieveByEntryIdAndParams($entry->getId(), $flavorParamsId);
     if ($recordedAsset) {
         KalturaLog::info("Asset [" . $recordedAsset->getId() . "] of flavor params id [{$flavorParamsId}] already exists");
         return;
     }
     // create asset
     $recordedAsset = assetPeer::getNewAsset(assetType::FLAVOR);
     $recordedAsset->setPartnerId($entry->getPartnerId());
     $recordedAsset->setEntryId($entry->getId());
     $recordedAsset->setStatus(asset::FLAVOR_ASSET_STATUS_QUEUED);
     $recordedAsset->setFlavorParamsId($flavorParams->getId());
     $recordedAsset->setFromAssetParams($flavorParams);
     if ($dbAsset->hasTag(assetParams::TAG_RECORDING_ANCHOR)) {
         $recordedAsset->addTags(array(assetParams::TAG_RECORDING_ANCHOR));
     }
     if ($flavorParams->hasTag(assetParams::TAG_SOURCE)) {
         $recordedAsset->setIsOriginal(true);
     }
     $ext = pathinfo($filename, PATHINFO_EXTENSION);
     if ($ext) {
         $recordedAsset->setFileExt($ext);
     }
     $recordedAsset->save();
     // create file sync
     $recordedAssetKey = $recordedAsset->getSyncKey(flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
     kFileSyncUtils::moveFromFile($filename, $recordedAssetKey, true, true);
     kEventsManager::raiseEvent(new kObjectAddedEvent($recordedAsset));
 }
开发者ID:DBezemer,项目名称:server,代码行数:33,代码来源:KalturaLiveEntryService.php

示例3: handleConvertLiveSegmentFinished

 /**
  * @param BatchJob $dbBatchJob
  * @param kConvertLiveSegmentJobData $data
  * @return BatchJob
  */
 public static function handleConvertLiveSegmentFinished(BatchJob $dbBatchJob, kConvertLiveSegmentJobData $data)
 {
     $liveEntry = entryPeer::retrieveByPKNoFilter($dbBatchJob->getEntryId());
     /* @var $liveEntry LiveEntry */
     if (!$liveEntry) {
         KalturaLog::err("Live entry [" . $dbBatchJob->getEntryId() . "] not found");
         return $dbBatchJob;
     }
     $recordedEntry = entryPeer::retrieveByPKNoFilter($liveEntry->getRecordedEntryId());
     if (!$recordedEntry) {
         KalturaLog::err("Recorded entry [" . $liveEntry->getRecordedEntryId() . "] not found");
         return $dbBatchJob;
     }
     $asset = assetPeer::retrieveByIdNoFilter($data->getAssetId());
     /* @var $asset liveAsset */
     if (!$asset) {
         KalturaLog::err("Live asset [" . $data->getAssetId() . "] not found");
         return $dbBatchJob;
     }
     $keyType = liveAsset::FILE_SYNC_ASSET_SUB_TYPE_LIVE_PRIMARY;
     if ($data->getMediaServerIndex() == MediaServerIndex::SECONDARY) {
         $keyType = liveAsset::FILE_SYNC_ASSET_SUB_TYPE_LIVE_SECONDARY;
     }
     $key = $asset->getSyncKey($keyType);
     $baseName = $asset->getEntryId() . '_' . $asset->getId() . '.ts';
     kFileSyncUtils::moveFromFileToDirectory($key, $data->getDestFilePath(), $baseName);
     if ($data->getMediaServerIndex() == MediaServerIndex::SECONDARY) {
         return $dbBatchJob;
     }
     $files = kFileSyncUtils::dir_get_files($key, false);
     // If we have less files on disk than what we should have it means the output file will be missing segments.
     // don't generate it, and the next concat will do the work for us.
     if (count($files) != $data->getFileIndex() + 1) {
         KalturaLog::warning('number of segments on disk ' . count($files) . ' is not equal to segment index ' . $data->getFileIndex() . ' - not running the concat job');
         return $dbBatchJob;
     }
     if (count($files) > 1) {
         // find replacing entry id
         $replacingEntry = self::getReplacingEntry($recordedEntry, $asset);
         if (is_null($replacingEntry)) {
             KalturaLog::err("Failed to get replacing entry");
         }
         $flavorParams = assetParamsPeer::retrieveByPKNoFilter($asset->getFlavorParamsId());
         if (is_null($flavorParams)) {
             KalturaLog::err('Failed to retrieve asset params');
             return $dbBatchJob;
         }
         // create asset
         $replacingAsset = assetPeer::getNewAsset(assetType::FLAVOR);
         $replacingAsset->setPartnerId($replacingEntry->getPartnerId());
         $replacingAsset->setEntryId($replacingEntry->getId());
         $replacingAsset->setStatus(asset::FLAVOR_ASSET_STATUS_QUEUED);
         $replacingAsset->setFlavorParamsId($flavorParams->getId());
         $replacingAsset->setFromAssetParams($flavorParams);
         if ($flavorParams->hasTag(assetParams::TAG_SOURCE)) {
             $replacingAsset->setIsOriginal(true);
         }
         $replacingAsset->save();
         $job = kJobsManager::addConcatJob($dbBatchJob, $replacingAsset, $files);
     }
     return $dbBatchJob;
 }
开发者ID:dozernz,项目名称:server,代码行数:67,代码来源:kFlowHelper.php

示例4: handleConvertLiveSegmentFinished

 /**
  * @param BatchJob $dbBatchJob
  * @param kConvertLiveSegmentJobData $data
  * @return BatchJob
  */
 public static function handleConvertLiveSegmentFinished(BatchJob $dbBatchJob, kConvertLiveSegmentJobData $data)
 {
     $liveEntry = entryPeer::retrieveByPKNoFilter($dbBatchJob->getEntryId());
     /* @var $liveEntry LiveEntry */
     if (!$liveEntry) {
         KalturaLog::err("Live entry [" . $dbBatchJob->getEntryId() . "] not found");
         return $dbBatchJob;
     }
     $recordedEntry = entryPeer::retrieveByPKNoFilter($liveEntry->getRecordedEntryId());
     if (!$recordedEntry) {
         KalturaLog::err("Recorded entry [" . $liveEntry->getRecordedEntryId() . "] not found");
         return $dbBatchJob;
     }
     $asset = assetPeer::retrieveByIdNoFilter($data->getAssetId());
     /* @var $asset liveAsset */
     if (!$asset) {
         KalturaLog::err("Live asset [" . $data->getAssetId() . "] not found");
         return $dbBatchJob;
     }
     $keyType = liveAsset::FILE_SYNC_ASSET_SUB_TYPE_LIVE_PRIMARY;
     if ($data->getMediaServerIndex() == MediaServerIndex::SECONDARY) {
         $keyType = liveAsset::FILE_SYNC_ASSET_SUB_TYPE_LIVE_SECONDARY;
     }
     $key = $asset->getSyncKey($keyType);
     $baseName = $asset->getEntryId() . '_' . $asset->getId() . '.ts';
     kFileSyncUtils::moveFromFileToDirectory($key, $data->getDestFilePath(), $baseName);
     if ($data->getMediaServerIndex() == MediaServerIndex::SECONDARY) {
         return $dbBatchJob;
     }
     $files = kFileSyncUtils::dir_get_files($key, false);
     if (count($files) > 1) {
         // find replacing entry id
         $replacingEntry = kFlowHelper::getReplacingEntry($recordedEntry, $asset);
         if (is_null($replacingEntry)) {
             KalturaLog::err('Failed to retrieve replacing entry');
             return $dbBatchJob;
         }
         $flavorParams = assetParamsPeer::retrieveByPKNoFilter($asset->getFlavorParamsId());
         if (is_null($flavorParams)) {
             KalturaLog::err('Failed to retrieve asset params');
             return $dbBatchJob;
         }
         // create asset
         $replacingAsset = assetPeer::getNewAsset(assetType::FLAVOR);
         $replacingAsset->setPartnerId($replacingEntry->getPartnerId());
         $replacingAsset->setEntryId($replacingEntry->getId());
         $replacingAsset->setStatus(asset::FLAVOR_ASSET_STATUS_QUEUED);
         $replacingAsset->setFlavorParamsId($flavorParams->getId());
         $replacingAsset->setFromAssetParams($flavorParams);
         if ($flavorParams->hasTag(assetParams::TAG_SOURCE)) {
             $replacingAsset->setIsOriginal(true);
         }
         $replacingAsset->save();
         $job = kJobsManager::addConcatJob($dbBatchJob, $replacingAsset, $files);
     }
     return $dbBatchJob;
 }
开发者ID:GElkayam,项目名称:server,代码行数:62,代码来源:kFlowHelper.php

示例5: attachRemoteAssetResource

 protected function attachRemoteAssetResource(entry $entry, kDistributionSubmitJobData $data)
 {
     $distributionProfile = DistributionProfilePeer::retrieveByPK($data->getDistributionProfileId());
     /* @var $distributionProfile UnicornDistributionProfile */
     $domainGuid = $distributionProfile->getDomainGuid();
     $applicationGuid = $distributionProfile->getAdFreeApplicationGuid();
     $assetParamsId = $distributionProfile->getRemoteAssetParamsId();
     $mediaItemGuid = $data->getRemoteId();
     $url = "{$domainGuid}/{$applicationGuid}/{$mediaItemGuid}/content.m3u8";
     $entry->setSource(KalturaSourceType::URL);
     $entry->save();
     $isNewAsset = false;
     $asset = assetPeer::retrieveByEntryIdAndParams($entry->getId(), $assetParamsId);
     if (!$asset) {
         $isNewAsset = true;
         $assetParams = assetParamsPeer::retrieveByPK($assetParamsId);
         $asset = assetPeer::getNewAsset($assetParams->getType());
         $asset->setPartnerId($entry->getPartnerId());
         $asset->setEntryId($entry->getId());
         $asset->setStatus(asset::FLAVOR_ASSET_STATUS_QUEUED);
         $asset->setFlavorParamsId($assetParamsId);
         $asset->setFromAssetParams($assetParams);
         if ($assetParams->hasTag(assetParams::TAG_SOURCE)) {
             $asset->setIsOriginal(true);
         }
     }
     $asset->incrementVersion();
     $asset->setFileExt('m3u8');
     $asset->setStatus(asset::FLAVOR_ASSET_STATUS_READY);
     $asset->save();
     $syncKey = $asset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     $storageProfile = StorageProfilePeer::retrieveByPK($distributionProfile->getStorageProfileId());
     $fileSync = kFileSyncUtils::createReadyExternalSyncFileForKey($syncKey, $url, $storageProfile);
     if ($isNewAsset) {
         kEventsManager::raiseEvent(new kObjectAddedEvent($asset));
     }
     kEventsManager::raiseEvent(new kObjectDataChangedEvent($asset));
     kBusinessPostConvertDL::handleConvertFinished(null, $asset);
 }
开发者ID:DBezemer,项目名称:server,代码行数:39,代码来源:UnicornService.php


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