Serve music-tmp for webstudio UI waveforms.
This commit is contained in:
parent
8bf1def0d1
commit
a51e214f27
1 changed files with 16 additions and 1 deletions
17
server.py
17
server.py
|
@ -20,7 +20,8 @@ import queue
|
|||
import threading
|
||||
import time
|
||||
import player
|
||||
from flask import Flask, render_template, send_from_directory, request, jsonify
|
||||
from flask import Flask, render_template, send_from_directory, request, jsonify, abort
|
||||
from flask_cors import CORS, cross_origin
|
||||
from typing import Any, Optional
|
||||
import json
|
||||
import setproctitle
|
||||
|
@ -89,6 +90,7 @@ class PlayerHandler():
|
|||
|
||||
|
||||
app = Flask(__name__, static_url_path='')
|
||||
CORS(app, supports_credentials=True) # Allow ALL CORS!!!
|
||||
|
||||
log = logging.getLogger('werkzeug')
|
||||
log.disabled = True
|
||||
|
@ -187,6 +189,19 @@ def restart_server():
|
|||
stopServer(restart=True)
|
||||
startServer()
|
||||
|
||||
|
||||
# Get audio for UI to generate waveforms.
|
||||
|
||||
@app.route("/audiofile/<type>/<int:id>")
|
||||
#@cross_origin()
|
||||
def audio_file(type: str, id: int):
|
||||
print("Hit!")
|
||||
if type not in ["managed", "track"]:
|
||||
abort(404)
|
||||
return send_from_directory('music-tmp', type + "-" + str(id) + ".mp3")
|
||||
|
||||
|
||||
|
||||
# Channel Audio Options
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue