/**
  * @param AttachmentAsset $attachmentAsset
  * @param kUrlResource $contentResource
  */
 protected function attachUrlResource(AttachmentAsset $attachmentAsset, kUrlResource $contentResource)
 {
     $this->attachUrl($attachmentAsset, $contentResource->getUrl());
 }
Пример #2
0
 /**
  * @param kUrlResource $resource
  * @param entry $dbEntry
  * @param asset $dbAsset
  * @return asset
  */
 protected function attachUrlResource(kUrlResource $resource, entry $dbEntry, asset $dbAsset = null)
 {
     if ($dbAsset instanceof flavorAsset) {
         $dbEntry->setSource(KalturaSourceType::URL);
         $dbEntry->save();
     }
     $url = $resource->getUrl();
     if (!$resource->getForceAsyncDownload()) {
         // TODO - move image handling to media service
         if ($dbEntry->getMediaType() == KalturaMediaType::IMAGE) {
             $entryFullPath = myContentStorage::getFSUploadsPath() . '/' . $dbEntry->getId() . '.jpg';
             if (KCurlWrapper::getDataFromFile($url, $entryFullPath)) {
                 return $this->attachFile($entryFullPath, $dbEntry, $dbAsset);
             }
             KalturaLog::err("Failed downloading file[{$url}]");
             $dbEntry->setStatus(entryStatus::ERROR_IMPORTING);
             $dbEntry->save();
             return null;
         }
         if ($dbAsset && !$dbAsset instanceof flavorAsset) {
             $ext = pathinfo($url, PATHINFO_EXTENSION);
             $entryFullPath = myContentStorage::getFSUploadsPath() . '/' . $dbEntry->getId() . '.' . $ext;
             if (KCurlWrapper::getDataFromFile($url, $entryFullPath)) {
                 $dbAsset = $this->attachFile($entryFullPath, $dbEntry, $dbAsset);
                 return $dbAsset;
             }
             KalturaLog::err("Failed downloading file[{$url}]");
             $dbAsset->setStatus(asset::FLAVOR_ASSET_STATUS_ERROR);
             $dbAsset->save();
             return null;
         }
     }
     kJobsManager::addImportJob(null, $dbEntry->getId(), $this->getPartnerId(), $url, $dbAsset, null, $resource->getImportJobData());
     return $dbAsset;
 }
 /**
  * @param thumbAsset $thumbAsset
  * @param kUrlResource $contentResource
  */
 protected function attachUrlResource(thumbAsset $thumbAsset, kUrlResource $contentResource)
 {
     $this->attachUrl($thumbAsset, $contentResource->getUrl());
 }
 /**
  * @param CaptionAsset $captionAsset
  * @param kUrlResource $contentResource
  */
 protected function attachUrlResource(CaptionAsset $captionAsset, kUrlResource $contentResource)
 {
     $this->attachUrl($captionAsset, $contentResource->getUrl());
 }
Пример #5
0
 /**
  * @param flavorAsset $flavorAsset
  * @param kUrlResource $contentResource
  */
 protected function attachUrlResource(flavorAsset $flavorAsset, kUrlResource $contentResource)
 {
     $this->attachUrl($flavorAsset, $contentResource->getUrl(), $contentResource->getImportJobData());
 }