mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-09-01 02:38:55 +00:00
Switch to fanart api v3.
This commit is contained in:
+24
-23
@@ -674,37 +674,38 @@ class Film
|
||||
protected function fetchFanartTVProperties($imdbId)
|
||||
{
|
||||
if ($this->fanartapikey != '') {
|
||||
$buffer = Utility::getUrl(['url' => 'http://api.fanart.tv/webservice/movie/' . $this->fanartapikey . '/tt' . $imdbId . '/xml/']);
|
||||
$buffer = Utility::getUrl(['url' => 'https://webservice.fanart.tv/v3/movies/' . 'tt' . $imdbId . '?api_key=' . $this->fanartapikey , 'verifycert' => false]);
|
||||
if ($buffer !== false) {
|
||||
$art = @simplexml_load_string($buffer);
|
||||
if ($art !== false) {
|
||||
$ret = array();
|
||||
if (isset($art->movie->moviebackgrounds->moviebackground[0]['url'])) {
|
||||
$ret['backdrop'] = $art->movie->moviebackgrounds->moviebackground[0]['url'];
|
||||
} else if (isset($art->movie->moviethumbs->moviethumb[0]['url'])) {
|
||||
$ret['backdrop'] = $art->movie->moviethumbs->moviethumb[0]['url'];
|
||||
}
|
||||
$art = json_decode($buffer, true);
|
||||
if (isset($art['status']) && $art['status'] === 'error') {
|
||||
return false;
|
||||
}
|
||||
$ret = array();
|
||||
if (isset($art['moviebackground'][0]['url'])) {
|
||||
$ret['backdrop'] = $art['moviebackground'][0]['url'];
|
||||
} else if (isset($art['moviethumb'[0]['url']])) {
|
||||
$ret['backdrop'] = $art['moviethumb'][0]['url'];
|
||||
}
|
||||
|
||||
if (isset($art->movie->movieposters->movieposter[0]['url'])) {
|
||||
$ret['cover'] = $art->movie->movieposters->movieposter[0]['url'];
|
||||
}
|
||||
if (isset($art['movieposter'][0]['url'])) {
|
||||
$ret['cover'] = $art['movieposter'][0]['url'];
|
||||
}
|
||||
|
||||
if (isset($ret['backdrop']) && isset($ret['cover'])) {
|
||||
if (isset($ret['backdrop']) && isset($ret['cover'])) {
|
||||
|
||||
$ret['title'] = $imdbId;
|
||||
if (isset($art->movie['name'])) {
|
||||
$ret['title'] = $art->movie['name'];
|
||||
}
|
||||
if ($this->echooutput) {
|
||||
$this->pdo->log->doEcho($this->pdo->log->alternateOver("Fanart Found ") . $this->pdo->log->headerOver($ret['title']));
|
||||
}
|
||||
return $ret;
|
||||
$ret['title'] = $imdbId;
|
||||
if (isset($art['name'])) {
|
||||
$ret['title'] = $art['name'];
|
||||
}
|
||||
if ($this->echooutput) {
|
||||
$this->pdo->log->doEcho($this->pdo->log->alternateOver("Fanart Found ") . $this->pdo->log->headerOver($ret['title']));
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch info for IMDB id from TMDB.
|
||||
|
||||
Reference in New Issue
Block a user