public function __destruct()
 {
     hd_print(__METHOD__);
     HD::print_backtrace();
     $this->open();
     fwrite($this->fileDescriptor, "quit\n");
     fclose($this->fileDescriptor);
     //		hd_print(__METHOD__ . ': já fechei fileDescriptor veja '  .$this->fileDescriptor);
 }
Пример #2
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;
 }
Пример #3
0
 public static function http_get_document($url, $opts = null)
 {
     $url = str_replace('//', '/', $url);
     $url = str_replace('http:/', 'http://', $url);
     $url = str_replace('https:/', 'https://', $url);
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_TIMEOUT, 20);
     curl_setopt($ch, CURLOPT_USERAGENT, 'DuneHD/1.0');
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
     curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
     $emplexerClientHeaders = array('X-Plex-Client-Capabilities' => 'protocols=shoutcast,webkit,http-video;videoDecoders=h264{profile:high&resolution:1080&level:51};audioDecoders=mp3,aac', 'X-Plex-Client-Identifier' => 'b6d41f8a-e5ad-4987-a74b-ca12b143b0e0', 'X-Plex-Client-Platform' => 'Dune', 'X-Plex-Language' => 'en', 'X-Plex-Version' => 'abc');
     if (isset($opts)) {
         foreach ($opts as $k => $v) {
             curl_setopt($ch, $k, $v);
         }
     }
     hd_print("HTTP fetching \nurl:'{$url}'...");
     $content = curl_exec($ch);
     $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
     $acceptedHeaders = array(200, 403);
     hd_print('http_code = ' . $http_code);
     if (!in_array($http_code, $acceptedHeaders)) {
         $err_msg = "HTTP request failed ({$http_code})";
         hd_print($err_msg);
         HD::print_backtrace();
         switch ($http_code) {
             case '0':
                 //timeout
                 $msg = "The area you are trying to access is taking too long to respond, try again. ({$http_code})";
                 break;
             case '404':
                 $msg = "the area you are trying to access does not return any xml. ({$http_code})";
                 break;
             default:
                 $msg = "houve um problema ao acessar essa area, try again. ({$http_code})";
                 break;
         }
         throw new DuneException('Error: "' . $err_msg . '"', 0, ActionFactory::show_error(false, $msg));
     }
     hd_print("HTTP OK ({$http_code})");
     curl_close($ch);
     if ($http_code == 200) {
         return $content;
     } elseif ($http_code == 403) {
         $session_expired = array('result' => 'error', 'error' => 'Session expired', 'error_code' => '403');
         return json_encode($session_expired);
     }
 }
Пример #4
-1
 public function get_vod_info(MediaURL $media_url, &$plugin_cookies)
 {
     HD::print_backtrace();
     $movie = $this->get_cached_movie($media_url->movie_id);
     hd_print(__METHOD__ . ' teste:' . print_r($movie, true));
     $m = HD::getAndParseXmlFromUrl($this->base_url . $media_url->movie_id);
     $viewOffset = $m->Video->attributes()->viewOffset ? (string) $m->Video->attributes()->viewOffset : 0;
     // $params['selected_media_url'] = $toPlay->selected_media_url;
     $series_array = array();
     $series_array[] = array(PluginVodSeriesInfo::name => $movie->name_original . "\n" . $movie->name, PluginVodSeriesInfo::playback_url => $movie->series_list[0]->playback_url, PluginVodSeriesInfo::playback_url_is_stream_url => true);
     $toBeReturned = array(PluginVodInfo::id => 1, PluginVodInfo::series => $movie->series_list, PluginVodInfo::name => $movie->name_original, PluginVodInfo::description => $movie->description, PluginVodInfo::poster_url => $movie->poster_url, PluginVodInfo::initial_series_ndx => 0, PluginVodInfo::buffering_ms => 6000, PluginVodInfo::initial_position_ms => $viewOffset, PluginVodInfo::advert_mode => false, PluginVodInfo::timer => array(GuiTimerDef::delay_ms => 5000));
     // hd_print(__METHOD__ . ':'  . print_r($toBeReturned, true));
     return $toBeReturned;
 }