From 347c4fcb57838dad561a893f0ee5d46efbeb61e8 Mon Sep 17 00:00:00 2001 From: TylerCG <117808427+TylerCG@users.noreply.github.com> Date: Fri, 25 Apr 2025 23:39:03 -0400 Subject: [PATCH] test --- app/download.py | 2 +- app/main.py | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/download.py b/app/download.py index 3199499..7786c81 100644 --- a/app/download.py +++ b/app/download.py @@ -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) diff --git a/app/main.py b/app/main.py index 0541944..3c2e33e 100644 --- a/app/main.py +++ b/app/main.py @@ -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):