diff --git a/Blacklight/Movie.php b/Blacklight/Movie.php
index a0d200014..e0a04b3ef 100755
--- a/Blacklight/Movie.php
+++ b/Blacklight/Movie.php
@@ -212,7 +212,7 @@ class Movie
*/
public function getMovieInfo($imdbId)
{
- return MovieInfo::query()->where('imdbid', str_pad($imdbId, 7, '0', STR_PAD_LEFT))->first();
+ return MovieInfo::query()->where('imdbid', str_pad($imdbId, 8, '0', STR_PAD_LEFT))->first();
}
/**
@@ -596,16 +596,16 @@ class Movie
}
// Check TMDB for IMDB info.
- $tmdb = $this->fetchTMDBProperties(str_pad($imdbId, 7, '0', STR_PAD_LEFT));
+ $tmdb = $this->fetchTMDBProperties(str_pad($imdbId, 8, '0', STR_PAD_LEFT));
// Check IMDB for movie info.
- $imdb = $this->fetchIMDBProperties(str_pad($imdbId, 7, '0', STR_PAD_LEFT));
+ $imdb = $this->fetchIMDBProperties(str_pad($imdbId, 8, '0', STR_PAD_LEFT));
// Check TRAKT for movie info
- $trakt = $this->fetchTraktTVProperties(str_pad($imdbId, 7, '0', STR_PAD_LEFT));
+ $trakt = $this->fetchTraktTVProperties(str_pad($imdbId, 8, '0', STR_PAD_LEFT));
// Check OMDb for movie info
- $omdb = $this->fetchOmdbAPIProperties(str_pad($imdbId, 7, '0', STR_PAD_LEFT));
+ $omdb = $this->fetchOmdbAPIProperties(str_pad($imdbId, 8, '0', STR_PAD_LEFT));
// Check iTunes for movie info as last resort (iTunes do not provide all the info we need)
@@ -616,40 +616,40 @@ class Movie
}
// Check FanArt.tv for cover and background images.
- $fanart = $this->fetchFanartTVProperties(str_pad($imdbId, 7, '0', STR_PAD_LEFT));
+ $fanart = $this->fetchFanartTVProperties(str_pad($imdbId, 8, '0', STR_PAD_LEFT));
$mov = [];
$mov['cover'] = $mov['backdrop'] = $mov['banner'] = 0;
$mov['type'] = $mov['director'] = $mov['actors'] = $mov['language'] = '';
- $mov['imdbid'] = str_pad($imdbId, 7, '0', STR_PAD_LEFT);
+ $mov['imdbid'] = str_pad($imdbId, 8, '0', STR_PAD_LEFT);
$mov['tmdbid'] = (! isset($tmdb['tmdbid']) || $tmdb['tmdbid'] === '') ? 0 : $tmdb['tmdbid'];
$mov['traktid'] = (! isset($trakt['id']) || $trakt['id'] === '') ? 0 : $trakt['id'];
// Prefer Fanart.tv cover over TMDB,TMDB over IMDB,IMDB over OMDB and OMDB over iTunes.
if (! empty($fanart['cover'])) {
- $mov['cover'] = $this->releaseImage->saveImage(str_pad($imdbId, 7, '0', STR_PAD_LEFT).'-cover', $fanart['cover'], $this->imgSavePath);
+ $mov['cover'] = $this->releaseImage->saveImage(str_pad($imdbId, 8, '0', STR_PAD_LEFT).'-cover', $fanart['cover'], $this->imgSavePath);
} elseif (! empty($tmdb['cover'])) {
- $mov['cover'] = $this->releaseImage->saveImage(str_pad($imdbId, 7, '0', STR_PAD_LEFT).'-cover', $tmdb['cover'], $this->imgSavePath);
+ $mov['cover'] = $this->releaseImage->saveImage(str_pad($imdbId, 8, '0', STR_PAD_LEFT).'-cover', $tmdb['cover'], $this->imgSavePath);
} elseif (! empty($imdb['cover'])) {
- $mov['cover'] = $this->releaseImage->saveImage(str_pad($imdbId, 7, '0', STR_PAD_LEFT).'-cover', $imdb['cover'], $this->imgSavePath);
+ $mov['cover'] = $this->releaseImage->saveImage(str_pad($imdbId, 8, '0', STR_PAD_LEFT).'-cover', $imdb['cover'], $this->imgSavePath);
} elseif (! empty($omdb['cover'])) {
- $mov['cover'] = $this->releaseImage->saveImage(str_pad($imdbId, 7, '0', STR_PAD_LEFT).'-cover', $omdb['cover'], $this->imgSavePath);
+ $mov['cover'] = $this->releaseImage->saveImage(str_pad($imdbId, 8, '0', STR_PAD_LEFT).'-cover', $omdb['cover'], $this->imgSavePath);
} elseif (! empty($iTunes['cover'])) {
- $mov['cover'] = $this->releaseImage->saveImage(str_pad($imdbId, 7, '0', STR_PAD_LEFT).'-cover', $iTunes['cover'], $this->imgSavePath);
+ $mov['cover'] = $this->releaseImage->saveImage(str_pad($imdbId, 8, '0', STR_PAD_LEFT).'-cover', $iTunes['cover'], $this->imgSavePath);
}
// Backdrops.
if (! empty($fanart['backdrop'])) {
- $mov['backdrop'] = $this->releaseImage->saveImage(str_pad($imdbId, 7, '0', STR_PAD_LEFT).'-backdrop', $fanart['backdrop'], $this->imgSavePath, 1920, 1024);
+ $mov['backdrop'] = $this->releaseImage->saveImage(str_pad($imdbId, 8, '0', STR_PAD_LEFT).'-backdrop', $fanart['backdrop'], $this->imgSavePath, 1920, 1024);
} elseif (! empty($tmdb['backdrop'])) {
- $mov['backdrop'] = $this->releaseImage->saveImage(str_pad($imdbId, 7, '0', STR_PAD_LEFT).'-backdrop', $tmdb['backdrop'], $this->imgSavePath, 1920, 1024);
+ $mov['backdrop'] = $this->releaseImage->saveImage(str_pad($imdbId, 8, '0', STR_PAD_LEFT).'-backdrop', $tmdb['backdrop'], $this->imgSavePath, 1920, 1024);
}
// Banner
if (! empty($fanart['banner'])) {
- $mov['banner'] = $this->releaseImage->saveImage(str_pad($imdbId, 7, '0', STR_PAD_LEFT).'-banner', $fanart['banner'], $this->imgSavePath);
+ $mov['banner'] = $this->releaseImage->saveImage(str_pad($imdbId, 8, '0', STR_PAD_LEFT).'-banner', $fanart['banner'], $this->imgSavePath);
}
// RottenTomatoes rating from OmdbAPI
@@ -1100,7 +1100,7 @@ class Movie
$movieInfoId = MovieInfo::query()->where('imdbid', $imdbID)->first(['id']);
- Release::query()->where('id', $id)->update(['imdbid' => str_pad($imdbID, 7, '0', STR_PAD_LEFT), 'movieinfo_id' => $movieInfoId !== null ? $movieInfoId['id'] : null]);
+ Release::query()->where('id', $id)->update(['imdbid' => str_pad($imdbID, 8, '0', STR_PAD_LEFT), 'movieinfo_id' => $movieInfoId !== null ? $movieInfoId['id'] : null]);
// If set, scan for imdb info.
if ($processImdb === 1) {
@@ -1112,7 +1112,7 @@ class Movie
} elseif ($info === true) {
$movieInfoId = MovieInfo::query()->where('imdbid', $imdbID)->first(['id']);
- Release::query()->where('id', $id)->update(['imdbid' => str_pad($imdbID, 7, '0', STR_PAD_LEFT), 'movieinfo_id' => $movieInfoId !== null ? $movieInfoId['id'] : null]);
+ Release::query()->where('id', $id)->update(['imdbid' => str_pad($imdbID, 8, '0', STR_PAD_LEFT), 'movieinfo_id' => $movieInfoId !== null ? $movieInfoId['id'] : null]);
}
}
}
diff --git a/Blacklight/Releases.php b/Blacklight/Releases.php
index f874f995e..bd452600d 100755
--- a/Blacklight/Releases.php
+++ b/Blacklight/Releases.php
@@ -1164,7 +1164,7 @@ class Releases extends Release
$this->showPasswords(),
(! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''),
! empty($tags) ? " AND tt.tag_name IN ('".implode("','", $tags)."')" : '',
- ($imDbId !== -1 && is_numeric($imDbId)) ? sprintf(' AND m.imdbid = %d ', str_pad($imDbId, 7, '0', STR_PAD_LEFT)) : '',
+ ($imDbId !== -1 && is_numeric($imDbId)) ? sprintf(' AND m.imdbid = %d ', str_pad($imDbId, 8, '0', STR_PAD_LEFT)) : '',
($tmDbId !== -1 && is_numeric($tmDbId)) ? sprintf(' AND m.tmdbid = %d ', $tmDbId) : '',
($traktId !== -1 && is_numeric($traktId)) ? sprintf(' AND m.traktid = %d ', $traktId) : '',
! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '',
diff --git a/Blacklight/http/XML_Response.php b/Blacklight/http/XML_Response.php
index b95c33c8a..bb33569d7 100755
--- a/Blacklight/http/XML_Response.php
+++ b/Blacklight/http/XML_Response.php
@@ -479,7 +479,7 @@ class XML_Response
$this->writeZedAttr('tvmazeid', $this->release->tvmaze);
}
if (isset($this->release->imdb) && $this->release->imdb > 0) {
- $this->writeZedAttr('imdbid', str_pad($this->release->imdb, 7, '0', STR_PAD_LEFT));
+ $this->writeZedAttr('imdbid', str_pad($this->release->imdb, 8, '0', STR_PAD_LEFT));
}
if (isset($this->release->tmdb) && $this->release->tmdb > 0) {
$this->writeZedAttr('tmdbid', $this->release->tmdb);
diff --git a/Changelog b/Changelog
index 23f04d407..367910f76 100755
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,5 @@
2019-04-04 DariusIII
+ * Chg: Add migrations and update themes for new imdbid length
* Chg: Update releases, movieinfo and user_movies migrations imdbid column definition to be string(varchar in mysql) due to changes in imdbid numbering
* Chg: Add nntmux shell command script to shorten typing (ie ./nntmux nntmux:all in place of php artisan nntmux:all command)
2019-04-03 DariusIII
diff --git a/app/Http/Controllers/Admin/MovieController.php b/app/Http/Controllers/Admin/MovieController.php
index 53586eed1..7fbfd2678 100644
--- a/app/Http/Controllers/Admin/MovieController.php
+++ b/app/Http/Controllers/Admin/MovieController.php
@@ -46,7 +46,7 @@ class MovieController extends BasePageController
$meta_title = $title = 'Movie Add';
- $id = str_pad($request->input('id'), 7, '0', STR_PAD_LEFT);
+ $id = str_pad($request->input('id'), 8, '0', STR_PAD_LEFT);
if ($request->has('id') && \strlen($id) === 7) {
$movCheck = $movie->getMovieInfo($id);
diff --git a/app/Http/Controllers/MyMoviesController.php b/app/Http/Controllers/MyMoviesController.php
index ace96c441..bdfab0fa8 100644
--- a/app/Http/Controllers/MyMoviesController.php
+++ b/app/Http/Controllers/MyMoviesController.php
@@ -59,7 +59,7 @@ class MyMoviesController extends BasePageController
if ($action === 'doadd') {
$category = ($request->has('category') && \is_array($request->input('category')) && ! empty($request->input('category'))) ? $request->input('category') : [];
- UserMovie::addMovie($this->userdata->id, str_pad($imdbid, 7, '0', STR_PAD_LEFT), $category);
+ UserMovie::addMovie($this->userdata->id, str_pad($imdbid, 8, '0', STR_PAD_LEFT), $category);
if ($request->has('from')) {
return redirect($request->input('from'));
}
diff --git a/database/migrations/2019_04_04_130055_update_releases_table.php b/database/migrations/2019_04_04_130055_update_releases_table.php
new file mode 100644
index 000000000..c6d631cc9
--- /dev/null
+++ b/database/migrations/2019_04_04_130055_update_releases_table.php
@@ -0,0 +1,32 @@
+string('imdbid', 100)->nullable()->change();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('releases', function (Blueprint $table) {
+ $table->unsignedMediumInteger('imdbid')->nullable()->change();
+ });
+ }
+}
diff --git a/database/migrations/2019_04_04_150842_update_movieinfo_table.php b/database/migrations/2019_04_04_150842_update_movieinfo_table.php
new file mode 100644
index 000000000..97585607e
--- /dev/null
+++ b/database/migrations/2019_04_04_150842_update_movieinfo_table.php
@@ -0,0 +1,32 @@
+string('imdbid', 100)->change();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('movieinfo', function (Blueprint $table) {
+ $table->unsignedMediumInteger('imdbid')->change();
+ });
+ }
+}
diff --git a/database/migrations/2019_04_04_152238_update_user_movies_table.php b/database/migrations/2019_04_04_152238_update_user_movies_table.php
new file mode 100644
index 000000000..c73c8c435
--- /dev/null
+++ b/database/migrations/2019_04_04_152238_update_user_movies_table.php
@@ -0,0 +1,32 @@
+string('imdbid', 100)->change();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('user_movies', function (Blueprint $table) {
+ $table->unsignedMediumInteger('imdbid')->change();
+ });
+ }
+}
diff --git a/misc/testing/DB/add_movieinfo_id.php b/misc/testing/DB/add_movieinfo_id.php
index d4c4e4a9d..1a083eec4 100644
--- a/misc/testing/DB/add_movieinfo_id.php
+++ b/misc/testing/DB/add_movieinfo_id.php
@@ -27,7 +27,7 @@ $count = $sql->count();
echo 'Copying '.$count.' imdbid values'.PHP_EOL;
foreach ($sql as $movie) {
- DB::table('movie_temp')->insert(['releases_id' => $movie['id'], 'imdbid' => str_pad($movie['imdbid'], 7, '0', STR_PAD_LEFT)]);
+ DB::table('movie_temp')->insert(['releases_id' => $movie['id'], 'imdbid' => str_pad($movie['imdbid'], 8, '0', STR_PAD_LEFT)]);
echo '.';
}
diff --git a/resources/views/themes/Gentele/movies.tpl b/resources/views/themes/Gentele/movies.tpl
index ccf40907a..3258225ae 100755
--- a/resources/views/themes/Gentele/movies.tpl
+++ b/resources/views/themes/Gentele/movies.tpl
@@ -92,21 +92,21 @@
{assign var="mhaspreview" value=","|explode:$result->grp_haspreview}
{foreach $msplits as $m}
{if $m@first}
-
{if !empty($mfailed[$m@index])}
{/if}
IMDB
TRAKT
{if (!empty($result->tmdbid))}
Group
- Add
+ Add
{if !empty($mfailed[$m@index])}
{/if}
IMDB
TRAKT
{if (!empty($result->tmdbid))}
Group
- Add
+ Add
+ src="{$smarty.const.WWW_TOP}/covers/movies/{str_pad($result->imdbid, 8, '0', STR_PAD_LEFT)}-cover.jpg"/>
{else}
{/if}
{if $show && $release.videos_id > 0 && $show.image != "0"}
diff --git a/resources/views/themes/admin/movie-list.tpl b/resources/views/themes/admin/movie-list.tpl
index 4d487a2fb..73bd910bb 100644
--- a/resources/views/themes/admin/movie-list.tpl
+++ b/resources/views/themes/admin/movie-list.tpl
@@ -15,18 +15,18 @@
{foreach $movielist as $movie}