/** * @return KalturaConversionProfile */ protected function getConversionProfile() { if (is_null($this->conversionProfile)) { $this->conversionProfile = parent::getConversionProfile(); } return $this->conversionProfile; }
public function setConfig(KalturaClient $client, KalturaDropFolderFile $dropFolderFile, KalturaDropFolder $dropFolder, KSchedularTaskConfig $taskConfig) { parent::setConfig($client, $dropFolderFile, $dropFolder, $taskConfig); if ($taskConfig->params->uploadedBy) { $this->uploadedBy = $taskConfig->params->uploadedBy; } }
/** * Handle the given file if it matches the defined file name pattern by executing the right file handler * @param KalturaDropFolder $dropFolder * @param KalturaDropFolderFile $dropFolderFile */ private function handleFile(KalturaDropFolder $dropFolder, KalturaDropFolderFile $dropFolderFile) { KalturaLog::debug('Handling file id [' . $dropFolderFile->id . '] name [' . $dropFolderFile->fileName . ']'); // get defined file name patterns $filePatterns = $dropFolder->fileNamePatterns; $filePatterns = array_map('trim', explode(',', $filePatterns)); // get current file name $fileName = $dropFolderFile->fileName; // search for a match $matchFound = false; foreach ($filePatterns as $pattern) { if (!is_null($pattern) && $pattern != '') { if (fnmatch($pattern, $fileName)) { $matchFound = true; break; } } } // if file name doesn't match pattern - quit if (!$matchFound) { KalturaLog::debug("File name [{$fileName}] does not match any of the defined patterns"); return false; } // handle file by the file handelr configured for its drop folder $fileHandler = DropFolderFileHandler::getHandler($dropFolder->fileHandlerType); $fileHandler->setConfig($this->kClient, $dropFolderFile, $dropFolder, $this->taskConfig); $fileHandled = $fileHandler->handle(); if ($fileHandled) { KalturaLog::debug('File handled succesfully'); return true; } else { KalturaLog::err('File was not handled!'); return false; } }