(Fix) Torrent Tags (Generes) 🐛

This commit is contained in:
HDVinnie
2019-01-08 11:05:03 -05:00
parent ea4e3f41f4
commit 0f36fd109d
2 changed files with 25 additions and 30 deletions
+1 -1
View File
@@ -74,7 +74,7 @@ class TorrentHelper
$anon = $torrent->anon;
if ($anon == 0) {
// Auto Shout and Achievements
// Achievements
$user->unlock(new UserMadeUpload(), 1);
$user->addProgress(new UserMade25Uploads(), 1);
$user->addProgress(new UserMade50Uploads(), 1);
+24 -29
View File
@@ -779,12 +779,6 @@ class TorrentController extends Controller
$category->num_torrent = $category->torrents_count;
$category->save();
// Torrent Tags System
/*foreach(explode(',', Input::get('tags')) as $k => $v)
{
}*/
// Backup the files contained in the torrent
$fileList = TorrentTools::getTorrentFiles($decodedTorrent);
foreach ($fileList as $file) {
@@ -796,6 +790,30 @@ class TorrentController extends Controller
unset($f);
}
// Torrent Tags System
if ($torrent->category_id == 2) {
if ($torrent->tmdb && $torrent->tmdb != 0) {
$movie = $client->scrape('tv', null, $torrent->tmdb);
} else {
$movie = $client->scrape('tv', 'tt'.$torrent->imdb);
}
} else {
if ($torrent->tmdb && $torrent->tmdb != 0) {
$movie = $client->scrape('movie', null, $torrent->tmdb);
} else {
$movie = $client->scrape('movie', 'tt'.$torrent->imdb);
}
}
if ($movie->genres) {
foreach ($movie->genres as $genre) {
$tag = new TagTorrent();
$tag->torrent_id = $torrent->id;
$tag->tag_name = $genre;
$tag->save();
}
}
// check for trusted user and update torrent
if ($user->group->is_trusted) {
$appurl = config('app.url');
@@ -822,29 +840,6 @@ class TorrentController extends Controller
\LogActivity::addToLog("Member {$user->username} has uploaded torrent, ID: {$torrent->id} NAME: {$torrent->name} . \nThis torrent is pending approval from satff.");
}
if ($torrent->category_id == 2) {
if ($torrent->tmdb && $torrent->tmdb != 0) {
$movie = $client->scrape('tv', null, $torrent->tmdb);
} else {
$movie = $client->scrape('tv', 'tt'.$torrent->imdb);
}
} else {
if ($torrent->tmdb && $torrent->tmdb != 0) {
$movie = $client->scrape('movie', null, $torrent->tmdb);
} else {
$movie = $client->scrape('movie', 'tt'.$torrent->imdb);
}
}
if ($movie->genres) {
foreach ($movie->genres as $genre) {
$tag = new TagTorrent();
$tag->torrent_id = $torrent->id;
$tag->tag_name = $genre;
$tag->save();
}
}
return redirect()->route('download_check', ['slug' => $torrent->slug, 'id' => $torrent->id])
->with($this->toastr->success('Your torrent file is ready to be downloaded and seeded!', 'Yay!', ['options']));
}