public function getUrlByKaraokeId($karaoke_id) { $link = $this->getLinkByKaraokeId($karaoke_id); if (empty($link['cmd'])) { throw new Exception("Obtaining url failed"); } if (!empty($link['storage_id'])) { $storage = Master::getStorageById($link['storage_id']); if (!empty($storage)) { $cache = Cache::getInstance(); $cache->set($this->stb->id . '_playback', array('type' => 'karaoke', 'id' => $link['id'], 'storage' => $storage['storage_name']), 0, 10); } } else { $cache = Cache::getInstance(); $cache->del($this->stb->id . '_playback'); } return $link['cmd']; }
public function getUrlByVideoId($video_id, $series = 0, $forced_storage = "") { $video = Video::getById($video_id); if (empty($video)) { throw new Exception("Video not found"); } if (!empty($video['rtsp_url'])) { return $video['rtsp_url']; } $link = $this->getLinkByVideoId($video_id, $series, $forced_storage); if (empty($link['cmd'])) { throw new Exception("Obtaining url failed"); } if (!empty($link['storage_id'])) { $storage = Master::getStorageById($link['storage_id']); if (!empty($storage)) { $cache = Cache::getInstance(); $cache->set($this->stb->id . '_playback', array('type' => 'video', 'id' => $link['id'], 'storage' => $storage['storage_name']), 0, 10); } } else { $cache = Cache::getInstance(); $cache->del($this->stb->id . '_playback'); } return $link['cmd']; }