From fbca120e1570bebd39598285ac4ea8c68aa1203d Mon Sep 17 00:00:00 2001 From: TylerCG <117808427+TylerCG@users.noreply.github.com> Date: Mon, 12 May 2025 18:10:08 -0400 Subject: [PATCH] Update main.py --- app/main.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/app/main.py b/app/main.py index 18a1278..7ba0098 100644 --- a/app/main.py +++ b/app/main.py @@ -102,6 +102,18 @@ 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 + return None + def get_latest_season(item): seasons = item.get("SEASONS") if seasons and isinstance(seasons, list): @@ -110,18 +122,7 @@ def get_latest_season(item): 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): - if item and item.get("SEASONS"): - try: - seasons = item["SEASONS"].keys() - numeric_seasons = [int(s) for s in seasons if str(s).isdigit()] - if numeric_seasons: - return max(numeric_seasons) - except Exception as e: - logger.info(f"Error getting latest season: {e}") + logging.error(f"Error getting latest season: {e}") return None @app.post("/dropout/download", description="Download an entire season from episode 1. Ignores behind the scenes and trailers.")