mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-29 06:51:30 -05:00
(Fix) Torrent Tags (Generes) 🐛
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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']));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user