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):