Merge branch 'dev-tmdb-cleanup'
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<div class="w-full flex flex-col">
|
||||
<div class="mb-4 flex flex-row gap-2 justify-between">
|
||||
<h3 class="text-xl font-medium leading-tight font-bold text-gray-50">
|
||||
{{ results.media.title }} ({{ results.media.episodeAirDate|date('Y') }})
|
||||
{{ results.media.title }} ({{ results.media.year }})
|
||||
</h3>
|
||||
|
||||
{% if results.media.mediaType == "tvshows" %}
|
||||
@@ -109,7 +109,7 @@
|
||||
</twig:Turbo:Frame>
|
||||
|
||||
<span class="py-1 px-1.5 mr-1 grow-0 font-bold bg-sky-700 rounded-lg text-white" title="Release date {{ results.media.episodeAirDate }}">
|
||||
{{ results.media.episodeAirDate|date('n/j/Y', 'UTC') }}
|
||||
{{ results.media.premiereDate|date('n/j/Y', 'UTC') }}
|
||||
</span>
|
||||
|
||||
<span class="py-1 px-1.5 mr-1 grow-0 font-bold bg-orange-500 rounded-lg text-white" title="This movie has a runtime of {{ results.media.runtime }} minutes.">
|
||||
|
||||
Reference in New Issue
Block a user