public function validateForUsage($sourceObject, $propertiesToSkip = array()) { $entryId = $this->entryId; $entry = entryPeer::retrieveByPK($entryId); if (!$entry || $entry->getType() != entryType::MEDIA_CLIP || !in_array($entry->getMediaType(), array(entry::ENTRY_MEDIA_TYPE_VIDEO, entry::ENTRY_MEDIA_TYPE_AUDIO))) { throw new KalturaAPIException(KalturaErrors::INVALID_ENTRY_ID, $entryId); } $flavorAssetId = $this->flavorAssetId; if ($flavorAssetId) { $flavorAsset = assetPeer::retrieveById($flavorAssetId); if (!$flavorAsset || $flavorAsset->getEntryId() != $entryId) { throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $flavorAssetId); } } $cielo24ParamsMap = kConf::get('cielo24', 'integration'); $supportedLanguages = $cielo24ParamsMap['languages']; if ($this->spokenLanguage) { if (!isset($supportedLanguages[$this->spokenLanguage])) { throw new KalturaAPIException(KalturaCielo24Errors::LANGUAGE_NOT_SUPPORTED, $this->spokenLanguage); } } return parent::validateForUsage($sourceObject, $propertiesToSkip = array()); }
public function validateForUsage($sourceObject, $propertiesToSkip = array()) { $entryId = $this->entryId; $entry = entryPeer::retrieveByPK($entryId); if (!$entry || $entry->getType() != entryType::MEDIA_CLIP || !in_array($entry->getMediaType(), array(entry::ENTRY_MEDIA_TYPE_VIDEO, entry::ENTRY_MEDIA_TYPE_AUDIO))) { throw new KalturaAPIException(KalturaErrors::INVALID_ENTRY_ID, $entryId); } $flavorAssetId = $this->flavorAssetId; if ($flavorAssetId) { $flavorAsset = assetPeer::retrieveById($flavorAssetId); if (!$flavorAsset || $flavorAsset->getEntryId() != $entryId) { throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $flavorAssetId); } } $transcriptId = $this->transcriptId; if ($transcriptId) { $transcript = assetPeer::retrieveById($transcriptId); if (!$transcript || $transcript->getEntryId() != $entryId || $transcript->getType() != TranscriptPlugin::getAssetTypeCoreValue(TranscriptAssetType::TRANSCRIPT)) { throw new KalturaAPIException(KalturaErrors::INVALID_OBJECT_ID, $transcriptId); } } $voicebaseParamsMap = kConf::get('voicebase', 'integration'); $supportedLanguages = $voicebaseParamsMap['languages']; if ($this->spokenLanguage) { if (!isset($supportedLanguages[$this->spokenLanguage])) { throw new KalturaAPIException(KalturaVoicebaseErrors::LANGUAGE_NOT_SUPPORTED, $this->spokenLanguage); } } else { $this->spokenLanguage = $voicebaseParamsMap['default_language']; } return parent::validateForUsage($sourceObject, $propertiesToSkip = array()); }
public function validateForUsage($sourceObject, $propertiesToSkip = array()) { $entryId = $this->entryId; $entry = entryPeer::retrieveByPK($entryId); if (!$entry) { throw new KalturaAPIException(KalturaErrors::INVALID_ENTRY_ID, $entryId); } $transcriptId = $this->transcriptId; if ($transcriptId) { $transcript = assetPeer::retrieveById($transcriptId); if (!$transcript || $transcript->getEntryId() != $entryId || $transcript->getType() != TranscriptPlugin::getAssetTypeCoreValue(TranscriptAssetType::TRANSCRIPT)) { throw new KalturaAPIException(KalturaErrors::INVALID_OBJECT_ID, $transcriptId); } } $voicebaseParamsMap = kConf::get('voicebase', 'integration'); if (!$this->captionAssetFormats) { $defaultFormatsArray = $voicebaseParamsMap['default_formats']; $this->captionAssetFormats = implode(',', $defaultFormatsArray); } else { $formatsString = $this->captionAssetFormats; $formatsArray = explode(',', $formatsString); $excludedFormats = $voicebaseParamsMap['exclude_formats']; foreach ($formatsArray as $format) { if (!constant("KalturaCaptionType::" . $format) || in_array($format, $excludedFormats)) { throw new KalturaAPIException(KalturaVoicebaseErrors::INVALID_TYPES, $formatsString); } } } $supportedLanguages = $voicebaseParamsMap['languages']; if ($this->spokenLanguage) { if (!isset($supportedLanguages[$this->spokenLanguage])) { throw new KalturaAPIException(KalturaVoicebaseErrors::LANGUAGE_NOT_SUPPORTED, $this->spokenLanguage); } } else { $this->spokenLanguage = $voicebaseParamsMap['default_language']; } return parent::validateForUsage($sourceObject, $propertiesToSkip = array()); }