This commit is contained in:
TylerCG 2025-04-25 23:39:03 -04:00
parent 56fe5bdfcb
commit 347c4fcb57
2 changed files with 13 additions and 4 deletions

View File

@ -101,7 +101,7 @@ class dropout():
with yt_dlp.YoutubeDL(dl_opts) as ydl:
ydl.download([entry['webpage_url']])
def special(show, season, episode_start):
def specials(show, season, episode_start):
directory = f'/tv/{show}/Specials/'
if not os.path.exists(directory):
os.makedirs(directory)

View File

@ -15,7 +15,7 @@ loop = asyncio.get_running_loop()
# api
@app.get("/dropoutUpdate")
@app.get("/dropout/update")
async def dropoutUpdate():
try:
download.dropout.series()
@ -23,7 +23,7 @@ async def dropoutUpdate():
except Exception as e:
return JSONResponse(status_code=500, content={"status": "error", "message": str(e)})
@app.get("/dropoutSeries")
@app.get("/dropout/series")
async def dropoutSeries():
file_path = Path("/data/dropout.json")
if file_path.exists():
@ -32,7 +32,7 @@ async def dropoutSeries():
return JSONResponse(content=data)
return JSONResponse(content={"error": "File not found"}, status_code=404)
@app.post("/dropoutDownload")
@app.post("/dropout/download")
async def dropoutDownload(show: str, season: str, episode: str = None):
try:
await loop.run_in_executor(None, partial(download.dropout.show,show,season,episode))
@ -40,6 +40,15 @@ async def dropoutDownload(show: str, season: str, episode: str = None):
return JSONResponse(status_code=200, content={"status": "success", "message": "Series downloaded."})
except Exception as e:
return JSONResponse(status_code=500, content={"status": "error", "message": str(e)})
@app.post("/dropout/download/specials")
async def dropoutDownload(show: str, season: str, episode: str = None):
try:
await loop.run_in_executor(None, partial(download.dropout.specials,show,season,episode))
# download.dropout.show(show,season,episode)
return JSONResponse(status_code=200, content={"status": "success", "message": "Series downloaded."})
except Exception as e:
return JSONResponse(status_code=500, content={"status": "error", "message": str(e)})
@app.post("/ydl")
async def ydl(url: str, location: str):