Update main.py
This commit is contained in:
parent
d458fcf63b
commit
fbca120e15
25
app/main.py
25
app/main.py
@ -102,6 +102,18 @@ 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):
|
||||||
|
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):
|
def get_latest_season(item):
|
||||||
seasons = item.get("SEASONS")
|
seasons = item.get("SEASONS")
|
||||||
if seasons and isinstance(seasons, list):
|
if seasons and isinstance(seasons, list):
|
||||||
@ -110,18 +122,7 @@ def get_latest_season(item):
|
|||||||
if numeric_seasons:
|
if numeric_seasons:
|
||||||
return max(numeric_seasons)
|
return max(numeric_seasons)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.info(f"Error getting latest season: {e}")
|
logging.error(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}")
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@app.post("/dropout/download", description="Download an entire season from episode 1. Ignores behind the scenes and trailers.")
|
@app.post("/dropout/download", description="Download an entire season from episode 1. Ignores behind the scenes and trailers.")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user