db upgrade & update commit moment, remove last content remains

This commit is contained in:
Xevion
2019-12-24 00:59:43 -06:00
parent 551eec8580
commit cc87bf1834
2 changed files with 1 additions and 27 deletions

View File

@@ -101,7 +101,7 @@ def index():
'Python Developer', 'Python Developer',
'Software Engineer', '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']) @app.route('/register/', methods=['GET', 'POST'])
def register(): def register():

View File

@@ -7,32 +7,6 @@ import re
import json import json
import subprocess 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/<service>/<mediaid>') @app.route('/stream/<service>/<mediaid>')
def stream(service, mediaid): def stream(service, mediaid):
prepare(service, mediaid) prepare(service, mediaid)