Ejemplo n.º 1
0
 public function show()
 {
     $offset = $this->input['offset'] ? $this->input['offset'] : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 20;
     $condition = $this->get_condition();
     $orderby = '  ORDER BY order_id DESC,id DESC ';
     $limit = ' LIMIT ' . $offset . ' , ' . $count;
     $ret = $this->mode->show($condition, $orderby, $limit);
     $video_ids = array();
     $channel_ids = array();
     foreach ($ret as $k => $v) {
         $video_ids[] = $v['video_id'];
         $channel_ids[] = $v['channel_id'];
     }
     /*******************此处是为了请求视频库的图片******************/
     if ($video_ids) {
         $livmedia = new livmedia();
         $video = $livmedia->get_videos(implode(',', $video_ids));
         $video_img = array();
         $video_url = array();
         if ($video && $video[0]) {
             foreach ($video[0] as $k => $v) {
                 $video_img[$v['id']] = @unserialize($v['img_info']);
                 $video_url[$v['id']] = $v['hostwork'] . '/' . $v['video_path'] . $v['video_filename'];
             }
         }
     }
     /*******************此处是为了请求视频库的图片*****************/
     /*******************此处是为了频道名称***********************/
     if ($channel_ids) {
         $mLive = new live();
         $channel = $mLive->getChannelById(implode(',', $channel_ids), -1);
         $channel_name[] = array();
         if ($channel) {
             foreach ($channel as $k => $v) {
                 $channel_name[$v['id']] = $v['name'];
             }
         }
     }
     /*******************此处是为了频道名称***********************/
     if (!empty($ret)) {
         foreach ($ret as $k => $v) {
             if ($video_img) {
                 $v['img_info'] = $video_img[$v['video_id']];
             }
             if ($channel_name) {
                 $v['channel_name'] = $channel_name[$v['channel_id']];
             }
             if ($video_url) {
                 $v['video_url'] = $video_url[$v['video_id']];
             }
             $this->addItem($v);
         }
         $this->output();
     }
 }
Ejemplo n.º 2
0
 public function show()
 {
     if (!$this->input['server_id']) {
         $this->errorOutput(NO_SERVER_ID);
     }
     $sql = "SELECT * FROM " . DB_PREFIX . "transcode_center  WHERE id = '" . intval($this->input['server_id']) . "'";
     $arr = $this->db->query_first($sql);
     $trans = new transcode(array('host' => $arr['trans_host'], 'port' => $arr['trans_port']));
     $ret = $trans->get_transcode_status();
     $ret = json_decode($ret, 1);
     $status = array();
     $task_ids = array();
     $more_task = array();
     if ($ret['return'] != 'fail') {
         foreach ((array) $ret['running'] as $k => $v) {
             $ret['running'][$k]['status'] = 'running';
         }
         if ($ret['running']) {
             //如果存在等待也加进去
             if ($ret['waiting']) {
                 foreach ((array) $ret['waiting'] as $k => $v) {
                     $ret['waiting'][$k]['status'] = 'waiting';
                 }
                 $ret['running'] = array_merge($ret['running'], $ret['waiting']);
             }
             $status['status'] = $ret['running'];
             foreach ($ret['running'] as $k => $v) {
                 //处理多码流
                 if (strstr($v['id'], '_more')) {
                     $more_task[] = $v['id'];
                     //保存多码流任务id
                     $m_ids = explode('_', $v['id']);
                     $task_ids[] = $m_ids[0];
                     continue;
                 }
                 $task_ids[] = $v['id'];
             }
             $livmedia = new livmedia();
             $video_info = $livmedia->get_videos(implode(',', $task_ids));
             if ($video_info && $video_info[0]) {
                 foreach ($status['status'] as $k => $v) {
                     if (in_array($v['id'], $more_task)) {
                         $t_ids = explode('_', $v['id']);
                         $status['status'][$k]['title'] = '多码流:(' . $video_info[0][$t_ids[0]]['title'] . ')';
                         continue;
                     }
                     $status['status'][$k]['title'] = $video_info[0][$v['id']]['title'];
                 }
             }
         }
     }
     $this->total = count($status[0]['status']);
     $this->addItem($status);
     $this->output();
 }
Ejemplo n.º 3
0
 public function play_episode()
 {
     //剧集的id
     if (!$this->input['id']) {
         $this->errorOutput(NOID);
     }
     //根据剧集的id获得该剧集的视频id
     $episode = $this->mode->get_episode_info($this->input['id']);
     if (!$episode) {
         $this->errorOutput(NO_DATA);
     }
     $video_id = $episode[0]['video_id'];
     $media = new livmedia();
     $video = $media->get_videos($video_id);
     $this->addItem($video[0]);
     $this->output();
 }
Ejemplo n.º 4
0
 }
 private function photo_detail($id)
 {
     include_once ROOT_PATH . 'lib/class/tuji.class.php';
     $picApi = new tuji();
     $photo_info = $picApi->detail($id);
     if (!$photo_info['tuji']['id']) {
         return false;
     }
     return $photo_info;
 }
 private function video_detail($id)
 {
     include_once ROOT_PATH . 'lib/class/livmedia.class.php';
     $videoApi = new livmedia();
     $info = $videoApi->get_videos($id);
     $info = $info[0][$id];
     if ($info['column_id']) {
         $info['column_id'] = unserialize($info['column_id']);