当前位置: 首页>>代码示例>>PHP>>正文


PHP myPartnerUtils::getConversionProfileForEntry方法代码示例

本文整理汇总了PHP中myPartnerUtils::getConversionProfileForEntry方法的典型用法代码示例。如果您正苦于以下问题:PHP myPartnerUtils::getConversionProfileForEntry方法的具体用法?PHP myPartnerUtils::getConversionProfileForEntry怎么用?PHP myPartnerUtils::getConversionProfileForEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在myPartnerUtils的用法示例。


在下文中一共展示了myPartnerUtils::getConversionProfileForEntry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sentToCenversion

 private function sentToCenversion($write_to_log = true)
 {
     try {
         $debug = array("before getFileToConvert");
         list($before_archiving_file_path, $file_name, $in_proc) = $this->getFileToConvert($write_to_log);
         $debug[] = "after getFileToConvert [{$before_archiving_file_path}] [{$file_name}]";
         if (!$before_archiving_file_path) {
             return;
         }
         // TODO - check if this file failed too many times ...
         //if ( !$this->shouldHandleFile ( $file_name ) )
         $entry_id = self::getEntryIdFromFileName($file_name);
         $debug[] = "entry_id [{$entry_id}]";
         // we have to retrieve the path of the entry - do so by setting the data to the file path (now rather than at the end)
         $entry = entryPeer::retrieveByPK($entry_id);
         $conv_profile = myPartnerUtils::getConversionProfileForEntry($entry_id);
         $debug[] = "conversion profile of class [" . get_class($conv_profile) . "]";
         if (!$entry) {
             KalturaLog::debug("entry id [{$entry_id}] not found!");
             return;
         }
         // the conversion target should be the entry's dataPath
         $flv_file_name = kConversionHelper::flvFileName($before_archiving_file_path);
         $debug[] = "flv_file_name [{$flv_file_name}]";
         $entry->setData(null);
         $entry->setData($flv_file_name);
         // we assume the output will be of type FLV
         $entry->save();
         $archive_file_sync = $this->archiveFile($before_archiving_file_path);
         $archived_file_path = $archive_file_sync->getFullPath();
         $debug[] = "archived_file_path [{$archived_file_path}]";
         if ($conv_profile->getBypassFlv() && kConversionHelper::isFlv($archived_file_path)) {
             $conv_cmd = $this->createConversionCommandFromConverionProfile($archived_file_path, $archived_file_path, $conv_profile, $entry);
             $debug[] = "before createConversionInDb[{$entry_id}] [{$archived_file_path}]";
             // first update the DB
             $this->createConversionInDb($entry_id, $archived_file_path, $conv_cmd);
             // TODO - check if there is a set of convParams for this FLV profile and manye some conversion should be done
             // for the edit version ??
             KalturaLog::debug("Bypassing conversion for entry_id [{$entry_id}] file [{$file_name}]");
             $conv_res = new kConversionResult($conv_cmd);
             $conv_res_info = new kConvResInfo();
             $conv_res_info->target = $archived_file_path;
             $start = microtime(true);
             // FileSync - soft copy
             $archived_sync_key = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ARCHIVE);
             $data_sync_key = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
             kFileSyncUtils::softCopy($archived_sync_key, $data_sync_key);
             $end = microtime(true);
             $conv_res_info->duration = $end - $start;
             $conv_res_info->conv_str = "NO CONVERT";
             $conv_res->appendResInfo($conv_res_info);
             $this->updateConvertedEntry(true, $entry, $conv_res);
             $this->removeInProc($in_proc);
             return;
         }
         // FileSync - create file sync for the future place of the converted data
         $data_sync_key = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
         kFileSyncUtils::createSyncFileForKey($data_sync_key, false, false);
         $full_target_path = kFileSyncUtils::getLocalFilePathForKey($data_sync_key, true);
         if ($conv_profile->getProfileTypeSuffix() == "edit") {
             // FileSync - create file sync for the future place of the converted data in edit flavor
             $data_edit_sync_key = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA_EDIT);
             kFileSyncUtils::createSyncFileForKey($data_edit_sync_key, false, false);
         }
         $debug[] = "full_target_path [{$full_target_path}]";
         $conv_cmd = $this->createConversionCommandFromConverionProfile($archived_file_path, $full_target_path, $conv_profile, $entry);
         $debug[] = "before createConversionInDb[{$entry_id}] [{$archived_file_path}]";
         // first update the DB
         $this->createConversionInDb($entry_id, $archived_file_path, $conv_cmd);
         KalturaLog::debug("Setting ConversionCommand for file [{$file_name}]\n" . print_r($conv_cmd, true));
         $debug[] = "before saveConversionCommand";
         // then save the conversion command
         $cmd_file_path = $this->saveConversionCommand();
         $this->removeInProc($in_proc);
         KalturaLog::debug("Set ConversionCommand for file [{$file_name}] in [{$cmd_file_path}]");
         $debug[] = "end";
     } catch (kConversionException $kcoe) {
         $this->removeInProc($in_proc);
         KalturaLog::debug("Error:\n" . $kcoe->getMessage() . "\n" . $kcoe->getTraceAsString() . "\n" . print_r($debug));
         // update the entry with the error sttus and the error message to the conversion result
         $conv_res = new kConversionResult($conv_cmd);
         $conv_res->appendResult($kcoe->getMessage());
         $this->updateConvertedEntry(false, $entry, $conv_res);
     } catch (Exception $ex) {
         $this->removeInProc($in_proc);
         KalturaLog::debug("Error:\n" . $ex->getMessage() . "\n" . $ex->getTraceAsString() . "\n" . print_r($debug));
         // if this failed for some unknown reason - set it for reconversion
         $indicator = $this->setFileToReConvert($before_archiving_file_path, $file_name);
         KalturaLog::debug("... will reconvert [" . print_r($indicator, true) . "]");
         throw $ex;
     }
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:92,代码来源:kConversionClient.class.php


注:本文中的myPartnerUtils::getConversionProfileForEntry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。