diff --git a/Dockerfile b/Dockerfile index 549fc83..3f1c8a9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,4 +19,4 @@ COPY . . EXPOSE 8000 # Run the app with Uvicorn -CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] +CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] diff --git a/app/__pycache__/download.cpython-313.pyc b/app/__pycache__/download.cpython-313.pyc deleted file mode 100644 index bd6a6c8..0000000 Binary files a/app/__pycache__/download.cpython-313.pyc and /dev/null differ diff --git a/app/__pycache__/main.cpython-313.pyc b/app/__pycache__/main.cpython-313.pyc deleted file mode 100644 index 27149bd..0000000 Binary files a/app/__pycache__/main.cpython-313.pyc and /dev/null differ diff --git a/app/data/dropout.json b/app/data/dropout.json deleted file mode 100644 index b10088c..0000000 --- a/app/data/dropout.json +++ /dev/null @@ -1,531 +0,0 @@ -[ - { - "SHOW": "Adventuring Academy", - "URL": "https://www.dropout.tv/adventuring-academy", - "SEASONS": [ - "1", - "2", - "3", - "4", - "5" - ] - }, - { - "SHOW": "Bad Internet", - "URL": "https://www.dropout.tv/bad-internet", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Breaking News No Laugh Newsroom", - "URL": "https://www.dropout.tv/breaking-news-no-laugh-newsroom", - "SEASONS": [ - "1", - "2", - "3", - "4", - "5", - "6", - "7" - ] - }, - { - "SHOW": "Cartoon Hell", - "URL": "https://www.dropout.tv/cartoon-hell", - "SEASONS": [ - "1", - "2" - ] - }, - { - "SHOW": "Dimension 20", - "URL": "https://www.dropout.tv/dimension-20", - "SEASONS": [ - "1", - "2", - "3", - "4", - "5", - "6", - "7", - "8", - "9", - "10", - "11", - "12", - "13", - "14", - "15", - "16", - "17", - "18", - "19", - "20", - "21", - "22", - "23", - "24", - "25" - ] - }, - { - "SHOW": "Dimension 20 A Court of Fey Flowers", - "URL": "https://www.dropout.tv/dimension-20-a-court-of-fey-flowers", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Dimension 20 A Crown of Candy", - "URL": "https://www.dropout.tv/dimension-20-a-crown-of-candy", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Dimension 20 A Starstruck Odyssey", - "URL": "https://www.dropout.tv/dimension-20-a-starstruck-odyssey", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Dimension 20 Animated", - "URL": "https://www.dropout.tv/dimension-20-animated", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Dimension 20 Audio Only", - "URL": "https://www.dropout.tv/dimension-20-audio-only", - "SEASONS": [ - "1", - "2", - "3", - "4", - "5", - "6", - "7", - "8", - "9", - "10", - "11", - "12", - "13", - "14", - "15", - "16", - "17", - "18", - "19", - "20", - "21", - "22", - "23", - "24", - "25" - ] - }, - { - "SHOW": "Dimension 20 Burrow's End", - "URL": "https://www.dropout.tv/dimension-20-burrow-s-end", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Dimension 20 Coffin Run", - "URL": "https://www.dropout.tv/dimension-20-coffin-run", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Dimension 20 Dungeons And Drag Queens", - "URL": "https://www.dropout.tv/dimension-20-dungeons-and-drag-queens", - "SEASONS": [ - "1", - "2" - ] - }, - { - "SHOW": "Dimension 20 Escape From The Bloodkeep", - "URL": "https://www.dropout.tv/dimension-20-escape-from-the-bloodkeep", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Dimension 20 Fantasy High", - "URL": "https://www.dropout.tv/dimension-20-fantasy-high", - "SEASONS": [ - "1", - "2", - "3" - ] - }, - { - "SHOW": "Dimension 20 Fantasy High Junior Year", - "URL": "https://www.dropout.tv/dimension-20-fantasy-high-junior-year", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Dimension 20 Leviathan", - "URL": "https://www.dropout.tv/dimension-20-leviathan", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Dimension 20 Mentopolis", - "URL": "https://www.dropout.tv/dimension-20-mentopolis", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Dimension 20 Misfits And Magic", - "URL": "https://www.dropout.tv/dimension-20-misfits-and-magic", - "SEASONS": [ - "1", - "2", - "3" - ] - }, - { - "SHOW": "Dimension 20 Never Stop Blowing Up", - "URL": "https://www.dropout.tv/dimension-20-never-stop-blowing-up", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Dimension 20 Neverafter", - "URL": "https://www.dropout.tv/dimension-20-neverafter", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Dimension 20 Shriek Week", - "URL": "https://www.dropout.tv/dimension-20-shriek-week", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Dimension 20 The Ravening War", - "URL": "https://www.dropout.tv/dimension-20-the-ravening-war", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Dimension 20 The Seven", - "URL": "https://www.dropout.tv/dimension-20-the-seven", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Dimension 20 The Unsleeping City", - "URL": "https://www.dropout.tv/dimension-20-the-unsleeping-city", - "SEASONS": [ - "1", - "2" - ] - }, - { - "SHOW": "Dimension 20 Time Quangle", - "URL": "https://www.dropout.tv/dimension-20-time-quangle", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Dimension 20 Tiny Heist", - "URL": "https://www.dropout.tv/dimension-20-tiny-heist", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Dimension 20 Titan Takedown", - "URL": "https://www.dropout.tv/dimension-20-titan-takedown", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Dimension 20's Adventuring Party", - "URL": "https://www.dropout.tv/dimension-20-s-adventuring-party", - "SEASONS": [ - "1", - "2", - "3", - "4", - "5", - "6", - "7", - "8", - "9", - "10", - "11", - "12", - "13", - "14", - "15", - "16", - "17", - "18", - "19", - "20" - ] - }, - { - "SHOW": "Dirty Laundry", - "URL": "https://www.dropout.tv/dirty-laundry", - "SEASONS": [ - "1", - "2", - "3", - "4", - "69" - ] - }, - { - "SHOW": "Dropout Music", - "URL": "https://www.dropout.tv/dropout-music", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Erotic Clubhouse", - "URL": "https://www.dropout.tv/erotic-clubhouse", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Fantasy High Extra Credit", - "URL": "https://www.dropout.tv/fantasy-high-extra-credit", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Game Changer", - "URL": "https://www.dropout.tv/game-changer", - "SEASONS": [ - "1", - "2", - "3", - "4", - "5", - "6", - "7" - ] - }, - { - "SHOW": "Game Changer Animated", - "URL": "https://www.dropout.tv/game-changer-animated", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Game Changer Battle Royale", - "URL": "https://www.dropout.tv/game-changer-battle-royale", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Gastronauts", - "URL": "https://www.dropout.tv/gastronauts", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Gods of Food", - "URL": "https://www.dropout.tv/gods-of-food", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Kingpin Katie", - "URL": "https://www.dropout.tv/kingpin-katie", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Kingpin Katie The Web Series", - "URL": "https://www.dropout.tv/kingpin-katie-the-web-series", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Make Some Noise", - "URL": "https://www.dropout.tv/make-some-noise", - "SEASONS": [ - "1", - "2", - "3" - ] - }, - { - "SHOW": "Mice Murder", - "URL": "https://www.dropout.tv/mice-murder", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Monet's Slumber Party", - "URL": "https://www.dropout.tv/monet-s-slumber-party", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Nobody Asked", - "URL": "https://www.dropout.tv/nobody-asked", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Paranoia", - "URL": "https://www.dropout.tv/paranoia", - "SEASONS": [ - "1", - "2" - ] - }, - { - "SHOW": "Parlor Room", - "URL": "https://www.dropout.tv/parlor-room", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Play It By Ear", - "URL": "https://www.dropout.tv/play-it-by-ear", - "SEASONS": [ - "1", - "2" - ] - }, - { - "SHOW": "See Plum Run", - "URL": "https://www.dropout.tv/see-plum-run", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Smartypants", - "URL": "https://www.dropout.tv/smartypants", - "SEASONS": [ - "1", - "2" - ] - }, - { - "SHOW": "Thousandaires", - "URL": "https://www.dropout.tv/thousandaires", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Total Forgiveness", - "URL": "https://www.dropout.tv/total-forgiveness", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Total Forgiveness Early Payoff", - "URL": "https://www.dropout.tv/total-forgiveness-early-payoff", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Troopers 1", - "URL": "https://www.dropout.tv/troopers-1", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Troopers Animated", - "URL": "https://www.dropout.tv/troopers-animated", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Ultramechatron Team Go 1", - "URL": "https://www.dropout.tv/ultramechatron-team-go-1", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Um Actually", - "URL": "https://www.dropout.tv/um-actually", - "SEASONS": [ - "1", - "2", - "3", - "4", - "5", - "6", - "7", - "8", - "9", - "10" - ] - }, - { - "SHOW": "Very Important People", - "URL": "https://www.dropout.tv/very-important-people", - "SEASONS": [ - "1", - "2" - ] - }, - { - "SHOW": "What The Facts 101", - "URL": "https://www.dropout.tv/what-the-facts-101", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Where In The Eff Is Sarah Cincinnati", - "URL": "https://www.dropout.tv/where-in-the-eff-is-sarah-cincinnati", - "SEASONS": [ - "1" - ] - }, - { - "SHOW": "Wtf 101", - "URL": "https://www.dropout.tv/wtf-101", - "SEASONS": [ - "1" - ] - } -] \ No newline at end of file diff --git a/app/download.py b/app/download.py index 1787ce0..6ddbdd2 100644 --- a/app/download.py +++ b/app/download.py @@ -13,8 +13,8 @@ class grab(): class dropout(): def show(show,season,episode): - directory='/mnt/plex/tv/'+show+'/Season '+season+'/' - with open('data/dropout.json', 'r') as json_file: + directory='/tv/'+show+'/Season '+season+'/' + with open('/data/dropout.json', 'r') as json_file: url_mapping = json.load(json_file) url = next((item['URL'] for item in url_mapping if item['SHOW'] == show), None) if url is not None: @@ -35,7 +35,7 @@ class dropout(): 'format': 'bestvideo+bestaudio/best', 'audio_quality': '256K', 'paths': { - 'temp': '/mnt/data/downloader/temp', + 'temp': '/temp', 'home': directory }, 'cookiefile': 'cookies.txt', @@ -75,13 +75,12 @@ class dropout(): # Sort the json_data by the 'SHOW' key sorted_json_data = sorted(json_data, key=lambda x: x['SHOW']) - with open('data/dropout.json', 'w') as json_file: + with open('/data/dropout.json', 'w') as json_file: json.dump(sorted_json_data, json_file, indent=4) - return sorted_json_data def ydl(url, location): - dl_ops = {'paths': {'temp': '/mnt/data/downloader/temp', 'home': location}, 'outtmpl': '%(uploader)s/%(title)s.%(ext)s'} - if location == "/mnt/plex/podcasts": + dl_ops = {'paths': {'temp': '/temp', 'home': location}, 'outtmpl': '%(uploader)s/%(title)s.%(ext)s'} + if location == "/podcasts": dl_ops['format'] = 'bestaudio/best[ext=mp3]' dl_ops['postprocessors'] = [{ 'key': 'FFmpegExtractAudio', @@ -91,7 +90,7 @@ def ydl(url, location): 'key': 'FFmpegMetadata', 'add_metadata': True, }] - elif location == "/mnt/plex/asmr": + elif location == "/asmr": dl_ops['format'] = 'bestaudio/best[ext=mp3]' dl_ops['postprocessors'] = [{ 'key': 'FFmpegExtractAudio', diff --git a/app/main.py b/app/main.py index a5325c0..dfd375f 100644 --- a/app/main.py +++ b/app/main.py @@ -3,26 +3,26 @@ from fastapi.responses import HTMLResponse, JSONResponse from fastapi.templating import Jinja2Templates from fastapi.staticfiles import StaticFiles from pathlib import Path -import download +import app.download as download import json app = FastAPI() -# Mount static files if needed (e.g. CSS, JS, images) -app.mount("/static", StaticFiles(directory="static"), name="static") +# # Mount static files if needed (e.g. CSS, JS, images) +app.mount("/static", StaticFiles(directory="app/static"), name="static") -# Jinja2 template directory -templates = Jinja2Templates(directory="templates") +# # Jinja2 template directory +templates = Jinja2Templates(directory="app/templates") # api @app.get("/dropoutUpdate") -async def grab(): - return download.dropout.series() +async def dropoutUpdate(): + download.dropout.series() @app.get("/dropoutSeries", response_class=JSONResponse) -async def read(): - file_path = Path("data/dropout.json") +async def dropoutSeries(): + file_path = Path("/data/dropout.json") if file_path.exists(): with file_path.open("r", encoding="utf-8") as f: data = json.load(f) @@ -30,7 +30,7 @@ async def read(): return JSONResponse(content={"error": "File not found"}, status_code=404) @app.get("/dropoutDownload") -async def download(show: str, season: str, episode: str): +async def dropoutDownload(show: str, season: str, episode: str): download.dropout.show(show,season,episode) # html diff --git a/requirements.txt b/requirements.txt index e69de29..98152a8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1,7 @@ +bs4 +yt_dlp +requests +fastapi +pathlib +uvicorn +jinja2 \ No newline at end of file