some progress
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user