Example #1
0
 /**
  * @param BatchJob $parentJob
  * @param flavorAsset $asset
  * @param array $files
  * @return BatchJob
  */
 public static function addConcatJob(BatchJob $parentJob = null, flavorAsset $asset, array $files, $offset = null, $duration = null)
 {
     $jobData = new kConcatJobData();
     $jobData->setSrcFiles($files);
     $jobData->setFlavorAssetId($asset->getId());
     $jobData->setOffset($offset);
     $jobData->setDuration($duration);
     $entry = $asset->getentry();
     if ($entry && $entry->getStatus() != entryStatus::READY) {
         $entry->setStatus(entryStatus::PRECONVERT);
         $entry->save();
     }
     $batchJob = null;
     if ($parentJob) {
         $batchJob = $parentJob->createChild(BatchJobType::CONCAT);
     } else {
         $batchJob = new BatchJob();
         $batchJob->setPartnerId($asset->getPartnerId());
     }
     $batchJob->setEntryId($asset->getEntryId());
     $batchJob->setObjectId($jobData->getFlavorAssetId());
     $batchJob->setObjectType(BatchJobObjectType::ASSET);
     return self::addJob($batchJob, $jobData, BatchJobType::CONCAT);
 }