mirror of
https://github.com/Xevion/v1.xevion.dev.git
synced 2025-12-12 07:11:45 -06:00
db upgrade & update commit moment, remove last content remains
This commit is contained in:
@@ -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():
|
||||||
|
|||||||
26
app/sound.py
26
app/sound.py
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user