[#8] fixed lots of issues on movie processing

This commit is contained in:
2025-01-04 02:13:07 +02:00
parent 70b6a7325a
commit 34d31fa2c8
6 changed files with 34 additions and 34 deletions
@@ -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'],
@@ -15,10 +15,10 @@ return new class extends Migration
$table->id();
$table->bigInteger('movie_id')->nullable(false);
$table->bigInteger('person_id')->nullable(false);
$table->string('known_for_department', 500);
$table->string('character', 500);
$table->string('known_for_department', 500)->nullable();
$table->string('character', 500)->nullable();
$table->string('tmdb_cast_id', 500);
$table->integer('order');
$table->integer('order')->nullable();
$table->timestamps();
});
}
@@ -15,7 +15,7 @@ return new class extends Migration
$table->id();
$table->decimal('aspect_ratio', 10, 2);
$table->integer('height');
$table->string('iso');
$table->string('iso')->nullable();
$table->text('file_path');
$table->decimal('vote_average', 10, 2);
$table->integer('vote_count');
@@ -15,11 +15,11 @@ return new class extends Migration
$table->id();
$table->string('iso_3166');
$table->string('certification');
$table->text('descriptors');
$table->string('iso_639');
$table->text('note');
$table->text('descriptors')->nullable();
$table->string('iso_639')->nullable();
$table->text('note')->nullable();
$table->date('release_date');
$table->integer('type');
$table->integer('type')->nullable();
$table->timestamps();
});
}
@@ -17,8 +17,8 @@ return new class extends Migration
$table->string('entity_type');
$table->integer('user_id')->nullable(true);
$table->string('author_name');
$table->string('author_avatar');
$table->integer('author_rating');
$table->string('author_avatar')->nullable();
$table->integer('author_rating')->nullable();
$table->text('content');
$table->datetime('published_at');
$table->string('tmdb_id');
@@ -21,7 +21,7 @@ return new class extends Migration
$table->string('iso_3166_1', 2);
$table->string('list_type', 15);
$table->string('name', 550);
$table->string('poster_path', 550);
$table->string('poster_path', 550)->nullable();
$table->timestamps();
});
}