diff --git a/lib/DB/patches/0124~movieinfo.sql b/lib/DB/patches/0124~movieinfo.sql new file mode 100644 index 000000000..91102758c --- /dev/null +++ b/lib/DB/patches/0124~movieinfo.sql @@ -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'; \ No newline at end of file diff --git a/lib/Film.php b/lib/Film.php index 7422b52fa..5be35aca4 100644 --- a/lib/Film.php +++ b/lib/Film.php @@ -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'])) { diff --git a/lib/copy_this/www/lib/movie.php b/lib/copy_this/www/lib/movie.php index c7cb9abb5..53e58f3d1 100644 --- a/lib/copy_this/www/lib/movie.php +++ b/lib/copy_this/www/lib/movie.php @@ -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; diff --git a/lib/copy_this/www/pages/movies.php b/lib/copy_this/www/pages/movies.php index 7cf9f510a..58ca99c3b 100644 --- a/lib/copy_this/www/pages/movies.php +++ b/lib/copy_this/www/pages/movies.php @@ -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(); diff --git a/lib/copy_this/www/templates/nntmux/views/frontend/viewmoviefull.tpl b/lib/copy_this/www/templates/nntmux/views/frontend/viewmoviefull.tpl index a4583b488..7107d8366 100644 --- a/lib/copy_this/www/templates/nntmux/views/frontend/viewmoviefull.tpl +++ b/lib/copy_this/www/templates/nntmux/views/frontend/viewmoviefull.tpl @@ -2,8 +2,10 @@ {foreach from=$results item=result}
{/if}
+ {if $result.banner == 1}
+ {elseif $result.cover == 1}
{/if}
{/if}
+{if $movie && $release.rageid < 0 && $movie.banner == 1}
+ {elseif $movie && $release.rageid < 0 && $movie.cover == 1}
{/if}
{if $game && $game.cover == 1}
{/if}
{if $xxx && $xxx.cover == 1}