lots of progress
This commit is contained in:
@@ -57,6 +57,7 @@ class FetchUpcomingMoviesCommand extends Command
|
||||
$oldUpcomingIds = UpcomingMovie::all()->pluck('movie_id');
|
||||
|
||||
foreach ($upcomingMovies['results'] as $upcomingMovie) {
|
||||
echo ".";
|
||||
$movie = $this->process($upcomingMovie);
|
||||
|
||||
if ($movie) {
|
||||
@@ -69,11 +70,13 @@ class FetchUpcomingMoviesCommand extends Command
|
||||
if (!empty($newUpcomingIds)) {
|
||||
UpcomingMovie::whereIn('id', $oldUpcomingIds)->delete();
|
||||
UpcomingMovie::insert($newUpcomingIds);
|
||||
echo "+";
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
} catch (\Throwable $e) {
|
||||
DB::rollBack();
|
||||
dump($e);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -86,14 +89,14 @@ class FetchUpcomingMoviesCommand extends Command
|
||||
return $movie;
|
||||
}
|
||||
|
||||
$itemToFetch = ItemToFetch::where('tmdb_id', $upcomingMovie['id'])->where('type', $type)->first();
|
||||
$itemToFetch = ItemToFetch::where('tmdb_id', $upcomingMovie['id'])->where('type', ItemToFetch::TYPE_MOVIE)->first();
|
||||
|
||||
if ($itemToFetch) {
|
||||
$this->movieProcessingService->process($itemToFetch, ItemToFetchJobs::JOB_DETAILS);
|
||||
return Movie::where('tmdb_id', $upcomingMovie['id'])->first();
|
||||
}
|
||||
|
||||
ItemToFetch::create([
|
||||
$itemToFetch = ItemToFetch::create([
|
||||
'tmdb_id' => $upcomingMovie['id'],
|
||||
'type' => ItemToFetch::TYPE_MOVIE,
|
||||
]);
|
||||
@@ -107,6 +110,7 @@ class FetchUpcomingMoviesCommand extends Command
|
||||
'remaining_jobs' => json_encode($jobs),
|
||||
]);
|
||||
|
||||
return null;
|
||||
$this->movieProcessingService->process($itemToFetch, ItemToFetchJobs::JOB_DETAILS);
|
||||
return Movie::where('tmdb_id', $upcomingMovie['id'])->first();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user