diff --git a/assets/controllers/tv_results_controller.js b/assets/controllers/tv_results_controller.js index 4935f20..497795f 100644 --- a/assets/controllers/tv_results_controller.js +++ b/assets/controllers/tv_results_controller.js @@ -18,7 +18,7 @@ export default class extends Controller { active: Boolean, }; - static targets = ['list', 'count', 'episodeSelector', 'toggleButton'] + static targets = ['list', 'count', 'episodeSelector', 'toggleButton', 'listContainer'] static outlets = ['loading-icon'] options = [] @@ -35,7 +35,7 @@ export default class extends Controller { await fetch(`/torrentio/tvshows/${this.tmdbIdValue}/${this.imdbIdValue}/${this.seasonValue}/${this.episodeValue}`) .then(res => res.text()) .then(response => { - this.element.innerHTML = response; + this.listContainerTarget.innerHTML = response; this.options = this.element.querySelectorAll('tbody tr'); if (this.options.length > 0) { this.options.forEach((option) => option.querySelector('.download-btn').dataset['title'] = this.titleValue); diff --git a/src/Tmdb/Tmdb.php b/src/Tmdb/Tmdb.php index 82ecfdf..3783030 100644 --- a/src/Tmdb/Tmdb.php +++ b/src/Tmdb/Tmdb.php @@ -209,7 +209,12 @@ class Tmdb continue; } - $series['episodes'][$season['season_number']] = $client->getApi()->getSeason($series['id'], $season['season_number'])['episodes']; + $series['episodes'][$season['season_number']] = Map::from( + $client->getApi()->getSeason($series['id'], $season['season_number'])['episodes'] + )->map(function ($data) { + $data['poster'] = (null !== $data['still_path']) ? self::POSTER_IMG_PATH . $data['still_path'] : null; + return $data; + })->toArray(); } return $series; } @@ -268,7 +273,7 @@ class Tmdb private function parseEpisode(array $data, string $posterBasePath): TmdbResult { return new TmdbResult( - imdbId: $data['external_ids']['imdb_id'], + imdbId: $data['external_ids']['imdb_id'] ?? $this->getImdbId($data['id'], 'tvshows'), tmdbId: $data['id'], title: $data['name'], poster: (null !== $data['still_path']) ? $posterBasePath . $data['still_path'] : null, diff --git a/templates/components/TvEpisodeList.html.twig b/templates/components/TvEpisodeList.html.twig index aff2b10..b968dbf 100644 --- a/templates/components/TvEpisodeList.html.twig +++ b/templates/components/TvEpisodeList.html.twig @@ -13,7 +13,65 @@ season: episode['season_number'], episode: episode['episode_number'], active: 'true', - }) }}> + }) }} + > +
{{ episode['overview'] }}
+{{ results.media.description }}
-Existing file(s) for this episode:
-