Пример #1
0
 public function init(KalturaLiveReportExportJobData $jobData)
 {
     $filter = new KalturaLiveReportInputFilter();
     $filter->live = false;
     $filter->toTime = $jobData->timeReference;
     $filter->fromTime = $jobData->timeReference - LiveReportConstants::SECONDS_36_HOURS;
     $pager = new KalturaFilterPager();
     $pager->pageIndex = 0;
     $pager->pageSize = LiveReportConstants::MAX_ENTRIES;
     $entryIds = LiveReportQueryHelper::retrieveFromReport(KalturaLiveReportType::ENTRY_TOTAL, $filter, $pager, null, "entryId");
     $this->params[LiveReportConstants::ENTRY_IDS] = implode(",", $entryIds);
 }
Пример #2
0
 protected function querySyndicationReport($timeFrame, $pageIdx, $args)
 {
     $this->checkParams($args, array(LiveReportConstants::TIME_REFERENCE_PARAM, LiveReportConstants::ENTRY_IDS));
     $reportType = KalturaLiveReportType::ENTRY_SYNDICATION_TOTAL;
     $filter = new KalturaLiveReportInputFilter();
     $filter->toTime = $args[LiveReportConstants::TIME_REFERENCE_PARAM];
     $filter->fromTime = $args[LiveReportConstants::TIME_REFERENCE_PARAM] - $timeFrame;
     $filter->entryIds = $args[LiveReportConstants::ENTRY_IDS];
     $pager = new KalturaFilterPager();
     $pager->pageIndex = $pageIdx;
     $pager->pageSize = self::CHUNK_SIZE;
     return LiveReportQueryHelper::retrieveFromReport($reportType, $filter, $pager, "referrer", "plays");
 }
 public function run($fp, array $args = array())
 {
     $this->checkParams($args, array(LiveReportConstants::TIME_REFERENCE_PARAM, LiveReportConstants::IS_LIVE, LiveReportConstants::ENTRY_IDS));
     $reportType = KalturaLiveReportType::ENTRY_TOTAL;
     $filter = new KalturaLiveReportInputFilter();
     $filter->live = $args[LiveReportConstants::IS_LIVE];
     $filter->toTime = $args[LiveReportConstants::TIME_REFERENCE_PARAM];
     $filter->fromTime = $args[LiveReportConstants::TIME_REFERENCE_PARAM] - $this->timeFrame;
     $filter->entryIds = $args[LiveReportConstants::ENTRY_IDS];
     $res = LiveReportQueryHelper::retrieveFromReport($reportType, $filter, null, "entryId", $this->fieldName);
     if ($this->printResult) {
         if (empty($res)) {
             $res = $this->defaultVal;
         }
         $msg = $this->title . LiveReportConstants::CELLS_SEPARATOR . implode(LiveReportConstants::CELLS_SEPARATOR, $res);
         fwrite($fp, $msg);
     }
     return $res;
 }
 protected function executeAudienceQuery($fp, $fromTime, $toTime, $args, $showDvr)
 {
     $this->checkParams($args, array(LiveReportConstants::ENTRY_IDS));
     $reportType = KalturaLiveReportType::ENTRY_TIME_LINE;
     $filter = new KalturaLiveReportInputFilter();
     $filter->toTime = $toTime;
     $filter->fromTime = $fromTime;
     $filter->entryIds = $args[LiveReportConstants::ENTRY_IDS];
     $resultsStr = LiveReportQueryHelper::getEvents($reportType, $filter, null, "audience");
     $couples = explode(";", $resultsStr);
     foreach ($couples as $couple) {
         $parts = explode(",", $couple);
         if (count($parts) >= 2) {
             $parts[0] = $this->formatter->format($parts[0]);
             if ($showDvr) {
                 $msg = implode(LiveReportConstants::CELLS_SEPARATOR, $parts) . "\n";
             } else {
                 $msg = implode(LiveReportConstants::CELLS_SEPARATOR, array_slice($parts, 0, 2)) . "\n";
             }
             fwrite($fp, $msg);
         }
     }
 }