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', - }) }}> + }) }} + > +
+
+ {% if episode['poster'] != null %} + + {% else %} +
+ +
+ {% endif %} +
+

+ {{ episode['episode_number'] }}. {{ episode['name'] }} +

+

{{ episode['overview'] }}

+
+ + + + + + {{ episode['air_date'] }} + + Clear Cache +
+
+
+
+ +
+ +
+
+
+ +
+
+ {% endfor %} {% set paginator = this.episodes %} diff --git a/templates/search/result.html.twig b/templates/search/result.html.twig index e6bdb98..a38edec 100644 --- a/templates/search/result.html.twig +++ b/templates/search/result.html.twig @@ -119,6 +119,7 @@ {% elseif "tvshows" == results.media.mediaType %} diff --git a/templates/torrentio/tvshows.html.twig b/templates/torrentio/tvshows.html.twig index ae51f1f..af3d50d 100644 --- a/templates/torrentio/tvshows.html.twig +++ b/templates/torrentio/tvshows.html.twig @@ -1,82 +1 @@ -
-
- {% if results.media.poster != null %} - - {% else %} -
- -
- {% endif %} -
-

- {{ results.episode }}. {{ results.media.title }} -

-

{{ results.media.description }}

-
- - - {% if results.file != false %} - - - - exists - - - {% endif %} - - {% if results.file == false %} - - missing - - {% endif %} - - - {{ results.media.episodeAirDate }} - -{# Clear Cache#} -
-
-
-
- -
- -
-
-
- {{ include('torrentio/partial/option-table.html.twig', {controller: 'tv-results'}) }} -
-
+{{ include('torrentio/partial/option-table.html.twig', {controller: 'tv-results'}) }}