public function get_folder_range(MediaURL $media_url, $from_ndx, &$plugin_cookies) { $movie_range = $this->get_short_movie_range($media_url, $from_ndx, $plugin_cookies); $total = intval($movie_range->total); if ($total <= 0) { return HD::create_regular_folder_range(array()); } $items = array(); foreach ($movie_range->short_movies as $movie) { $items[] = array(PluginRegularFolderItem::media_url => VodMovieScreen::get_media_url_str($movie->id), PluginRegularFolderItem::caption => $movie->name, PluginRegularFolderItem::view_item_params => array(ViewItemParams::icon_path => $movie->poster_url)); $this->vod->set_cached_short_movie(new ShortMovie($movie->id, $movie->name, $movie->poster_url)); } return HD::create_regular_folder_range($items, $movie_range->from_ndx, $total); }
public function get_all_folder_items(MediaURL $media_url, &$plugin_cookies) { $this->vod->folder_entered($media_url, $plugin_cookies); $this->vod->ensure_favorites_loaded($plugin_cookies); $movie_ids = $this->vod->get_favorite_movie_ids(); $items = array(); foreach ($movie_ids as $movie_id) { $short_movie = $this->vod->get_cached_short_movie($movie_id); if (is_null($short_movie)) { $caption = "#{$movie_id}"; $poster_url = "missing://"; } else { $caption = $short_movie->name; $poster_url = $short_movie->poster_url; } $items[] = array(PluginRegularFolderItem::media_url => VodMovieScreen::get_media_url_str($movie_id), PluginRegularFolderItem::caption => $caption, PluginRegularFolderItem::view_item_params => array(ViewItemParams::icon_path => $poster_url)); } return $items; }
public function handle_user_input(&$user_input, &$plugin_cookies) { // hd_print(__METHOD__); hd_print(print_r($user_input, true)); hd_print(print_r($plugin_cookies, true)); $base_url = EmplexerConfig::getInstance()->getPlexBaseUrl($plugin_cookies, $this); $media_url = MediaURL::decode($user_input->selected_media_url); if ($user_input->control_id == 'show_resume_menu') { $play_action = UserInputHandlerRegistry::create_action($this, 'play'); if (!isset($plugin_cookies->resumePlayBack) || $plugin_cookies->resumePlayBack == "ask") { if ($media_url->viewOffset <= 0) { self::$viewOffset = 0; return $play_action; } $pop_up_items[] = array(GuiMenuItemDef::caption => 'Resume from ' . gmdate("H:i:s", $media_url->viewOffset / 1000), GuiMenuItemDef::action => UserInputHandlerRegistry::create_action($this, 'play', array('viewOffset' => $media_url->viewOffset))); $pop_up_items[] = array(GuiMenuItemDef::caption => 'Start from beginning', GuiMenuItemDef::action => UserInputHandlerRegistry::create_action($this, 'play', array('viewOffset' => 0))); return ActionFactory::show_popup_menu($pop_up_items); } else { if ($plugin_cookies->resumePlayBack == "resume") { EmplexerVideoList::$viewOffset = $media_url->viewOffset; return $play_action; } else { EmplexerVideoList::$viewOffset = 0; return $play_action; } } } else { if ($user_input->control_id == 'play') { if (isset($user_input->viewOffset)) { EmplexerVideoList::$viewOffset = $user_input->viewOffset; } hd_print(__METHOD__ . ':' . print_r($user_input, true)); if (strpos($media_url->video_url, "VIDEO_TS.IFO")) { $url = dirname($media_url->video_url); return ActionFactory::dvd_play($url); } else { if (strpos(strtolower($media_url->video_url), ".iso")) { return ActionFactory::launch_media_url($media_url->video_url); //ActionFactory::dvd_play($media_url->video_url); } else { if (strpos(strtolower($media_url->video_url), "bdmv")) { $pos = strpos(strtolower($media_url->video_url), 'bdmv'); $url = substr($media_url->video_url, 0, $pos - 1); hd_print('tentando tocar bluray com a url ' . $url); return ActionFactory::bluray_play($url); } else { if (strpos(strtolower($media_url->video_url), ".m2ts")) { return ActionFactory::launch_media_url($media_url->video_url); } else { $url = $media_url->video_url; $key = $media_url->key; $startPosition = $media_url->viewOffset / 1000; $plexFileId = $media_url->key; $timeToMark = DEFAULT_TIME_TO_MARK; $basePlexURL = $base_url; $pooling = 5; $time_action = UserInputHandlerRegistry::create_action($this, 'time', null); // EmplexerFifoController::getInstance()->startPlexNotify($key, 5 , EmplexerConfig::getInstance()->getPlexBaseUrl($plugin_cookies, $this).'/'); // EmplexerFifoController::getInstance()->startDefaultPlayBack($url,$startPosition,$plexFileId,$timeToMark,$basePlexURL,$pooling); // EmplexerFifoController::getInstance()->startSetPlayBackPosition(200); // return ActionFactory::launch_media_url($media_url->video_url); $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, 'stop', $params); // $time_action = UserInputHandlerRegistry::create_action($this->get_screen_by_id($handler), 'time', $params); if (!isset($plugin_cookies->useVodPlayback) || $plugin_cookies->useVodPlayback === "true") { hd_print('vou chamar o vod_play'); return ActionFactory::vod_play(); } else { // public function startSetPlayBackPosition($position, &$plugin_cookies, $id, $mark_time=40, $pooling_time=5, $delay=3){ // $viewOffset = $media_url->viewOffset ? $media_url->viewOffset / 1000 : 1 ; hd_print(__METHOD__ . ': viewOffset = ' . self::$viewOffset); EmplexerFifoController::getInstance()->startSetPlayBackPosition(self::$viewOffset, $plugin_cookies, $key); // $this->downLoadSubtitleFromPlex(&$user_input, &$plugin_cookies, $media_url->video_url, 'por'); return ActionFactory::launch_media_url($media_url->video_url, $stop_action); } } } } } } } if ($user_input->control_id == 'stop') { //try to stop my transcoded session (if not a transcoded session nothing happend) // TranscodeManager::getInstance($plugin_cookies->plexIp,$plugin_cookies->plexPort)->stopSession(); hd_print('ENTREI NO EVENTO STOP' . print_r($user_input, true)); hd_print('ENTREI NO EVENTO STOP' . print_r($plugin_cookies, true)); $media_url = $this->get_media_url_str($user_input->back_key, $user_input->back_filter_name); EmplexerFifoController::getInstance()->killPlexNotify(); $action = ActionFactory::invalidate_folders(array($media_url)); return $action; } if ($user_input->control_id == 'time') { hd_print(__METHOD__ . ':' . ' aconteceu o evento time ' . print_r($user_input, true)); // HD::print_backtrace(); $key = $user_input->key; EmplexerFifoController::getInstance()->startPlexNotify($key, 5, EmplexerConfig::getInstance()->getPlexBaseUrl($plugin_cookies, $this) . '/'); } if ($user_input->control_id == 'info') { $extra = array('bgImage' => $media_url->art); return ActionFactory::open_folder(VodMovieScreen::get_media_url_str($media_url->detail_info_key, $extra)); } if ($user_input->control_id == 'pop_up') { $key = (int) $media_url->key; $was_seen = $media_url->was_seen; $url = null; if ($was_seen) { // http://192.168.2.9:32400/:/unscrobble?key=19547&identifier=com.plexapp.plugins.library $url = EmplexerConfig::getInstance()->getPlexBaseUrl($plugin_cookies, $this) . "/:/unscrobble?key={$key}&identifier=com.plexapp.plugins.library"; } else { // http://192.168.2.9:32400/:/scrobble?key=19547&identifier=com.plexapp.plugins.library $url = EmplexerConfig::getInstance()->getPlexBaseUrl($plugin_cookies, $this) . "/:/scrobble?key={$key}&identifier=com.plexapp.plugins.library"; } // hd_print(__METHOD__ . 'url:' .$url ); $params['url'] = $url; $pop_up_items[] = array(GuiMenuItemDef::caption => $was_seen ? 'mark as unwatched' : 'mark as watched', GuiMenuItemDef::action => UserInputHandlerRegistry::create_action($this, 'mark', $params)); // hd_print(__METHOD__ . ' pop_up_items:' .print_r($pop_up_items, true) ); return ActionFactory::show_popup_menu($pop_up_items); } if ($user_input->control_id == 'mark') { hd_print('mark = ' . print_r($user_input, true)); $back_media_url = MediaURL::decode($user_input->selected_media_url); $media_url = $this->get_media_url_str($media_url->back_key, $media_url->back_filter_name); HD::http_get_document($user_input->url); $action = ActionFactory::invalidate_folders(array($media_url)); return $action; } }