(Update) Display Game Meta On Torrent List View 🚀

This commit is contained in:
HDVinnie
2019-07-25 13:55:59 -04:00
parent b9894ab461
commit bcf03e7fe8
2 changed files with 49 additions and 12 deletions
+17 -3
View File
@@ -157,6 +157,9 @@ class TorrentController extends Controller
$meta = $client->scrape('movie', 'tt'.$torrent->imdb);
}
}
if ($torrent->category->game_meta) {
$meta = Game::with(['cover' => ['url', 'image_id']])->find($torrent->igdb);
}
if ($meta) {
$torrent->meta = $meta;
}
@@ -291,13 +294,17 @@ class TorrentController extends Controller
} elseif ($d['chunk']->imdb && $d['chunk']->imdb != 0) {
$meta = $client->scrape('tv', 'tt'.$d['chunk']->imdb);
}
} elseif ($d['chunk']->category->movie_meta) {
}
if ($d['chunk']->category->movie_meta) {
if ($d['chunk']->tmdb || $d['chunk']->tmdb != 0) {
$meta = $client->scrape('movie', null, $d['chunk']->tmdb);
} elseif ($d['chunk']->imdb && $d['chunk']->imdb != 0) {
$meta = $client->scrape('movie', 'tt'.$d['chunk']->imdb);
}
}
if ($d['chunk']->category->game_meta) {
$meta = Game::with(['cover' => ['url', 'image_id']])->find($d['chunk']->igdb);
}
if ($meta) {
$d['chunk']->meta = $meta;
}
@@ -765,13 +772,17 @@ class TorrentController extends Controller
} elseif ($d['chunk']->imdb && $d['chunk']->imdb != 0) {
$meta = $client->scrape('tv', 'tt'.$d['chunk']->imdb);
}
} elseif ($d['chunk']->category->movie_meta) {
}
if ($d['chunk']->category->movie_meta) {
if ($d['chunk']->tmdb || $d['chunk']->tmdb != 0) {
$meta = $client->scrape('movie', null, $d['chunk']->tmdb);
} elseif ($d['chunk']->imdb && $d['chunk']->imdb != 0) {
$meta = $client->scrape('movie', 'tt'.$d['chunk']->imdb);
}
}
if ($d['chunk']->category->game_meta) {
$meta = Game::with(['cover' => ['url', 'image_id']])->find($d['chunk']->igdb);
}
if ($meta) {
$d['chunk']->meta = $meta;
}
@@ -799,6 +810,9 @@ class TorrentController extends Controller
$meta = $client->scrape('movie', 'tt'.$torrent->imdb);
}
}
if ($torrent->category->game_meta) {
$meta = Game::with(['cover' => ['url', 'image_id']])->find($torrent->igdb);
}
if ($meta) {
$torrent->meta = $meta;
}
@@ -1298,7 +1312,7 @@ class TorrentController extends Controller
'tvdb' => 'required|numeric',
'tmdb' => 'required|numeric',
'mal' => 'required|numeric',
'igdb' => 'required|numeric',
'igdb' => 'required|numeric',
'type' => 'required',
'anon' => 'required',
'stream' => 'required',
+32 -9
View File
@@ -36,13 +36,17 @@
@else
@php $meta = $client->scrape('tv', 'tt'. $torrent->imdb); @endphp
@endif
@elseif ($torrent->category->movie_meta)
@endif
@if ($torrent->category->movie_meta)
@if ($torrent->tmdb || $torrent->tmdb != 0)
@php $meta = $client->scrape('movie', null, $torrent->tmdb); @endphp
@else
@php $meta = $client->scrape('movie', 'tt'. $torrent->imdb); @endphp
@endif
@endif
@if ($torrent->category->game_meta)
@php $meta = MarcReichel\IGDBLaravel\Models\Game::with(['cover' => ['url', 'image_id']])->find($torrent->igdb); @endphp
@endif
@if ($torrent->sticky == 1)
<tr class="success">
@@ -52,14 +56,22 @@
<td>
@if ($user->show_poster == 1)
<div class="torrent-poster pull-left">
@if (isset($meta) && $meta->poster && $meta->title)
<img src="{{ $meta->poster }}"
data-name='<i style="color: #a5a5a5;">{{ $meta->title }}</i>' data-image='<img src="{{ $meta->poster }}" alt="@lang('torrent.poster')" style="height: 1000px;">'
class="torrent-poster-img-small show-poster" alt="@lang('torrent.poster')">
@else
<img src="https://via.placeholder.com/600x900"
data-name='<i style="color: #a5a5a5;">N/A</i>' data-image='<img src="https://via.placeholder.com/600x900" alt="@lang('torrent.poster')" style="height: 1000px;">'
class="torrent-poster-img-small show-poster" alt="@lang('torrent.poster')">
@if ($torrent->category->movie_meta || $torrent->category->tv_meta && isset($meta) && $meta->poster && $meta->title)
<img src="{{ $meta->poster ?? 'https://via.placeholder.com/600x900' }}"
data-name='<i style="color: #a5a5a5;">{{ $meta->title ?? 'N/A' }}</i>' data-image='<img src="{{ $meta->poster ?? 'https://via.placeholder.com/600x900' }}" alt="@lang('torrent.poster')" style="height: 1000px;">'
class="torrent-poster-img-small show-poster" alt="@lang('torrent.poster')">
@endif
@if ($torrent->category->game_meta)
<img src="https://images.igdb.com/igdb/image/upload/t_original/{{ $meta->cover->image_id }}.jpg"
data-name='<i style="color: #a5a5a5;">{{ $meta->name ?? 'N/A' }}</i>' data-image='<img src="https://images.igdb.com/igdb/image/upload/t_original/{{ $meta->cover->image_id }}.jpg" alt="@lang('torrent.poster')" style="height: 1000px;">'
class="torrent-poster-img-small show-poster" alt="@lang('torrent.poster')">
@endif
@if ($torrent->category->no_meta || $torrent->category->music_meta)
<img src="https://via.placeholder.com/600x900"
data-name='<i style="color: #a5a5a5;">N/A</i>' data-image='<img src="https://via.placeholder.com/600x900" alt="@lang('torrent.poster')" style="height: 1000px;">'
class="torrent-poster-img-small show-poster" alt="@lang('torrent.poster')">
@endif
</div>
@else
@@ -202,6 +214,17 @@
@endif
@endif
@if ($torrent->category->game_meta)
<a href="{{ $meta->url }}" title="IMDB" target="_blank">
<span class="badge-extra text-bold">@lang('torrent.rating'):
<span class="text-gold movie-rating-stars">
<i class="{{ config('other.font-awesome') }} fa-star"></i>
</span>
{{ $meta->rating }}/100 ({{ $meta->rating_count }} @lang('torrent.votes'))
</span>
</a>
@endif
<span class="badge-extra text-bold text-pink">
<i class="{{ config('other.font-awesome') }} fa-heart" data-toggle="tooltip" data-original-title="@lang('torrent.thanks-given')"></i>
{{ $torrent->thanks_count }}