Ejemplo n.º 1
0
 public static function get_media_url_str($category_id, $filter_name = null, $type = 'show')
 {
     // hd_print(__METHOD__);
     // hd_print('  category_id: ' . $category_id . ' filter_name: ' .  $filter_name);
     $filter_name = !isset($filter_name) ? 'all' : $filter_name;
     return MediaURL::encode(array('screen_id' => self::ID, 'category_id' => $category_id, 'filter_name' => $filter_name, 'type' => $type));
 }
 public function handle_user_input(&$user_input, &$plugin_cookies)
 {
     hd_print('Vod favorites: handle_user_input:');
     foreach ($user_input as $key => $value) {
         hd_print("  {$key} => {$value}");
     }
     if ($user_input->control_id == 'popup_menu') {
         if (!isset($user_input->selected_media_url)) {
             return null;
         }
         $media_url = MediaURL::decode($user_input->selected_media_url);
         $movie_id = $media_url->movie_id;
         $is_favorite = $this->vod->is_favorite_movie_id($movie_id);
         $add_favorite_action = UserInputHandlerRegistry::create_action($this, 'add_favorite');
         $caption = 'Add to My Movies';
         $menu_items[] = array(GuiMenuItemDef::caption => $caption, GuiMenuItemDef::action => $add_favorite_action);
         return ActionFactory::show_popup_menu($menu_items);
     } else {
         if ($user_input->control_id == 'add_favorite') {
             if (!isset($user_input->selected_media_url)) {
                 return null;
             }
             $media_url = MediaURL::decode($user_input->selected_media_url);
             $movie_id = $media_url->movie_id;
             $is_favorite = $this->vod->is_favorite_movie_id($movie_id);
             if ($is_favorite) {
                 return ActionFactory::show_title_dialog('Movie already resides in My Movies');
             } else {
                 $this->vod->add_favorite_movie($movie_id, $plugin_cookies);
                 return ActionFactory::show_title_dialog('Movie has been added to My Movies');
             }
         }
     }
     return null;
 }
Ejemplo n.º 3
0
 public function doMakePlayListAndPlay(&$user_input, &$plugin_cookies)
 {
     hd_print(__METHOD__ . print_r($plugin_cookies, true));
     $media_url = MediaURL::decode($user_input->selected_media_url);
     $url = $this->base_url . $media_url->key;
     $musics = $this->getTrackUrlsFromUrl($url, $plugin_cookies);
     return ActionFactory::launch_media_url($this->makePlayList($musics));
 }
Ejemplo n.º 4
0
 public function handle_user_input(&$user_input, &$plugin_cookies)
 {
     // hd_print(__METHOD__);
     hd_print(print_r($user_input, true));
     $media_url = MediaURL::decode($user_input->selected_media_url);
     if ($user_input->control_id == 'pop_up') {
     }
 }
 public function get_all_folder_items(MediaURL $media_url, &$plugin_cookies)
 {
     $this->session->logout();
     $this->session->ensure_logged_in($plugin_cookies);
     $this->tv->ensure_channels_loaded($plugin_cookies);
     $new_items[] = array(PluginRegularFolderItem::media_url => MediaURL::encode(array('screen_id' => KtvVodRootScreen::ID)), PluginRegularFolderItem::caption => 'Videoteka', PluginRegularFolderItem::view_item_params => array(ViewItemParams::icon_path => $this->session->get_icon('mov_root.png')));
     $parent_items = parent::get_all_folder_items($media_url, $plugin_cookies);
     return array_merge($new_items, $parent_items);
 }
 public static function get_media_url_str($page_name, $arg = null)
 {
     $arr['screen_id'] = self::ID;
     $arr['page_name'] = $page_name;
     if ($page_name === 'search') {
         $arr['pattern'] = $arg;
     } else {
         if ($page_name === 'genres') {
             $arr['genre_id'] = $arg;
         }
     }
     return MediaURL::encode($arr);
 }
 public function get_all_folder_items(MediaURL $media_url, &$plugin_cookies)
 {
     $this->vod->folder_entered($media_url, $plugin_cookies);
     $movie = $this->vod->get_loaded_movie($media_url->movie_id, $plugin_cookies);
     if ($movie === null) {
         // TODO: dialog?
         return array();
     }
     $items = array();
     foreach ($movie->series_list as $series) {
         $items[] = array(PluginRegularFolderItem::media_url => MediaURL::encode(array('screen_id' => self::ID, 'movie_id' => $movie->id, 'series_id' => $series->id)), PluginRegularFolderItem::caption => $series->name, PluginRegularFolderItem::view_item_params => array(ViewItemParams::icon_path => 'gui_skin://small_icons/movie.aai'));
     }
     return $items;
 }
