Compare commits
1 Commits
v0.33.0
...
dev-tmdb-c
| Author | SHA1 | Date | |
|---|---|---|---|
| e9edd6a35a |
@@ -16,10 +16,10 @@ class TmdbTvEpisodeResultDenormalizer implements DenormalizerInterface
|
|||||||
private readonly NormalizerInterface $normalizer,
|
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 */
|
/** @var TmdbEpisodeDto $result */
|
||||||
$result = $this->normalizer->denormalize($data, TmdbResult::class, $format, $context);
|
$result = $this->normalizer->denormalize($data, TmdbEpisodeDto::class, $format, $context);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class TmdbTvShowResultDenormalizer extends TmdbResultDenormalizer implements Den
|
|||||||
array $context = []
|
array $context = []
|
||||||
): bool {
|
): bool {
|
||||||
return array_key_exists('media_type', $context) &&
|
return array_key_exists('media_type', $context) &&
|
||||||
$context['media_type'] === "tvshows";
|
$context['media_type'] === MediaType::TvShow->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSupportedTypes(?string $format): array
|
public function getSupportedTypes(?string $format): array
|
||||||
|
|||||||
@@ -143,13 +143,13 @@ class TmdbClient
|
|||||||
{
|
{
|
||||||
$tmdbId = $this->findByImdbId($imdbId)['id'];
|
$tmdbId = $this->findByImdbId($imdbId)['id'];
|
||||||
$media = $this->tvRepository->getApi()->getTvShow($tmdbId, ['append_to_response' => 'external_ids,credits']);
|
$media = $this->tvRepository->getApi()->getTvShow($tmdbId, ['append_to_response' => 'external_ids,credits']);
|
||||||
|
|
||||||
$media['seasons'] = Map::from($media['seasons'])->filter(function ($data) {
|
$media['seasons'] = Map::from($media['seasons'])->filter(function ($data) {
|
||||||
return $data['season_number'] !== 0 &&
|
return $data['season_number'] !== 0 &&
|
||||||
strtolower($data['name']) !== 'specials';
|
strtolower($data['name']) !== 'specials' &&
|
||||||
|
$data['episode_count'] > 0;
|
||||||
})->map(function ($data) use ($media) {
|
})->map(function ($data) use ($media) {
|
||||||
return $this->tvSeasonDetails($media['id'], $data['season_number'])['episodes'];
|
return $this->tvSeasonDetails($media['id'], $data['season_number'])['episodes'];
|
||||||
})->rekey(function ($data) {
|
|
||||||
return $data[1]['season_number'];
|
|
||||||
})->toArray();
|
})->toArray();
|
||||||
|
|
||||||
return $this->parseResult(
|
return $this->parseResult(
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<div class="w-full flex flex-col">
|
<div class="w-full flex flex-col">
|
||||||
<div class="mb-4 flex flex-row gap-2 justify-between">
|
<div class="mb-4 flex flex-row gap-2 justify-between">
|
||||||
<h3 class="text-xl font-medium leading-tight font-bold text-gray-50">
|
<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>
|
</h3>
|
||||||
|
|
||||||
{% if results.media.mediaType == "tvshows" %}
|
{% if results.media.mediaType == "tvshows" %}
|
||||||
@@ -109,7 +109,7 @@
|
|||||||
</twig:Turbo:Frame>
|
</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 }}">
|
<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>
|
||||||
|
|
||||||
<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.">
|
<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