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