Ejemplo n.º 8
0
 public function handle_user_input(&$user_input, &$plugin_cookies)
 {
     hd_print('Vod favorites: handle_user_input:');
     foreach ($user_input as $key => $value) {
         hd_print("  {$key} => {$value}");
     }
     if ($user_input->control_id == 'remove_favorite') {
         if (!isset($user_input->selected_media_url)) {
             return null;
         }
         $media_url = MediaURL::decode($user_input->selected_media_url);
         $movie_id = $media_url->movie_id;
         $this->vod->remove_favorite_movie($movie_id, $plugin_cookies);
         return ActionFactory::invalidate_folders(array(self::get_media_url_str($movie_id)));
     }
     return null;
 }
 public function handle_user_input(&$user_input, &$plugin_cookies)
 {
     hd_print(__METHOD__);
     hd_print(__METHOD__ . ":" . print_r($user_input, true));
     if ($user_input->control_id == 'pop_up') {
         $media_url = MediaURL::decode($user_input->selected_media_url);
         $key = (string) $media_url->category_id;
         // hd_print("key = $key");
         if ($key) {
             $url = EmplexerConfig::getInstance()->getPlexBaseUrl($plugin_cookies, $this) . '/library/sections/' . $key;
             /*$popUp = new EmplexerPopUp(4);
             		$action = $popUp->showPopUpMenu($url);*/
             $doc = HD::http_get_document(EmplexerConfig::getInstance()->getPlexBaseUrl($plugin_cookies, $this) . '/library/sections/' . $key);
             $pop_up_items = array();
             $xml = simplexml_load_string($doc);
             $defaultFilter = 'all';
             if ($media_url->type == 'show') {
                 $defaultFilter = isset($plugin_cookies->defaultShowFilter) ? $plugin_cookies->defaultShowFilter : 'all';
             }
             if ($media_url->type == 'movie') {
                 $defaultFilter = isset($plugin_cookies->defaultMovieFilter) ? $plugin_cookies->defaultMovieFilter : 'all';
             }
             foreach ($xml->Directory as $c) {
                 $key = (string) $c->attributes()->key;
                 $prompt = (string) $c->attributes()->prompt;
                 $is_secondary = (string) $c->attributes()->secondary;
                 if ($key != $defaultFilter && $key != 'folder' && !$prompt) {
                     // if ($key != 'all' ){
                     $pop_up_items[] = array(GuiMenuItemDef::caption => (string) $c->attributes()->title, GuiMenuItemDef::action => ActionFactory::open_folder($this->get_right_media_url_for_pop_up($media_url, $key, $is_secondary != null), $key));
                 }
             }
             hd_print(__METHOD__ . ' pop_up_items:' . print_r($pop_up_items, true));
             $action = ActionFactory::show_popup_menu($pop_up_items);
             // hd_print(__METHOD__ . ': ' . print_r($action, true));
             return $action;
         } else {
             return null;
         }
     }
     if ($user_input->control_id == 'savePref') {
         hd_print(__METHOD__ . ':' . print_r($user_input, true));
         hd_print(__METHOD__ . ':' . print_r($plugin_cookies, true));
         EmplexerSetupScreen::savePreferences($user_input, $plugin_cookies);
     }
 }
