test
This commit is contained in:
parent
56fe5bdfcb
commit
347c4fcb57
@ -101,7 +101,7 @@ class dropout():
|
|||||||
with yt_dlp.YoutubeDL(dl_opts) as ydl:
|
with yt_dlp.YoutubeDL(dl_opts) as ydl:
|
||||||
ydl.download([entry['webpage_url']])
|
ydl.download([entry['webpage_url']])
|
||||||
|
|
||||||
def special(show, season, episode_start):
|
def specials(show, season, episode_start):
|
||||||
directory = f'/tv/{show}/Specials/'
|
directory = f'/tv/{show}/Specials/'
|
||||||
if not os.path.exists(directory):
|
if not os.path.exists(directory):
|
||||||
os.makedirs(directory)
|
os.makedirs(directory)
|
||||||
|
|||||||
15
app/main.py
15
app/main.py
@ -15,7 +15,7 @@ loop = asyncio.get_running_loop()
|
|||||||
|
|
||||||
|
|
||||||
# api
|
# api
|
||||||
@app.get("/dropoutUpdate")
|
@app.get("/dropout/update")
|
||||||
async def dropoutUpdate():
|
async def dropoutUpdate():
|
||||||
try:
|
try:
|
||||||
download.dropout.series()
|
download.dropout.series()
|
||||||
@ -23,7 +23,7 @@ async def dropoutUpdate():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
return JSONResponse(status_code=500, content={"status": "error", "message": str(e)})
|
return JSONResponse(status_code=500, content={"status": "error", "message": str(e)})
|
||||||
|
|
||||||
@app.get("/dropoutSeries")
|
@app.get("/dropout/series")
|
||||||
async def dropoutSeries():
|
async def dropoutSeries():
|
||||||
file_path = Path("/data/dropout.json")
|
file_path = Path("/data/dropout.json")
|
||||||
if file_path.exists():
|
if file_path.exists():
|
||||||
@ -32,7 +32,7 @@ async def dropoutSeries():
|
|||||||
return JSONResponse(content=data)
|
return JSONResponse(content=data)
|
||||||
return JSONResponse(content={"error": "File not found"}, status_code=404)
|
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):
|
async def dropoutDownload(show: str, season: str, episode: str = None):
|
||||||
try:
|
try:
|
||||||
await loop.run_in_executor(None, partial(download.dropout.show,show,season,episode))
|
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."})
|
return JSONResponse(status_code=200, content={"status": "success", "message": "Series downloaded."})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return JSONResponse(status_code=500, content={"status": "error", "message": str(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")
|
@app.post("/ydl")
|
||||||
async def ydl(url: str, location: str):
|
async def ydl(url: str, location: str):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user