some progress

This commit is contained in:
2025-08-07 23:01:58 +03:00
parent e8d7e6a1c4
commit e351803db2
14 changed files with 971 additions and 226 deletions
+12 -1
View File
@@ -3,6 +3,8 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Movie;
use App\Models\Comment;
class HomeController extends Controller
{
@@ -12,6 +14,15 @@ class HomeController extends Controller
public function index()
{
return view('home');
$trendingMovies = Movie::orderBy('vote_average', 'desc')
->take(5)
->get();
$latestReviews = Comment::with('author')
->latest()
->take(5)
->get();
return view('home', compact('trendingMovies', 'latestReviews'));
}
}
+10
View File
@@ -25,4 +25,14 @@ class ShowController extends Controller
return view('show.show', compact('show', 'comments', 'seasons'));
}
public function season(string $slug, int $seasonNumber)
{
}
public function episode(string $slug, int $seasonNumber, int $episodeNumber)
{
}
}
+6
View File
@@ -22,6 +22,12 @@ class Comment extends Model
'tmdb_url',
];
protected $dates = [
'published_at',
'created_at',
'updated_at'
];
public function author()
{
return $this->hasOne(User::class, 'id', 'user_id');
+2 -1
View File
@@ -72,7 +72,8 @@ class Movie extends Model
public function director()
{
return $this->belongsToMany(Person::class, 'movie_cast', 'movie_id', 'person_id')
->where('movie_cast.known_for_department', 'Directing')
->where('movie_cast.job', 'Director')
->orWhere('movie_cast.known_for_department', 'Directing')
;
}
@@ -53,7 +53,7 @@ class MovieProcessingService implements ProcessingInterface
$join->on('movies.tmdb_id', '=', 'item_to_fetch_jobs.tmdb_id');
})
->whereRaw("FIND_IN_SET('".ItemToFetchJobs::JOB_DETAILS."', item_to_fetch_jobs.jobs)")
->where('item_to_fetch_jobs.type', 'movies')
->whereIn('item_to_fetch_jobs.type', ['movies', 'movie'])
->whereNull('movies.id')
->take($batch)
->get();
@@ -84,6 +84,10 @@ class MovieProcessingService implements ProcessingInterface
private function getDetails($item)
{
$tmdbMovie = $this->moviesApi->getMovie($item->tmdb_id);
if (isset($tmdbMovie['status_code']) && $tmdbMovie['status_code'] == 34) {
echo "[N]";
return;
}
$tmdbMovie['tmdb_id'] = $tmdbMovie['id'];
Log::channel('fetch_export_items_details')->info("Processing TmdbId ".$tmdbMovie['tmdb_id']);
@@ -629,7 +633,8 @@ class MovieProcessingService implements ProcessingInterface
ItemToFetchJobs::create([
'tmdb_id' => $tmdbRecommendation['id'],
'type' => ItemToFetch::TYPE_MOVIE,
'remaining_jobs' => json_encode($jobs),
'remaining_jobs' => implode(',', $jobs),
'jobs' => implode(',', $jobs),
]);
$this->getDetails($itemToFetch);
@@ -694,7 +699,8 @@ class MovieProcessingService implements ProcessingInterface
ItemToFetchJobs::create([
'tmdb_id' => $tmdbSimilarMovie['id'],
'type' => ItemToFetch::TYPE_MOVIE,
'remaining_jobs' => json_encode($jobs),
'remaining_jobs' => implode(',', $jobs),
'jobs' => implode(',', $jobs),
]);
$this->getDetails($itemToFetch);