fix: incorrect air date on movies, severance returning 500 from 0 episodes in new season

This commit is contained in:
2025-09-09 11:13:42 -05:00
parent d63d477ed1
commit e9edd6a35a
4 changed files with 8 additions and 8 deletions

View File

@@ -16,10 +16,10 @@ class TmdbTvEpisodeResultDenormalizer implements DenormalizerInterface
private readonly NormalizerInterface $normalizer,
) {}
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): TmdbResult|array|null
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): TmdbResult|TmdbEpisodeDto|array|null
{
/** @var TmdbEpisodeDto $result */
$result = $this->normalizer->denormalize($data, TmdbResult::class, $format, $context);
$result = $this->normalizer->denormalize($data, TmdbEpisodeDto::class, $format, $context);
return $result;
}

View File

@@ -48,7 +48,7 @@ class TmdbTvShowResultDenormalizer extends TmdbResultDenormalizer implements Den
array $context = []
): bool {
return array_key_exists('media_type', $context) &&
$context['media_type'] === "tvshows";
$context['media_type'] === MediaType::TvShow->value;
}
public function getSupportedTypes(?string $format): array

View File

@@ -143,13 +143,13 @@ class TmdbClient
{
$tmdbId = $this->findByImdbId($imdbId)['id'];
$media = $this->tvRepository->getApi()->getTvShow($tmdbId, ['append_to_response' => 'external_ids,credits']);
$media['seasons'] = Map::from($media['seasons'])->filter(function ($data) {
return $data['season_number'] !== 0 &&
strtolower($data['name']) !== 'specials';
strtolower($data['name']) !== 'specials' &&
$data['episode_count'] > 0;
})->map(function ($data) use ($media) {
return $this->tvSeasonDetails($media['id'], $data['season_number'])['episodes'];
})->rekey(function ($data) {
return $data[1]['season_number'];
})->toArray();
return $this->parseResult(