diff --git a/bin/ffx.py b/bin/ffx.py index ea5ff58..7a903dd 100755 --- a/bin/ffx.py +++ b/bin/ffx.py @@ -329,13 +329,13 @@ def convert(ctx, if context['tmdb']: - tmdbResult = tc.queryTmdb(currentShowDescriptor.getId(), mediaFileProperties.getSeason(), mediaFileProperties.getEpisode()) + tmdbEpisodeResult = tc.queryEpisode(currentShowDescriptor.getId(), mediaFileProperties.getSeason(), mediaFileProperties.getEpisode()) - # click.echo(f"{tmdbResult}") + # click.echo(f"{tmdbEpisodeResult}") - if tmdbResult: + if tmdbEpisodeResult: fileBasename = tc.getEpisodeFileBasename(currentShowDescriptor.getFilenamePrefix(), - tmdbResult['name'], + tmdbEpisodeResult['name'], mediaFileProperties.getSeason(), mediaFileProperties.getEpisode(), currentShowDescriptor.getIndexSeasonDigits(), diff --git a/bin/ffx/show_details_screen.py b/bin/ffx/show_details_screen.py index 90695be..d55f1c3 100644 --- a/bin/ffx/show_details_screen.py +++ b/bin/ffx/show_details_screen.py @@ -228,7 +228,9 @@ class ShowDetailsScreen(Screen): with Grid(): # 1 - yield Static("Show" if not self.__showDescriptor is None else "New Show", id="toplabel", classes="five") + yield Static("Show" if not self.__showDescriptor is None else "New Show", id="toplabel") + yield Button("Identify", id="identify_button") + yield Static(" ", classes="three") # 2 yield Static("ID") diff --git a/bin/ffx/tmdb_controller.py b/bin/ffx/tmdb_controller.py index f547672..493c227 100644 --- a/bin/ffx/tmdb_controller.py +++ b/bin/ffx/tmdb_controller.py @@ -14,8 +14,54 @@ class TmdbController(): self.tmdbLanguage = TmdbController.DEFAULT_LANGUAGE + def queryShow(self, showId): + """ + First level keys in the response object: + adult bool + backdrop_path str + created_by [] + episode_run_time [] + first_air_date str YYYY-MM-DD + genres [] + homepage str + id int + in_production bool + languages [] + last_air_date str YYYY-MM-DD + last_episode_to_air {} + name str + next_episode_to_air null + networks [] + number_of_episodes int + number_of_seasons int + origin_country [] + original_language str + original_name str + overview str + popularity float + poster_path str + production_companies [] + production_countries [] + seasons [] + spoken_languages [] + status str + tagline str + type str + vote_average float + vote_count int + """ + + urlParams = f"?language={self.tmdbLanguage}&api_key={self.__tmdbApiKey}" + + tmdbUrl = f"https://api.themoviedb.org/3/tv/{showId}W{urlParams}" + + #TODO Check for result + try: + return requests.get(tmdbUrl).json() + except: + return {} - def queryTmdb(self, showId, season, episode): + def queryEpisode(self, showId, season, episode): """ First level keys in the response object: air_date str 'YYY-MM-DD'