diff --git a/app/routes.py b/app/routes.py index d3aa27f..94bf583 100644 --- a/app/routes.py +++ b/app/routes.py @@ -101,7 +101,7 @@ def index(): 'Python Developer', 'Software Engineer', ] - return render_template('index.html', content=content, job=random.choice(jobs)) + return render_template('index.html', job=random.choice(jobs)) @app.route('/register/', methods=['GET', 'POST']) def register(): diff --git a/app/sound.py b/app/sound.py index a48e1dd..080c725 100644 --- a/app/sound.py +++ b/app/sound.py @@ -7,32 +7,6 @@ import re import json import subprocess - @staticmethod - def path(videoid): - try: - config = YouTubeHandler.getConfig(videoid) - return config['path'] - except KeyError: - filename = YouTubeHandler.filename(videoid) - path = os.path.join('app', 'sounds', 'youtube', filename) - with open(os.path.join('app', 'sounds', 'filenames.json'), 'r+') as file: - config = json.load(file) - config['youtube'][videoid] = { - "filename" : filename, - "path" : path - } - file.seek(0) - file.write(json.dumps(config)) - file.truncate() - return path - - @staticmethod - def download(videoid): - config = YouTubeHandler.getConfig(videoid) - if not os.path.exists(config['path']): - subprocess.run(['youtube-dl', '-x', '--restrict-filenames', '--audio-format', 'mp3', YouTubeHandler.url(videoid)]) - os.rename(config['filename'], config['path']) - @app.route('/stream//') def stream(service, mediaid): prepare(service, mediaid)