Exemplo n.º 1
0
 public function try_load_movie($movie_id, &$plugin_cookies)
 {
     // hd_print(__METHOD__  . ': ' . print_r($plugin_cookies, true)) ;
     HD::print_backtrace();
     if (!$this->base_url) {
         $this->base_url = EmplexerConfig::getInstance()->getPlexBaseUrl($plugin_cookies, $this);
     }
     $url = $this->base_url . $movie_id;
     $xml = HD::getAndParseXmlFromUrl($url);
     $movie = new Movie($movie_id);
     // $movie->set_data("American",'The American','Alone among assassins, Jack is a master craftsman. When a job in Sweden ends more harshly than expected for this American abroad, he vows to his contact Larry that his next assignment will be his last. Jack reports to the Italian countryside, where he holes up in a small town and relishes being away from death for a spell. The assignment, as specified by a Belgian woman, Mathilde, is in the offing as a weapon is constructed. Surprising himself, Jack seeks out the friendship of local priest Father Benedetto and pursues romance with local woman Clara. But by stepping out of the shadows, Jack may be tempting fate.','http://192.168.2.9:32400/library/metadata/4376/thumb/1342928192',1050,'2010','Anton Corbijn','Hiporã',
     // "George Clooney \n Jack,Thekla Reuten|Mathilde,Bruce Altman|Larry,Violante Placido|Clara|,Paolo Bonacelli|Father Benedetto",'Crime,Drama,Suspense,Thriller',6.4000000953674299,10,'R','USA','1 real');
     $grandparentTitle = (string) $xml->Video->attributes()->grandparentTitle;
     $title = $grandparentTitle ? "Episode " . (string) $xml->Video->attributes()->index . ' : ' . (string) $xml->Video->attributes()->title : (string) $xml->Video->attributes()->title;
     // (string)$xml->Video->attributes()->summary
     $movie->set_data($name = $grandparentTitle, $name_original = $title, $description = (string) $xml->Video->attributes()->summary, $poster_url = $this->base_url . '/photo/:/transcode?width=' . THUMB_WIDTH . '&height=' . THUMB_HEIGHT . '&url=' . $this->base_url . (string) $xml->Video->attributes()->thumb, $length_min = (double) $xml->Video->attributes()->duration / 1000 / 60, $year = (string) $xml->Video->attributes()->year, $directors_str = $this->geDirectorStr($xml), $scenarios_str = null, $actors_str = $this->getRolesStr($xml), $genres_str = $this->getGenreStr($xml), $rate_imdb = (double) $xml->Video->attributes()->rating, $rate_kinopoisk = null, $rate_mpaa = (string) $xml->Video->attributes()->contentRating, $country = $this->getCountryStr($xml), $budget = null);
     $tab = '     ';
     $details = array('Video' => '_', $tab . 'Bitrate' => (string) $xml->Video->Media->attributes()->bitrate, $tab . 'Width' => (string) $xml->Video->Media->attributes()->width, $tab . 'Height' => (string) $xml->Video->Media->attributes()->height, $tab . 'Aspect Ratio' => (string) $xml->Video->Media->attributes()->aspectRatio, $tab . 'Video Resolution' => (string) $xml->Video->Media->attributes()->videoResolution, $tab . 'Video Frame Rate' => (string) $xml->Video->Media->attributes()->videoFrameRate, $tab . 'Container' => (string) $xml->Video->Media->attributes()->container, $tab . 'Codec' => (string) $xml->Video->Media->attributes()->videoCodec);
     $movie->details = $details;
     $httpVidelUrl = EmplexerConfig::getInstance()->getPlexBaseUrl($plugin_cookies, $this) . (string) $xml->Video->Media->Part->attributes()->key;
     $nfsVideoUrl = 'nfs://' . $plugin_cookies->plexIp . ':' . (string) $xml->Video->Media->Part->attributes()->file;
     if ($plugin_cookies->connectionMethod == 'smb') {
         $smbVideoUrl = 'smb://' . $plugin_cookies->userName . ':' . $plugin_cookies->password . '@' . $plugin_cookies->plexIp . '/' . (string) $xml->Video->Media->Part->attributes()->file;
         $videoUrl[SMB_CONNECTION_TYPE] = $smbVideoUrl;
     }
     $videoUrl[HTTP_CONNECTION_TYPE] = $httpVidelUrl;
     $videoUrl[NFS_CONNECTION_TYPE] = $nfsVideoUrl;
     $v = $videoUrl[$plugin_cookies->connectionMethod];
     hd_print(__METHOD__ . ":-----------videoUrl = {$v}-----------");
     $movie->add_series_data(1, $movie->name, $v, true);
     // hd_print(__METHOD__ . ':' . print_r($movie, true));
     $this->set_cached_movie($movie);
     hd_print(print_r($this, true));
 }
 public function api_vod_info($movie_id)
 {
     $this->check_logged_in();
     try {
         $doc = $this->api_call(sprintf(KTV_VOD_INFO_URL, KTV::$SERVER, $this->sid_name, $this->sid, $movie_id));
     } catch (Exception $e) {
         throw $this->dune_api_exception($e, 'VOD info failed.', false);
     }
     if (!isset($doc->film)) {
         throw new Exception('Invalid data received from server');
     }
     $movie = new Movie($movie_id);
     $poster_url = 'http://' . KTV::$SERVER . $doc->film->poster;
     $movie->set_data($doc->film->name, $doc->film->name_orig, $doc->film->description, $poster_url, $doc->film->lenght, $doc->film->year, $doc->film->director, $doc->film->scenario, $doc->film->actors, $doc->film->genre_str, $doc->film->rate_imdb, $doc->film->rate_kinopoisk, $doc->film->rate_mpaa, $doc->film->country, $doc->film->budget);
     foreach ($doc->film->videos as $file) {
         $playback_url = sprintf(KTV_VOD_GET_URL_URL, KTV::$SERVER, $this->sid_name, $this->sid, $file->id);
         $movie->add_series_data($file->id, $file->title, $playback_url, false);
     }
     return $movie;
 }