[#8] fixed lots of issues on movie processing
This commit is contained in:
@@ -66,7 +66,8 @@ class MovieProcessingService implements ProcessingInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$tmdbMovie['slug'] = Str::slug($tmdbMovie['title']);
|
||||
$tmdbMovie['slug'] = Str::slug($tmdbMovie['title'].'-'.$tmdbMovie['tmdb_id']);
|
||||
$tmdbMovie['release_date'] = $tmdbMovie['release_date'] ? new \DateTime($tmdbMovie['release_date']) : null;
|
||||
|
||||
$movieId = Movie::create($tmdbMovie);
|
||||
|
||||
@@ -292,7 +293,7 @@ class MovieProcessingService implements ProcessingInterface
|
||||
'author_avatar' => $tmdbReview['author_details']['avatar_path'],
|
||||
'author_rating' => $tmdbReview['author_details']['rating'],
|
||||
'content' => $tmdbReview['content'],
|
||||
'published_at' => $tmdbReview['created_at'],
|
||||
'published_at' => $tmdbReview['created_at'] ? new \DateTime($tmdbReview['created_at']) : null,
|
||||
'tmdb_id' => $tmdbReview['id'],
|
||||
'tmdb_url' => $tmdbReview['url'],
|
||||
]);
|
||||
@@ -475,7 +476,7 @@ class MovieProcessingService implements ProcessingInterface
|
||||
$user->mediaLists()->attach($list);
|
||||
}
|
||||
|
||||
foreach ($tmdbList['items'] as $tmdbListItem) {
|
||||
foreach ($listDetails['items'] as $tmdbListItem) {
|
||||
$mediaListItem = MediaListItem::where('media_list_id', $list->id)
|
||||
->where('tmdb_id', $tmdbListItem['id'])
|
||||
->first();
|
||||
@@ -548,30 +549,29 @@ class MovieProcessingService implements ProcessingInterface
|
||||
}
|
||||
|
||||
continue;
|
||||
} else {
|
||||
$itemToFetch = ItemToFetch::create([
|
||||
'tmdb_id' => $tmdbRecommendation['id'],
|
||||
'type' => ItemToFetch::TYPE_MOVIE,
|
||||
]);
|
||||
|
||||
$jobs = ItemToFetchJobs::JOBS;
|
||||
$jobs[] = "Details";
|
||||
|
||||
ItemToFetchJobs::create([
|
||||
'tmdb_id' => $tmdbRecommendation['id'],
|
||||
'type' => ItemToFetch::TYPE_MOVIE,
|
||||
'remaining_jobs' => json_encode($jobs),
|
||||
]);
|
||||
|
||||
$this->getDetails($itemToFetch);
|
||||
}
|
||||
|
||||
|
||||
$itemToFetch = ItemToFetch::create([
|
||||
'tmdb_id' => $tmdbRecommendation['id'],
|
||||
'type' => ItemToFetch::TYPE_MOVIE,
|
||||
]);
|
||||
|
||||
$jobs = ItemToFetchJobs::JOBS;
|
||||
$jobs[] = "Details";
|
||||
|
||||
ItemToFetchJobs::create([
|
||||
'tmdb_id' => $tmdbRecommendation['id'],
|
||||
'type' => ItemToFetch::TYPE_MOVIE,
|
||||
'remaining_jobs' => json_encode($jobs),
|
||||
]);
|
||||
|
||||
$this->getDetails($itemToFetch);
|
||||
|
||||
$movie = Movie::where('tmdb_id', $item->tmdb_id)->first();
|
||||
// $movie = Movie::where('tmdb_id', $item->tmdb_id)->first();
|
||||
$recommendedMovie = Movie::where('tmdb_id', $tmdbRecommendation['id'])->first();
|
||||
|
||||
MovieRecommendation::create([
|
||||
'movie_id' => $movie->id,
|
||||
'movie_id' => $initialMovie->id,
|
||||
'recommended_movie_id' => $recommendedMovie->id,
|
||||
]);
|
||||
}
|
||||
@@ -815,7 +815,7 @@ class MovieProcessingService implements ProcessingInterface
|
||||
})->exists()) {
|
||||
return;
|
||||
} else {
|
||||
$movie->castList()->attach($person, [
|
||||
$movie->crewList()->attach($person, [
|
||||
'known_for_department' => json_encode($crewPerson['known_for_department']),
|
||||
'job' => $crewPerson['job'],
|
||||
'department' => $crewPerson['department'],
|
||||
|
||||
Reference in New Issue
Block a user