From 987ca1977bb3ab40b5a56f8c483a7403e49548b1 Mon Sep 17 00:00:00 2001 From: sbcrumb Date: Wed, 15 Oct 2025 16:55:02 -0400 Subject: [PATCH] fix: update for UI and dates --- VERSION | 2 +- api/web_routes.py | 28 +++++++++++++++++++++------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/VERSION b/VERSION index 0b6e431..98c938e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.11 +2.2.12 diff --git a/api/web_routes.py b/api/web_routes.py index 3c8e659..71f1cb2 100644 --- a/api/web_routes.py +++ b/api/web_routes.py @@ -772,6 +772,7 @@ async def get_movie_date_options(dependencies: dict, imdb_id: str): async def get_episode_date_options(dependencies: dict, imdb_id: str, season: int, episode: int): """Get available date options for an episode""" print(f"🔍 DEBUG: get_episode_date_options called with imdb_id={imdb_id}, season={season}, episode={episode}") + print(f"🔍 DEBUG: episode type: {type(episode)}, episode value: {episode}") db = dependencies["db"] # Validate parameters with enhanced checking @@ -980,9 +981,10 @@ async def get_episode_date_options(dependencies: dict, imdb_id: str, season: int episodes = external_clients.tmdb.get_tv_season_episodes(tmdb_id, season) print(f"🔍 DEBUG: TMDB episodes found: {episodes}") - if int(episode) in episodes: - air_date = episodes[int(episode)] - print(f"🔍 DEBUG: TMDB air date for S{season:02d}E{episode:02d}: {air_date}") + episode_num = int(episode) + if episode_num in episodes: + air_date = episodes[episode_num] + print(f"🔍 DEBUG: TMDB air date for S{season:02d}E{episode_num:02d}: {air_date}") if air_date: # Check if this is different from current aired date @@ -1008,11 +1010,15 @@ async def get_episode_date_options(dependencies: dict, imdb_id: str, season: int }) print(f"✅ Added 'Use Air Date' option from TMDB: {air_date}") else: - print(f"❌ Episode {int(episode)} not found in TMDB season {season} data") + print(f"❌ Episode {episode_num} not found in TMDB season {season} data") else: print(f"❌ No TV series ID found in TMDB for {imdb_id}") except Exception as e: - print(f"⚠️ Failed to get TMDB air date for {imdb_id} S{season:02d}E{episode:02d}: {e}") + try: + episode_num = int(episode) if not isinstance(episode, int) else episode + print(f"⚠️ Failed to get TMDB air date for {imdb_id} S{season:02d}E{episode_num:02d}: {e}") + except: + print(f"⚠️ Failed to get TMDB air date for {imdb_id}: {e}") import traceback print(f" Traceback: {traceback.format_exc()}") @@ -1042,10 +1048,18 @@ async def get_episode_date_options(dependencies: dict, imdb_id: str, season: int "description": f"Use air date from external sources: {air_date}" }) except Exception as e: - print(f"⚠️ Failed to get external air date for {imdb_id} S{season:02d}E{episode:02d}: {e}") + try: + episode_num = int(episode) if not isinstance(episode, int) else episode + print(f"⚠️ Failed to get external air date for {imdb_id} S{season:02d}E{episode_num:02d}: {e}") + except: + print(f"⚠️ Failed to get external air date for {imdb_id}: {e}") except Exception as e: - print(f"⚠️ External source lookup failed for {imdb_id} S{season:02d}E{episode:02d}: {e}") + try: + episode_num = int(episode) if not isinstance(episode, int) else episode + print(f"⚠️ External source lookup failed for {imdb_id} S{season:02d}E{episode_num:02d}: {e}") + except: + print(f"⚠️ External source lookup failed for {imdb_id}: {e}") # Option 4: Manual entry options.append({