From d458fcf63b0b0723d757c1dd42abc5206df44cde Mon Sep 17 00:00:00 2001 From: TylerCG <117808427+TylerCG@users.noreply.github.com> Date: Mon, 12 May 2025 18:07:41 -0400 Subject: [PATCH] Update main.py --- app/main.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/app/main.py b/app/main.py index 3408527..18a1278 100644 --- a/app/main.py +++ b/app/main.py @@ -102,16 +102,15 @@ async def dropoutSeries(): except: return JSONResponse(content={"error": "File not found"}, status_code=404) -async def get_show_data(show: str): - global cached_data - if cached_data is None: - await dropoutUpdate() - - for item in cached_data: - if show == item["SHOW"] or show == item["LINK"]: - if "SEASONS" not in item: - item['SEASONS'] = download.grab.season(item['URL']) - return item +def get_latest_season(item): + seasons = item.get("SEASONS") + if seasons and isinstance(seasons, list): + try: + numeric_seasons = [int(s) for s in seasons if str(s).isdigit()] + if numeric_seasons: + return max(numeric_seasons) + except Exception as e: + logging.info(f"Error getting latest season: {e}") return None def get_latest_season(item):