Update main.py

This commit is contained in:
TylerCG 2025-05-12 18:07:41 -04:00
parent 4e59f628e3
commit d458fcf63b

View File

@ -102,16 +102,15 @@ async def dropoutSeries():
except: except:
return JSONResponse(content={"error": "File not found"}, status_code=404) return JSONResponse(content={"error": "File not found"}, status_code=404)
async def get_show_data(show: str): def get_latest_season(item):
global cached_data seasons = item.get("SEASONS")
if cached_data is None: if seasons and isinstance(seasons, list):
await dropoutUpdate() try:
numeric_seasons = [int(s) for s in seasons if str(s).isdigit()]
for item in cached_data: if numeric_seasons:
if show == item["SHOW"] or show == item["LINK"]: return max(numeric_seasons)
if "SEASONS" not in item: except Exception as e:
item['SEASONS'] = download.grab.season(item['URL']) logging.info(f"Error getting latest season: {e}")
return item
return None return None
def get_latest_season(item): def get_latest_season(item):