Ejemplo n.º 10
0
 public function handle_user_input(&$user_input, &$plugin_cookies)
 {
     hd_print('Vod genres: handle_user_input:');
     foreach ($user_input as $key => $value) {
         hd_print("  {$key} => {$value}");
     }
     if ($user_input->control_id == 'select_genre') {
         if (!isset($user_input->selected_media_url)) {
             return null;
         }
         $media_url = MediaURL::decode($user_input->selected_media_url);
         $genre_id = $media_url->genre_id;
         $caption = $this->vod->get_genre_caption($genre_id);
         $media_url_str = $this->vod->get_genre_media_url_str($genre_id);
         return ActionFactory::open_folder($media_url_str, $caption);
     }
     return null;
 }
Ejemplo n.º 11
0
 public function get_vod_info($media_url_str, &$plugin_cookies)
 {
     // hd_print(print_r(debug_backtrace(), true));
     HD::print_backtrace();
     $media_url = MediaURL::decode($media_url_str);
     hd_print(__METHOD__ . ': ' . print_r($media_url, true));
     if ($media_url->screen_id == 'emplexer_base_channel') {
         $toPlay = $media_url->video_media_array[$plugin_cookies->channel_selected_index];
         return EmplexerBaseChannel::get_vod_info($toPlay);
     }
     if ($media_url->screen_id == 'vod_movie') {
         return $this->vod->get_vod_info($media_url, $plugin_cookies);
         // EmplexerVod::get_vod_info($media_url, $plugin_cookies);
     }
     $handler = $media_url->back_screen_id == EmplexerVideoList::ID ? EmplexerVideoList::ID : EmplexerMovieList::ID;
     $params = array('key' => $media_url->key, 'back_screen_id' => $media_url->back_screen_id, 'back_key' => $media_url->back_key, 'back_filter_name' => $media_url->back_filter_name);
     $stop_action = UserInputHandlerRegistry::create_action($this->get_screen_by_id($handler), 'stop', $params);
     $time_action = UserInputHandlerRegistry::create_action($this->get_screen_by_id($handler), 'time', $params);
     $series_array = array();
     $series_array[] = array(PluginVodSeriesInfo::name => $media_url->title, PluginVodSeriesInfo::playback_url => $media_url->video_url, PluginVodSeriesInfo::playback_url_is_stream_url => true);
     $toBeReturned = array(PluginVodInfo::id => $media_url->movie_id, PluginVodInfo::series => $series_array, PluginVodInfo::name => $media_url->name, PluginVodInfo::description => $media_url->summary, PluginVodInfo::poster_url => $media_url->thumb, PluginVodInfo::initial_series_ndx => 0, PluginVodInfo::buffering_ms => 3000, PluginVodInfo::initial_position_ms => EmplexerVideoList::$viewOffset, PluginVodInfo::advert_mode => false, PluginVodInfo::timer => array(GuiTimerDef::delay_ms => 5000), PluginVodInfo::actions => array(GUI_EVENT_PLAYBACK_STOP => $stop_action, GUI_EVENT_TIMER => $time_action));
     hd_print(print_r($toBeReturned, true));
     return $toBeReturned;
 }
Ejemplo n.º 12
0
 private function get_regular_folder_item($group, $c, &$plugin_cookies)
 {
     return array(PluginRegularFolderItem::media_url => MediaURL::encode(array('channel_id' => $c->get_id(), 'group_id' => $group->get_id())), PluginRegularFolderItem::caption => $c->get_title(), PluginRegularFolderItem::view_item_params => array(ViewItemParams::icon_path => $c->get_icon_url(), ViewItemParams::item_detailed_icon_path => $c->get_icon_url()), PluginRegularFolderItem::starred => $this->tv->is_favorite_channel_id($c->get_id(), $plugin_cookies));
 }
Ejemplo n.º 13
0
 public function get_vod_info($media_url_str, &$plugin_cookies)
 {
     if (is_null($this->vod)) {
         throw new Exception('VOD is not supported');
     }
     $media_url = MediaURL::decode($media_url_str);
     return $this->vod->get_vod_info($media_url, $plugin_cookies);
 }
