From 6eae7cfece1e876fb6481ad2bde5139ea67dada7 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Sat, 23 Feb 2019 14:38:59 -0500 Subject: [PATCH] (Update) Meta Data :rocket: --- app/Console/Commands/FetchGenres.php | 16 +-- app/Http/Controllers/RequestController.php | 14 +-- app/Http/Controllers/TorrentController.php | 102 +++++++++--------- .../Staff/catalog/catalog_records.blade.php | 6 +- resources/views/blocks/featured.blade.php | 20 ++-- resources/views/catalogs/catalog.blade.php | 18 ++-- resources/views/catalogs/torrents.blade.php | 29 +++-- resources/views/category/category.blade.php | 26 ++--- resources/views/requests/request.blade.php | 44 ++++---- resources/views/torrent/results.blade.php | 28 ++--- resources/views/torrent/similar.blade.php | 46 ++++---- resources/views/torrent/torrent.blade.php | 52 ++++----- 12 files changed, 199 insertions(+), 202 deletions(-) diff --git a/app/Console/Commands/FetchGenres.php b/app/Console/Commands/FetchGenres.php index 89387c76f..37c96f545 100644 --- a/app/Console/Commands/FetchGenres.php +++ b/app/Console/Commands/FetchGenres.php @@ -46,22 +46,22 @@ class FetchGenres extends Command ->get(); foreach ($torrents as $torrent) { - if ($torrent->category_id == 2) { + if ($torrent->category->tv_meta) { if ($torrent->tmdb && $torrent->tmdb != 0) { - $movie = $client->scrape('tv', null, $torrent->tmdb); + $meta = $client->scrape('tv', null, $torrent->tmdb); } else { - $movie = $client->scrape('tv', 'tt'.$torrent->imdb); + $meta = $client->scrape('tv', 'tt'.$torrent->imdb); } - } else { + } elseif ($torrent->category->movie_meta) { if ($torrent->tmdb && $torrent->tmdb != 0) { - $movie = $client->scrape('movie', null, $torrent->tmdb); + $meta = $client->scrape('movie', null, $torrent->tmdb); } else { - $movie = $client->scrape('movie', 'tt'.$torrent->imdb); + $meta = $client->scrape('movie', 'tt'.$torrent->imdb); } } - if ($movie->genres) { - foreach ($movie->genres as $genre) { + if ($meta->genres) { + foreach ($meta->genres as $genre) { $tag = new TagTorrent(); $tag->torrent_id = $torrent->id; $tag->tag_name = $genre; diff --git a/app/Http/Controllers/RequestController.php b/app/Http/Controllers/RequestController.php index edeeb3c23..2d805185e 100644 --- a/app/Http/Controllers/RequestController.php +++ b/app/Http/Controllers/RequestController.php @@ -213,17 +213,17 @@ class RequestController extends Controller $comments = $torrentRequest->comments()->latest('created_at')->paginate(6); $carbon = Carbon::now()->addDay(); $client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); - if ($torrentRequest->category_id == 2) { + if ($torrentRequest->category->tv_meta) { if ($torrentRequest->tmdb || $torrentRequest->tmdb != 0) { - $movie = $client->scrape('tv', null, $torrentRequest->tmdb); + $meta = $client->scrape('tv', null, $torrentRequest->tmdb); } else { - $movie = $client->scrape('tv', 'tt'.$torrentRequest->imdb); + $meta = $client->scrape('tv', 'tt'.$torrentRequest->imdb); } - } else { + } elseif ($torrentRequest->category->movie_meta) { if ($torrentRequest->tmdb || $torrentRequest->tmdb != 0) { - $movie = $client->scrape('movie', null, $torrentRequest->tmdb); + $meta = $client->scrape('movie', null, $torrentRequest->tmdb); } else { - $movie = $client->scrape('movie', 'tt'.$torrentRequest->imdb); + $meta = $client->scrape('movie', 'tt'.$torrentRequest->imdb); } } @@ -232,7 +232,7 @@ class RequestController extends Controller 'voters' => $voters, 'user' => $user, 'comments' => $comments, 'carbon' => $carbon, - 'movie' => $movie, + 'meta' => $meta, 'torrentRequestClaim' => $torrentRequestClaim, ]); } diff --git a/app/Http/Controllers/TorrentController.php b/app/Http/Controllers/TorrentController.php index b62ffe9aa..47c379bd1 100755 --- a/app/Http/Controllers/TorrentController.php +++ b/app/Http/Controllers/TorrentController.php @@ -138,22 +138,22 @@ class TorrentController extends Controller $client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); foreach ($torrents as $torrent) { - $movie = null; - if ($torrent->category_id == 2) { + $meta = null; + if ($torrent->category->tv_meta) { if ($torrent->tmdb || $torrent->tmdb != 0) { - $movie = $client->scrape('tv', null, $torrent->tmdb); + $meta = $client->scrape('tv', null, $torrent->tmdb); } elseif ($torrent->imdb && $torrent->imdb != 0) { - $movie = $client->scrape('tv', 'tt'.$torrent->imdb); + $meta = $client->scrape('tv', 'tt'.$torrent->imdb); } - } else { + } elseif ($torrent->category->movie_meta) { if ($torrent->tmdb || $torrent->tmdb != 0) { - $movie = $client->scrape('movie', null, $torrent->tmdb); + $meta = $client->scrape('movie', null, $torrent->tmdb); } elseif ($torrent->imdb && $torrent->imdb != 0) { - $movie = $client->scrape('movie', 'tt'.$torrent->imdb); + $meta = $client->scrape('movie', 'tt'.$torrent->imdb); } } - if ($movie) { - $torrent->movie = $movie; + if ($meta) { + $torrent->meta = $meta; } } @@ -275,22 +275,22 @@ class TorrentController extends Controller $client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); foreach ($torrents as $k1 => $c) { foreach ($c as $k2 => $d) { - $movie = null; - if ($d['chunk']->category_id == 2) { + $meta = null; + if ($d['chunk']->category->tv_meta) { if ($d['chunk']->tmdb || $d['chunk']->tmdb != 0) { - $movie = $client->scrape('tv', null, $d['chunk']->tmdb); + $meta = $client->scrape('tv', null, $d['chunk']->tmdb); } elseif ($d['chunk']->imdb && $d['chunk']->imdb != 0) { - $movie = $client->scrape('tv', 'tt'.$d['chunk']->imdb); + $meta = $client->scrape('tv', 'tt'.$d['chunk']->imdb); } - } else { + } elseif ($d['chunk']->category->movie_meta) { if ($d['chunk']->tmdb || $d['chunk']->tmdb != 0) { - $movie = $client->scrape('movie', null, $d['chunk']->tmdb); + $meta = $client->scrape('movie', null, $d['chunk']->tmdb); } elseif ($d['chunk']->imdb && $d['chunk']->imdb != 0) { - $movie = $client->scrape('movie', 'tt'.$d['chunk']->imdb); + $meta = $client->scrape('movie', 'tt'.$d['chunk']->imdb); } } - if ($movie) { - $d['chunk']->movie = $movie; + if ($meta) { + $d['chunk']->meta = $meta; } } } @@ -737,22 +737,22 @@ class TorrentController extends Controller $client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); foreach ($torrents as $k1 => $c) { foreach ($c as $k2 => $d) { - $movie = null; - if ($d['chunk']->category_id == 2) { + $meta = null; + if ($d['chunk']->category->tv_meta) { if ($d['chunk']->tmdb || $d['chunk']->tmdb != 0) { - $movie = $client->scrape('tv', null, $d['chunk']->tmdb); + $meta = $client->scrape('tv', null, $d['chunk']->tmdb); } elseif ($d['chunk']->imdb && $d['chunk']->imdb != 0) { - $movie = $client->scrape('tv', 'tt'.$d['chunk']->imdb); + $meta = $client->scrape('tv', 'tt'.$d['chunk']->imdb); } - } else { + } elseif ($d['chunk']->category->movie_meta) { if ($d['chunk']->tmdb || $d['chunk']->tmdb != 0) { - $movie = $client->scrape('movie', null, $d['chunk']->tmdb); + $meta = $client->scrape('movie', null, $d['chunk']->tmdb); } elseif ($d['chunk']->imdb && $d['chunk']->imdb != 0) { - $movie = $client->scrape('movie', 'tt'.$d['chunk']->imdb); + $meta = $client->scrape('movie', 'tt'.$d['chunk']->imdb); } } - if ($movie) { - $d['chunk']->movie = $movie; + if ($meta) { + $d['chunk']->meta = $meta; } } } @@ -763,22 +763,22 @@ class TorrentController extends Controller } $client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); foreach ($torrents as $torrent) { - $movie = null; - if ($torrent->category_id == 2) { + $meta = null; + if ($torrent->category->tv_meta) { if ($torrent->tmdb || $torrent->tmdb != 0) { - $movie = $client->scrape('tv', null, $torrent->tmdb); + $meta = $client->scrape('tv', null, $torrent->tmdb); } elseif ($torrent->imdb && $torrent->imdb != 0) { - $movie = $client->scrape('tv', 'tt'.$torrent->imdb); + $meta = $client->scrape('tv', 'tt'.$torrent->imdb); } - } else { + } elseif ($torrent->category->movie_meta) { if ($torrent->tmdb || $torrent->tmdb != 0) { - $movie = $client->scrape('movie', null, $torrent->tmdb); + $meta = $client->scrape('movie', null, $torrent->tmdb); } elseif ($torrent->imdb && $torrent->imdb != 0) { - $movie = $client->scrape('movie', 'tt'.$torrent->imdb); + $meta = $client->scrape('movie', 'tt'.$torrent->imdb); } } - if ($movie) { - $torrent->movie = $movie; + if ($meta) { + $torrent->meta = $meta; } } } @@ -848,17 +848,17 @@ class TorrentController extends Controller $last_seed_activity = History::where('info_hash', '=', $torrent->info_hash)->where('seeder', '=', 1)->latest('updated_at')->first(); $client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); - if ($torrent->category_id == 2) { + if ($torrent->category->tv_meta) { if ($torrent->tmdb && $torrent->tmdb != 0) { - $movie = $client->scrape('tv', null, $torrent->tmdb); + $meta = $client->scrape('tv', null, $torrent->tmdb); } else { - $movie = $client->scrape('tv', 'tt'.$torrent->imdb); + $meta = $client->scrape('tv', 'tt'.$torrent->imdb); } - } else { + } elseif ($torrent->category->movie_meta) { if ($torrent->tmdb && $torrent->tmdb != 0) { - $movie = $client->scrape('movie', null, $torrent->tmdb); + $meta = $client->scrape('movie', null, $torrent->tmdb); } else { - $movie = $client->scrape('movie', 'tt'.$torrent->imdb); + $meta = $client->scrape('movie', 'tt'.$torrent->imdb); } } @@ -902,7 +902,7 @@ class TorrentController extends Controller 'user' => $user, 'personal_freeleech' => $personal_freeleech, 'freeleech_token' => $freeleech_token, - 'movie' => $movie, + 'meta' => $meta, 'total_tips' => $total_tips, 'user_tips' => $user_tips, 'client' => $client, @@ -1254,22 +1254,22 @@ class TorrentController extends Controller } // Torrent Tags System - if ($torrent->category_id == 2) { + if ($torrent->category->tv_meta) { if ($torrent->tmdb && $torrent->tmdb != 0) { - $movie = $client->scrape('tv', null, $torrent->tmdb); + $meta = $client->scrape('tv', null, $torrent->tmdb); } else { - $movie = $client->scrape('tv', 'tt'.$torrent->imdb); + $meta = $client->scrape('tv', 'tt'.$torrent->imdb); } - } else { + } elseif ($torrent->category->movie_meta) { if ($torrent->tmdb && $torrent->tmdb != 0) { - $movie = $client->scrape('movie', null, $torrent->tmdb); + $meta = $client->scrape('movie', null, $torrent->tmdb); } else { - $movie = $client->scrape('movie', 'tt'.$torrent->imdb); + $meta = $client->scrape('movie', 'tt'.$torrent->imdb); } } - if ($movie->genres) { - foreach ($movie->genres as $genre) { + if ($meta->genres) { + foreach ($meta->genres as $genre) { $tag = new TagTorrent(); $tag->torrent_id = $torrent->id; $tag->tag_name = $genre; diff --git a/resources/views/Staff/catalog/catalog_records.blade.php b/resources/views/Staff/catalog/catalog_records.blade.php index 7e6cc623f..3d8709f71 100644 --- a/resources/views/Staff/catalog/catalog_records.blade.php +++ b/resources/views/Staff/catalog/catalog_records.blade.php @@ -43,10 +43,10 @@ @else @foreach ($records as $record) - scrape('movie', 'tt' . $record->imdb); ?> + scrape('movie', 'tt' . $record->imdb); ?> - {{ $movie->releaseYear }} - {{ $movie->title }} + {{ $meta->releaseYear }} + {{ $meta->title }} #{{$record->imdb}} diff --git a/resources/views/blocks/featured.blade.php b/resources/views/blocks/featured.blade.php index 218e29009..d746ab1dc 100644 --- a/resources/views/blocks/featured.blade.php +++ b/resources/views/blocks/featured.blade.php @@ -38,17 +38,17 @@ @foreach ($featured as $key => $feature) - @if ($feature->torrent->category_id == 2) + @if ($feature->torrent->category->tv_meta) @if ($feature->torrent->tmdb || $feature->torrent->tmdb != 0) - @php $movie = $client->scrape('tv', null, $feature->torrent->tmdb); @endphp + @php $meta = $client->scrape('tv', null, $feature->torrent->tmdb); @endphp @else - @php $movie = $client->scrape('tv', 'tt'. $feature->torrent->imdb); @endphp + @php $meta = $client->scrape('tv', 'tt'. $feature->torrent->imdb); @endphp @endif - @else + @elseif ($feature->torrent->category->movie_meta) @if ($feature->torrent->tmdb || $feature->torrent->tmdb != 0) - @php $movie = $client->scrape('movie', null, $feature->torrent->tmdb); @endphp + @php $meta = $client->scrape('movie', null, $feature->torrent->tmdb); @endphp @else - @php $movie = $client->scrape('movie', 'tt'. $feature->torrent->imdb); @endphp + @php $meta = $client->scrape('movie', 'tt'. $feature->torrent->imdb); @endphp @endif @endif
@@ -56,22 +56,22 @@
{{ ++$key }}
-
+

{{ $feature->torrent->name }}

- @if ($movie->genres) - @foreach ($movie->genres as $genre) + @if ($meta->genres) + @foreach ($meta->genres as $genre) | {{ $genre }} | @endforeach @endif

- {{ str_limit(strip_tags($movie->plot), 200) }}... + {{ str_limit(strip_tags($meta->plot), 200) }}...

    diff --git a/resources/views/catalogs/catalog.blade.php b/resources/views/catalogs/catalog.blade.php index 620c52b4d..168dd6d1f 100644 --- a/resources/views/catalogs/catalog.blade.php +++ b/resources/views/catalogs/catalog.blade.php @@ -32,25 +32,25 @@ @foreach ($records as $r)
    @php $client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); @endphp - @if ($r->category_id == 2) + @if ($r->category->tv_meta) @if ($r->tmdb || $r->tmdb != 0) - @php $movie = $client->scrape('tv', null, $r->tmdb); @endphp + @php $meta = $client->scrape('tv', null, $r->tmdb); @endphp @else - @php $movie = $client->scrape('tv', 'tt'. $r->imdb); @endphp + @php $meta = $client->scrape('tv', 'tt'. $r->imdb); @endphp @endif - @else + @elseif ($r->category->movie_meta) @if ($r->tmdb || $r->tmdb != 0) - @php $movie = $client->scrape('movie', null, $r->tmdb); @endphp + @php $meta = $client->scrape('movie', null, $r->tmdb); @endphp @else - @php $movie = $client->scrape('movie', 'tt'. $r->imdb); @endphp + @php $meta = $client->scrape('movie', 'tt'. $r->imdb); @endphp @endif @endif diff --git a/resources/views/catalogs/torrents.blade.php b/resources/views/catalogs/torrents.blade.php index 84c6dd050..c64d8faf1 100644 --- a/resources/views/catalogs/torrents.blade.php +++ b/resources/views/catalogs/torrents.blade.php @@ -54,37 +54,34 @@ @foreach ($torrents as $k => $t) @php $client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); @endphp - @if ($t->category_id == 2) + @if ($t->category->tv_meta) @if ($t->tmdb || $t->tmdb != 0) - @php $movie = $client->scrape('tv', null, $t->tmdb); @endphp + @php $meta = $client->scrape('tv', null, $t->tmdb); @endphp @else - @php $movie = $client->scrape('tv', 'tt'. $t->imdb); @endphp + @php $meta = $client->scrape('tv', 'tt'. $t->imdb); @endphp @endif - @else + @elseif ($t->category->movie_meta) @if ($t->tmdb || $t->tmdb != 0) - @php $movie = $client->scrape('movie', null, $t->tmdb); @endphp + @php $meta = $client->scrape('movie', null, $t->tmdb); @endphp @else - @php $movie = $client->scrape('movie', 'tt'. $t->imdb); @endphp + @php $meta = $client->scrape('movie', 'tt'. $t->imdb); @endphp @endif @endif -
    Poster
    - @if ($t->category_id == "1") + @if ($t->category->movie_meta) - @elseif ($t->category_id == "2") + @elseif ($t->category->tv_meta) - @else - @endif

    @@ -124,7 +121,7 @@ - {{ $movie->imdbRating }}/10 ({{ $movie->imdbVotes }} votes) + {{ $meta->imdbRating }}/10 ({{ $meta->imdbVotes }} votes) @else @@ -134,7 +131,7 @@ - {{ $movie->tmdbRating }}/10 ({{ $movie->tmdbVotes }} votes) + {{ $meta->tmdbRating }}/10 ({{ $meta->tmdbVotes }} votes) @else @@ -143,7 +140,7 @@ - {{ $movie->tmdbRating }}/10 ({{ $movie->tmdbVotes }} votes) + {{ $meta->tmdbRating }}/10 ({{ $meta->tmdbVotes }} votes) @endif diff --git a/resources/views/category/category.blade.php b/resources/views/category/category.blade.php index 543be1710..c9364a9ad 100755 --- a/resources/views/category/category.blade.php +++ b/resources/views/category/category.blade.php @@ -52,17 +52,17 @@ @foreach ($torrents as $torrent) - @if ($torrent->category_id == 2) + @if ($torrent->category->tv_meta) @if ($torrent->tmdb || $torrent->tmdb != 0) - @php $movie = $client->scrape('tv', null, $torrent->tmdb); @endphp + @php $meta = $client->scrape('tv', null, $torrent->tmdb); @endphp @else - @php $movie = $client->scrape('tv', 'tt'. $torrent->imdb); @endphp + @php $meta = $client->scrape('tv', 'tt'. $torrent->imdb); @endphp @endif @else @if ($torrent->tmdb || $torrent->tmdb != 0) - @php $movie = $client->scrape('movie', null, $torrent->tmdb); @endphp + @php $meta = $client->scrape('movie', null, $torrent->tmdb); @endphp @else - @php $movie = $client->scrape('movie', 'tt'. $torrent->imdb); @endphp + @php $meta = $client->scrape('movie', 'tt'. $torrent->imdb); @endphp @endif @endif @@ -74,8 +74,8 @@ @if ($user->show_poster == 1)
    - Poster
    @else @@ -178,21 +178,21 @@ - {{ $movie->imdbRating }}/10 ({{ $movie->imdbVotes }} votes) + {{ $meta->imdbRating }}/10 ({{ $meta->imdbVotes }} votes) @else - @if ($torrent->category_id == 2) - - @else - + @if ($torrent->category->tv_meta) + + @elseif ($torrent->category->movie_meta) + @endif - {{ $movie->tmdbRating }}/10 ({{ $movie->tmdbVotes }} votes) + {{ $meta->tmdbRating }}/10 ({{ $meta->tmdbVotes }} votes) @endif diff --git a/resources/views/requests/request.blade.php b/resources/views/requests/request.blade.php index be371b12f..d79b6d369 100644 --- a/resources/views/requests/request.blade.php +++ b/resources/views/requests/request.blade.php @@ -66,7 +66,7 @@
    @if ($torrentRequest->category->meta == 1)
    -
    +
    {{ $torrentRequest->category->name }}
    @@ -76,22 +76,22 @@

    - @if ($movie->title) - {{ $movie->title }} {{ $movie->releaseYear }} + @if ($meta->title) + {{ $meta->title }} {{ $meta->releaseYear }} @else Sorry Not Meta Found @endif - @if ($movie->imdbRating || $movie->tmdbRating) + @if ($meta->imdbRating || $meta->tmdbRating) @lang('torrent.rating'): @if ($user->ratings == 1) - {{ $movie->imdbRating }}/10({{ $movie->imdbVotes }} @lang('torrent.votes') + {{ $meta->imdbRating }}/10({{ $meta->imdbVotes }} @lang('torrent.votes') ) @else - {{ $movie->tmdbRating }}/10({{ $movie->tmdbVotes }} @lang('torrent.votes') + {{ $meta->tmdbRating }}/10({{ $meta->tmdbVotes }} @lang('torrent.votes') ) @endif @@ -99,22 +99,22 @@


    - {{ $movie->plot }} + {{ $meta->plot }}
    @@ -273,8 +273,8 @@ data-target="#claim"> @lang('request.claim') - @lang('common.upload') {{ $movie->title ?? '' }} + @lang('common.upload') {{ $meta->title ?? '' }} @elseif ($torrentRequest->filled_hash != null && $torrentRequest->approved_by == null)