public static function fromEntryArray($arr)
 {
     $newArr = new KalturaMixEntryArray();
     if ($arr == null) {
         return $newArr;
     }
     foreach ($arr as $obj) {
         $nObj = new KalturaMixEntry();
         $nObj->fromObject($obj);
         $newArr[] = $nObj;
     }
     return $newArr;
 }
 function update($entryId, KalturaMixEntry $mixEntry)
 {
     $kparams = array();
     $this->client->addParam($kparams, "entryId", $entryId);
     $this->client->addParam($kparams, "mixEntry", $mixEntry->toParams());
     $this->client->queueServiceActionCall("mixing", "update", $kparams);
     if ($this->client->isMultiRequest()) {
         return null;
     }
     $resultObject = $this->client->doQueue();
     $this->client->throwExceptionIfError($resultObject);
     $this->client->validateObjectType($resultObject, "KalturaMixEntry");
     return $resultObject;
 }
 /**
  * Appends a media entry to a the end of the mix timeline, this will save the mix timeline as a new version.
  * 
  * @action appendMediaEntry
  * @param string $mixEntryId Mix entry to append to its timeline
  * @param string $mediaEntryId Media entry to append to the timeline
  * @return KalturaMixEntry The mix entry
  */
 function appendMediaEntryAction($mixEntryId, $mediaEntryId)
 {
     $dbMixEntry = entryPeer::retrieveByPK($mixEntryId);
     if (!$dbMixEntry || $dbMixEntry->getType() != KalturaEntryType::MIX) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $mixEntryId);
     }
     $dbMediaEntry = entryPeer::retrieveByPK($mediaEntryId);
     if (!$dbMediaEntry || $dbMediaEntry->getType() != KalturaEntryType::MEDIA_CLIP) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $mediaEntryId);
     }
     $kshow = $dbMixEntry->getkshow();
     if (!$kshow) {
         KalturaLog::CRIT("Kshow was not found for mix id [" . $mixEntryId . "]");
         throw new KalturaAPIException(KalturaErrors::INTERNAL_SERVERL_ERROR);
     }
     // FIXME: temp hack  - when kshow doesn't have a roughcut, and the media entry is not ready, it cannob be queued for append upon import/conversion completion
     if ($dbMediaEntry->getStatus() != entryStatus::READY) {
         $kshow->setShowEntryId($mixEntryId);
         $kshow->save();
         $dbMediaEntry->setKshowId($kshow->getId());
         $dbMediaEntry->save();
     }
     $metadata = $kshow->getMetadata();
     $relevantKshowVersion = 1 + $kshow->getVersion();
     // the next metadata will be the first relevant version for this new entry
     $newMetadata = myMetadataUtils::addEntryToMetadata($metadata, $dbMediaEntry, $relevantKshowVersion, array());
     $dbMediaEntry->save();
     // FIXME: should be removed, needed for the prev hack
     if ($newMetadata) {
         // TODO - add thumbnail only for entries that are worthy - check they are not moderated !
         $thumbModified = myKshowUtils::updateThumbnail($kshow, $dbMediaEntry, false);
         if ($thumbModified) {
             $newMetadata = myMetadataUtils::updateThumbUrlFromMetadata($newMetadata, $dbMixEntry->getThumbnailUrl());
         }
         // it is very important to increment the version count because even if the entry is deferred
         // it will be added on the next version
         if (!$kshow->getHasRoughcut()) {
             // make sure the kshow now does have a roughcut
             $kshow->setHasRoughcut(true);
             $kshow->save();
         }
         $kshow->setMetadata($newMetadata, true);
     }
     $mixEntry = new KalturaMixEntry();
     $mixEntry->fromObject($dbMixEntry);
     return $mixEntry;
 }
Example #4
0
 function update($entryId, KalturaMixEntry $mixEntry)
 {
     $kparams = array();
     $this->client->addParam($kparams, "entryId", $entryId);
     $this->client->addParam($kparams, "mixEntry", $mixEntry->toParams());
     $resultObject = $this->client->callService("mixing", "update", $kparams);
     $this->client->throwExceptionIfError($resultObject);
     $this->client->validateObjectType($resultObject, "KalturaMixEntry");
     return $resultObject;
 }