From 7e0e330ef6f7d9323133e6825952422fa6019352 Mon Sep 17 00:00:00 2001 From: DoarMihai Date: Sat, 6 Sep 2025 14:41:10 +0300 Subject: [PATCH] some progress --- .../Commands/TmdbFetch/FetchExportCommand.php | 3 + .../TmdbFetch/FetchExportItemsCommand.php | 4 +- app/Http/Controllers/ShowController.php | 20 + app/Livewire/MoviePage/Recommendations.php | 2 +- app/Livewire/MoviePage/Similar.php | 5 +- app/Models/Movie.php | 10 + resources/views/celebrity/index.blade.php | 69 +-- resources/views/celebrity/show.blade.php | 239 ++++++---- resources/views/forum/index.blade.php | 113 ++--- .../views/layouts/user_actions.blade.php | 24 +- .../livewire/movie-page/tabs/videos.blade.php | 18 +- .../livewire/show-page/recommended.blade.php | 51 ++- .../livewire/show-page/similar.blade.php | 49 +-- resources/views/movie/show.blade.php | 52 ++- resources/views/show/index.blade.php | 100 +++-- resources/views/show/season.blade.php | 366 ++++++++++++++++ resources/views/show/show.blade.php | 407 +++++++++++------- routes/web.php | 4 +- storage/tv_series_08_15_2025.json.gz | Bin 0 -> 4319304 bytes storage/tv_series_08_16_2025.json.gz | Bin 0 -> 4308437 bytes 20 files changed, 1051 insertions(+), 485 deletions(-) create mode 100644 resources/views/show/season.blade.php create mode 100644 storage/tv_series_08_15_2025.json.gz create mode 100644 storage/tv_series_08_16_2025.json.gz diff --git a/app/Console/Commands/TmdbFetch/FetchExportCommand.php b/app/Console/Commands/TmdbFetch/FetchExportCommand.php index a3fad2e..f01d948 100644 --- a/app/Console/Commands/TmdbFetch/FetchExportCommand.php +++ b/app/Console/Commands/TmdbFetch/FetchExportCommand.php @@ -56,12 +56,15 @@ class FetchExportCommand extends Command private function downloadFile($url, $path): void { + echo "Downloading file at ".$url."\n"; $newFileName = $path; $file = fopen ($url, 'rb'); $newFile = null; if ($file) { + echo "Starting download ".$url."\n"; $newFile = fopen ($newFileName, 'wb'); if ($newFile) { + echo "in progress ".$url."\n"; while(!feof($file)) { fwrite($newFile, fread($file, 1024 * 8), 1024 * 8); } diff --git a/app/Console/Commands/TmdbFetch/FetchExportItemsCommand.php b/app/Console/Commands/TmdbFetch/FetchExportItemsCommand.php index 0742ad3..b27f876 100644 --- a/app/Console/Commands/TmdbFetch/FetchExportItemsCommand.php +++ b/app/Console/Commands/TmdbFetch/FetchExportItemsCommand.php @@ -22,7 +22,7 @@ class FetchExportItemsCommand extends Command * * @var string */ - protected $description = 'Fetch TMDB items from export file. Types: movie/show'; + protected $description = 'Fetch TMDB items from export file. Types: movie/tv_series'; /** * Execute the console command. @@ -42,7 +42,7 @@ class FetchExportItemsCommand extends Command $path = storage_path('/'.$type."*"); $file = glob($path); - return reset($file); + return end($file); } private function processItems($gzOpenedFile, string $type) diff --git a/app/Http/Controllers/ShowController.php b/app/Http/Controllers/ShowController.php index 74bec62..a7e0220 100644 --- a/app/Http/Controllers/ShowController.php +++ b/app/Http/Controllers/ShowController.php @@ -28,7 +28,27 @@ class ShowController extends Controller public function season(string $slug, int $seasonNumber) { + $show = Show::with('posters', 'backdrops', 'externalIds', 'networks', 'genres', 'productionCompanies')->where('slug', $slug)->first(); + if (!$show) { + abort(404); + } + + $seasons = Season::where('show_id', $show->id)->orderBy('season_number', 'ASC')->get(); + $currentSeason = Season::where('show_id', $show->id)->where('season_number', $seasonNumber)->first(); + + if (!$currentSeason) { + abort(404); + } + + $episodes = \App\Models\Episode::where('show_id', $show->id) + ->where('season_id', $currentSeason->id) + ->orderBy('episode_number', 'ASC') + ->get(); + + $comments = []; + + return view('show.season', compact('show', 'seasons', 'currentSeason', 'episodes', 'comments')); } public function episode(string $slug, int $seasonNumber, int $episodeNumber) diff --git a/app/Livewire/MoviePage/Recommendations.php b/app/Livewire/MoviePage/Recommendations.php index 41ad06e..be77488 100644 --- a/app/Livewire/MoviePage/Recommendations.php +++ b/app/Livewire/MoviePage/Recommendations.php @@ -18,6 +18,6 @@ class Recommendations extends Component public function mount() { - $this->recommendations = Movie::whereIn('id', MovieRecommendation::where('movie_id', $this->movie->id)->pluck('recommended_movie_id'))->get(); + $this->recommendations = $this->movie->recommendations; } } diff --git a/app/Livewire/MoviePage/Similar.php b/app/Livewire/MoviePage/Similar.php index cf53c6d..d4ca15d 100644 --- a/app/Livewire/MoviePage/Similar.php +++ b/app/Livewire/MoviePage/Similar.php @@ -18,9 +18,6 @@ class Similar extends Component public function mount() { - $this->similarMovies = Movie::whereIn( - 'id', - MovieSimilar::where('movie_id', $this->movie->id)->pluck('similar_movie_id') - )->get(); + $this->similarMovies = $this->movie->similar; } } diff --git a/app/Models/Movie.php b/app/Models/Movie.php index 4173db4..791ea50 100644 --- a/app/Models/Movie.php +++ b/app/Models/Movie.php @@ -131,4 +131,14 @@ class Movie extends Model { return $this->belongsToMany(ProductionCountry::class, 'movie_production_countries', 'movie_id', 'production_country_id'); } + + public function similar() + { + return $this->belongsToMany(Movie::class, 'movie_similars', 'movie_id', 'similar_movie_id'); + } + + public function recommendations() + { + return $this->belongsToMany(Movie::class, 'movie_recommendations', 'movie_id', 'recommended_movie_id'); + } } diff --git a/resources/views/celebrity/index.blade.php b/resources/views/celebrity/index.blade.php index eda78a6..1fe619d 100644 --- a/resources/views/celebrity/index.blade.php +++ b/resources/views/celebrity/index.blade.php @@ -1,51 +1,52 @@ @extends('layouts.app') @section('content') -
-
-
-
-
- Celebrities +
+
+ +
+
+
+
Celebrities
@foreach($celebrities as $celebrity) - + +
+ {{ $celebrities->links() }} +
- {{ $celebrities->links() }}
-
+ + +
-
diff --git a/resources/views/celebrity/show.blade.php b/resources/views/celebrity/show.blade.php index cccbc74..70288f2 100644 --- a/resources/views/celebrity/show.blade.php +++ b/resources/views/celebrity/show.blade.php @@ -1,122 +1,183 @@ @extends('layouts.app') @section('content') -
-
-
-
-
-

{{ $celebrity->name }}

-
+
+
+ +
+ +
-
- - TMDB + +
+
+ @if($celebrity->profile_path) + {{ $celebrity->name }} + @else +
+ No Image +
+ @endif +
+ + + + @if($celebrity->homepage) - | TMDB - @endif - @if($celebrity->imdb_id) - | IMDB + + + Homepage + @endif
-
- @if($celebrity->birtday) - Birthday {{ $celebrity->birtday }} @if($celebrity->palce_of_birth) ({{ $celebrity->palce_of_birth }}) @endif - @endif - @if($celebrity->deathday) - Deathday {{ $celebrity->deathday }} - @endif -

- {{ $celebrity->biography }} -

+ + +
+

{{ $celebrity->name }}

+ +
+ @if($celebrity->birtday) +

+ Birthday: {{ $celebrity->birtday }} + @if($celebrity->palce_of_birth) ({{ $celebrity->palce_of_birth }}) @endif +

+ @endif + @if($celebrity->deathday) +

+ Deathday: {{ $celebrity->deathday }} +

+ @endif +
+ +
+
Biography
+

{{ $celebrity->biography }}

+
+ @if($celebrity->also_known_as) -

- Also known as: - @foreach(json_decode($celebrity->also_known_as ?? "{}", true) as $alsoKnown) - {{ $alsoKnown }} - @if(!$loop->last), @endif - @endforeach -

+
+
Also Known As
+

+ @foreach(json_decode($celebrity->also_known_as ?? "{}", true) as $alsoKnown) + {{ $alsoKnown }}@if(!$loop->last), @endif + @endforeach +

+
@endif -