Ejemplo n.º 1
0
 private function getLinkByRecId($rec_id)
 {
     $item = self::getById($rec_id);
     $master = new StreamRecorder();
     try {
         $res = $master->play($rec_id, 0, false, $item['storage_name']);
     } catch (Exception $e) {
         trigger_error($e->getMessage());
     }
     $res['local'] = 0;
     if (!empty($res['cmd'])) {
         preg_match("/\\.(\\w*)\$/", $res['cmd'], $ext_arr);
         $res['to_file'] = System::transliterate($item['id'] . '_' . Itv::getChannelNameById($item['ch_id']) . '_' . $item['program']);
         $res['to_file'] .= '.' . $ext_arr[1];
     }
     if (!empty($_REQUEST['download'])) {
         $downloads = new Downloads();
         $res['cmd'] = $downloads->createDownloadLink('pvr', $rec_id, Stb::getInstance()->id);
     }
     return $res;
 }