Ejemplo n.º 14
0
 public function downLoadSubtitleFromPlex(&$user_input, &$plugin_cookies, $video_url, $languageCode = 'por')
 {
     $media_url = MediaURL::decode($user_input->selected_media_url);
     $base_url = EmplexerConfig::getInstance()->getPlexBaseUrl($plugin_cookies, $this);
     $url = $base_url . $media_url->detail_info_key;
     $xml = HD::getAndParseXmlFromUrl($url);
     $subtitleFileName = str_replace(array(".mkv", ".avi", ".mp4"), '.srt', HD::nfsUrlToSystemPath($video_url));
     foreach ($xml->Video->Media->Part->Stream as $stream) {
         //is subtitle?
         //is languageCode == $languageCode?
         //Subtititle dosen't exists local?
         if ($stream->attributes()->streamType == "3" && $stream->attributes()->languageCode == $languageCode && !file_exists($subtitleFileName)) {
             //download the subtitle
             hd_print(__METHOD__ . ' não existe legenda local e existe no plex a legenda com o código: ' . $languageCode . ' vou baixar e colocar com o nome ' . $subtitleFileName);
             $subtitleUrl = $base_url . $stream->attributes()->key;
             $subData = HD::http_get_document($subtitleUrl);
             file_put_contents($subtitleFileName, $subData);
         }
     }
 }
Ejemplo n.º 15
0
 public static function get_media_url_str($key, $type = TYPE_DIRECTORY, $videoMediaArray = null)
 {
     hd_print(__METHOD__);
     return MediaURL::encode(array('screen_id' => self::ID, 'key' => $key, 'type' => $type, 'video_media_array' => $videoMediaArray));
 }
 public static function get_media_url_str($movie_id)
 {
     return MediaURL::encode(array('screen_id' => self::ID, 'movie_id' => $movie_id));
 }
 public static function get_media_url_str($movie_id)
 {
     hd_print(__METHOD__);
     return MediaURL::encode(array('screen_id' => self::ID));
 }
Ejemplo n.º 18
0
 public function get_all_folder_items(MediaURL $media_url, &$plugin_cookies)
 {
     $this->tv->folder_entered($media_url, $plugin_cookies);
     $fav_channel_ids = $this->tv->get_fav_channel_ids($plugin_cookies);
     $items = array();
     foreach ($fav_channel_ids as $channel_id) {
         if (preg_match('/^\\s*$/', $channel_id)) {
             continue;
         }
         try {
             $c = $this->tv->get_channel($channel_id);
         } catch (Exception $e) {
             hd_print("Warning: channel '{$channel_id}' not found.");
             continue;
         }
         array_push($items, array(PluginRegularFolderItem::media_url => MediaURL::encode(array('channel_id' => $c->get_id(), 'group_id' => '__favorites')), PluginRegularFolderItem::caption => $c->get_title(), PluginRegularFolderItem::view_item_params => array(ViewItemParams::icon_path => $c->get_icon_url(), ViewItemParams::item_detailed_icon_path => $c->get_icon_url()), PluginRegularFolderItem::starred => false));
     }
     return $items;
 }
Ejemplo n.º 19
0
 public static function get_media_url_str($key, $filter_name = null, $type = 'movie')
 {
     hd_print(__METHOD__);
     self::$type = $type;
     return MediaURL::encode(array('screen_id' => self::ID, 'key' => $key, 'category_id' => $key, 'filter_name' => $filter_name, 'type' => $type));
 }
 public static function get_media_url_str($category_id, $filter_name = null, $type = 'movie')
 {
     // $filter_name = !isset($filter_name)?'all':$filter_name;
     return MediaURL::encode(array('screen_id' => self::ID, 'category_id' => $category_id, 'filter_name' => $filter_name, 'type' => $type));
 }
Ejemplo n.º 21
0
 public function doEnterSearch(&$user_input)
 {
     hd_print(__METHOD__);
     $media_url = MediaURL::decode($user_input->selected_media_url);
     return $this->showSearchScreen($media_url->key, 'Search', $plugin_cookies);
 }
Ejemplo n.º 22
0
 public function add_special_groups(&$items)
 {
     array_unshift($items, array(PluginRegularFolderItem::media_url => MediaURL::encode(array('screen_id' => KtvVodRootScreen::ID)), PluginRegularFolderItem::caption => 'Videoteka', PluginRegularFolderItem::view_item_params => array(ViewItemParams::icon_path => $this->session->get_icon('mov_root.png'))));
 }