mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-09-01 02:38:55 +00:00
Use fanart movie banner when available.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE movieinfo ADD COLUMN banner TINYINT(1) UNSIGNED NOT NULL DEFAULT '0';
|
||||
UPDATE `tmux` set `value` = '124' where `setting` = 'sqlpatch';
|
||||
+38
-5
@@ -517,6 +517,28 @@ class Film
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a variable is set and not a empty string.
|
||||
*
|
||||
* @param $imdbID
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function checkBanner($imdbID)
|
||||
{
|
||||
$banner = NN_COVERS . 'movies' . DS . $imdbID . '-banner.jpg';
|
||||
$cover = NN_COVERS . 'movies' . DS . $imdbID . '-cover.jpg';
|
||||
$coverStripped = preg_match('/covers\/([^\/]+?)\/(?:[^\/]+\/)?(.+)/', $cover, $matches);
|
||||
$covpath = $matches[0];
|
||||
if (file_exists($banner)) {
|
||||
$bannerStripped = preg_match('/covers\/([^\/]+?)\/(?:[^\/]+\/)?(.+)/', $banner, $matches);
|
||||
$banpath = $matches[0];
|
||||
var_dump($banpath);
|
||||
return $banpath;
|
||||
}
|
||||
return $covpath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch IMDB/TMDB info for the movie.
|
||||
*
|
||||
@@ -544,7 +566,7 @@ class Film
|
||||
|
||||
$mov = array();
|
||||
|
||||
$mov['cover'] = $mov['backdrop'] = $movieID = 0;
|
||||
$mov['cover'] = $mov['backdrop'] = $mov['banner'] = $movieID = 0;
|
||||
$mov['type'] = $mov['director'] = $mov['actors'] = $mov['language'] = '';
|
||||
|
||||
$mov['imdbid'] = $imdbId;
|
||||
@@ -566,6 +588,11 @@ class Film
|
||||
$mov['backdrop'] = $this->releaseImage->saveImage($imdbId . '-backdrop', $tmdb['backdrop'], $this->imgSavePath, 1920, 1024);
|
||||
}
|
||||
|
||||
// Banner
|
||||
if ($this->checkVariable($fanart['banner'])) {
|
||||
$mov['banner'] = $this->releaseImage->saveImage($imdbId . '-banner', $fanart['banner'], $this->imgSavePath);
|
||||
}
|
||||
|
||||
$mov['title'] = $this->setTmdbImdbVar($imdb['title'] , $tmdb['title']);
|
||||
$mov['rating'] = $this->setTmdbImdbVar($imdb['rating'] , $tmdb['rating']);
|
||||
$mov['plot'] = $this->setTmdbImdbVar($imdb['plot'] , $tmdb['plot']);
|
||||
@@ -612,12 +639,12 @@ class Film
|
||||
sprintf("
|
||||
INSERT INTO movieinfo
|
||||
(imdbid, tmdbID, title, rating, tagline, plot, year, genre, type,
|
||||
director, actors, language, cover, backdrop, createddate, updateddate)
|
||||
director, actors, language, cover, backdrop, banner, createddate, updateddate)
|
||||
VALUES
|
||||
(%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %d, %d, NOW(), NOW())
|
||||
(%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %d, %d, %d, NOW(), NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
imdbid = %d, tmdbID = %s, title = %s, rating = %s, tagline = %s, plot = %s, year = %s, genre = %s,
|
||||
type = %s, director = %s, actors = %s, language = %s, cover = %d, backdrop = %d, updateddate = NOW()",
|
||||
type = %s, director = %s, actors = %s, language = %s, cover = %d, backdrop = %d, banner = %d, updateddate = NOW()",
|
||||
$mov['imdbid'],
|
||||
$mov['tmdbid'],
|
||||
$this->pdo->escapeString($mov['title']),
|
||||
@@ -632,6 +659,7 @@ class Film
|
||||
$this->pdo->escapeString(substr($mov['language'], 0, 64)),
|
||||
$mov['cover'],
|
||||
$mov['backdrop'],
|
||||
$mov['banner'],
|
||||
$mov['imdbid'],
|
||||
$mov['tmdbid'],
|
||||
$this->pdo->escapeString($mov['title']),
|
||||
@@ -645,7 +673,8 @@ class Film
|
||||
$this->pdo->escapeString($mov['actors']),
|
||||
$this->pdo->escapeString(substr($mov['language'], 0, 64)),
|
||||
$mov['cover'],
|
||||
$mov['backdrop']
|
||||
$mov['backdrop'],
|
||||
$mov['banner']
|
||||
)
|
||||
);
|
||||
|
||||
@@ -690,6 +719,10 @@ class Film
|
||||
if (isset($art['movieposter'][0]['url'])) {
|
||||
$ret['cover'] = $art['movieposter'][0]['url'];
|
||||
}
|
||||
if (isset($art['moviebanner'][0]['url'])) {
|
||||
$ret['banner'] = $art['moviebanner'][0]['url'];
|
||||
}
|
||||
|
||||
if (isset($ret['backdrop']) && isset($ret['cover'])) {
|
||||
$ret['title'] = $imdbId;
|
||||
if (isset($art['name'])) {
|
||||
|
||||
@@ -268,7 +268,7 @@ class Movie
|
||||
$row["grp_haspreview"] = substr($arr[$row["imdbid"]]["haspreview"], 0, -1);
|
||||
$row["grp_release_password"] = substr($arr[$row["imdbid"]]["passwordstatus"], 0, -1);
|
||||
$row["grp_release_guid"] = substr($arr[$row["imdbid"]]["guid"], 0, -1);
|
||||
$row["grp_release_nfoID"] = substr($arr[$row["imdbid"]]["nfoid"], 0, -1);
|
||||
$row["grp_release_nfoid"] = substr($arr[$row["imdbid"]]["nfoid"], 0, -1);
|
||||
$row["grp_release_grpname"] = substr($arr[$row["imdbid"]]["grpname"], 0, -1);
|
||||
$row["grp_release_name"] = substr($arr[$row["imdbid"]]["searchname"], 0, -1);
|
||||
$row["grp_release_postdate"] = substr($arr[$row["imdbid"]]["postdate"], 0, -1);
|
||||
@@ -276,8 +276,8 @@ class Movie
|
||||
$row["grp_release_totalparts"] = substr($arr[$row["imdbid"]]["totalpart"], 0, -1);
|
||||
$row["grp_release_comments"] = substr($arr[$row["imdbid"]]["comments"], 0, -1);
|
||||
$row["grp_release_grabs"] = substr($arr[$row["imdbid"]]["grabs"], 0, -1);
|
||||
$row["grp_release_categoryID"] = substr($arr[$row["imdbid"]]["categoryid"], 0, -1);
|
||||
$row["grp_release_categoryName"] = substr($arr[$row["imdbid"]]["categoryname"], 0, -1);
|
||||
$row["grp_release_categoryid"] = substr($arr[$row["imdbid"]]["categoryid"], 0, -1);
|
||||
$row["grp_release_categoryname"] = substr($arr[$row["imdbid"]]["categoryname"], 0, -1);
|
||||
}
|
||||
}
|
||||
return $rows;
|
||||
|
||||
@@ -3,7 +3,7 @@ require_once(WWW_DIR."/lib/movie.php");
|
||||
require_once(WWW_DIR."/lib/category.php");
|
||||
|
||||
$movie = new Movie;
|
||||
$cat = new Category;
|
||||
$cat = new Category(['Settings' => $page->settings]);
|
||||
|
||||
if (!$users->isLoggedIn())
|
||||
$page->show403();
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
{foreach from=$results item=result}
|
||||
<div id="moviefull">
|
||||
{if $result.cover == 1}<img class="shadow pic" alt="{$result.title|escape:"htmlall"} Logo"
|
||||
src="{$smarty.const.WWW_TOP}/covers/movies/{$result.imdbid}-cover.jpg" width="180" border="0"/>{/if}
|
||||
{if $result.banner == 1}<img class="shadow img-thumbnail" alt="{$result.title|escape:"htmlall"} Logo"
|
||||
src="{$smarty.const.WWW_TOP}/covers/movies/{$result.imdbid}-banner.jpg"/>
|
||||
{elseif $result.cover == 1}<img class="shadow pic" alt="{$result.title|escape:"htmlall"} Logo"
|
||||
src="{$smarty.const.WWW_TOP}/covers/movies/{$result.imdbid}-cover.jpg" width="180" border="0"/>{/if}
|
||||
<h1>{$result.title|escape:"htmlall"} ({$result.year})</h1>
|
||||
|
||||
<h2>{if $result.genre != ''}{$result.genre|replace:"|":" / "}{/if}</h2>
|
||||
@@ -110,7 +112,7 @@
|
||||
|
||||
{assign var="msplits" value=","|explode:$result.grp_release_id}
|
||||
{assign var="mguid" value=","|explode:$result.grp_release_guid}
|
||||
{assign var="mnfo" value=","|explode:$result.grp_release_nfoID}
|
||||
{assign var="mnfo" value=","|explode:$result.grp_release_nfoid}
|
||||
{assign var="mgrp" value=","|explode:$result.grp_release_grpname}
|
||||
{assign var="mname" value="#"|explode:$result.grp_release_name}
|
||||
{assign var="mpostdate" value=","|explode:$result.grp_release_postdate}
|
||||
@@ -121,8 +123,8 @@
|
||||
{assign var="mpass" value=","|explode:$result.grp_release_password}
|
||||
{assign var="minnerfiles" value=","|explode:$result.grp_rarinnerfilecount}
|
||||
{assign var="mhaspreview" value=","|explode:$result.grp_haspreview}
|
||||
{assign var="mcat" value=","|explode:$result.grp_release_categoryID}
|
||||
{assign var="mcatname" value=","|explode:$result.grp_release_categoryName}
|
||||
{assign var="mcat" value=","|explode:$result.grp_release_categoryid}
|
||||
{assign var="mcatname" value=","|explode:$result.grp_release_categoryname}
|
||||
|
||||
{foreach from=$msplits item=m}
|
||||
<tr class="{cycle values=",alt"}" id="guid{$mguid[$m@index]}">
|
||||
|
||||
@@ -40,7 +40,8 @@
|
||||
|
||||
<!-- ### -- IMAGE ON RIGHT -->
|
||||
{if $rage && $release.rageid > 0 && $rage.imgdata != ""}<img class="img-rounded" src="{$smarty.const.WWW_TOP}/getimage?type=tvrage&id={$rage.id}" width="220" height="auto" alt="{$rage.releasetitle|escape:"htmlall"}" style="float:right;" />{/if}
|
||||
{if $movie && $release.rageid < 0 && $movie.cover == 1}<img class="shadow img-thumbnail" src="{$smarty.const.WWW_TOP}/covers/movies/{$movie.imdbid}-cover.jpg" width="220" height="auto" alt="{$movie.title|escape:"htmlall"}" style="float:right;" />{/if}
|
||||
{if $movie && $release.rageid < 0 && $movie.banner == 1}<img class="shadow img-thumbnail" src="{$smarty.const.WWW_TOP}/covers/movies/{$movie.imdbid}-banner.jpg" alt="{$movie.title|escape:"htmlall"}" style="vertical-align: top;" />
|
||||
{elseif $movie && $release.rageid < 0 && $movie.cover == 1}<img class="shadow img-thumbnail" src="{$smarty.const.WWW_TOP}/covers/movies/{$movie.imdbid}-cover.jpg" alt="{$movie.title|escape:"htmlall"}" style="vertical-align: top;" />{/if}
|
||||
{if $game && $game.cover == 1}<img class="img-rounded" src="{$smarty.const.WWW_TOP}/covers/games/{$game.id}.jpg" width="160"
|
||||
alt="{$con.title|escape:"htmlall"}" style="float:right;" />{/if}
|
||||
{if $xxx && $xxx.cover == 1}<img class="img-rounded" src="{$smarty.const.WWW_TOP}/covers/xxx/{$xxx.id}-cover.jpg" width="160"
|
||||
|
||||
Reference in New Issue
Block a user