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); }