Commit fca9deab authored by Andre Julius's avatar Andre Julius 👀
Browse files

Add flask files

parent 6e7089c7
import glob
from config import datadir
index = []
def reload_index():
global index
index = glob.glob1(datadir, "*.wav")
def is_indexed(file_name):
global index
return file_name in index
import wave
import pyaudio
sound = wave.open("data/test.wav")
p = pyaudio.PyAudio()
chunk = 1024
stream = p.open(format=p.get_format_from_width(sound.getsampwidth()),
channels=sound.getnchannels(),
rate=sound.getframerate(),
output=True)
data = sound.readframes(chunk)
while data != '':
stream.write(data)
data = sound.readframes(chunk)
from web import web
from api.index import reload_index
reload_index()
web.run(debug=True, host="0.0.0.0", port=80)
from flask import Flask
web = Flask(__name__)
web.config.from_object('config')
from web import views
from flask import redirect, abort, request, jsonify, Response
from web import web
import api.index
@web.route('/', defaults={'path': ''})
@web.route('/<path:path>')
def catch_all(path):
""" Catches all requests that are not handled by any other method """
return redirect("/")
@web.route("/")
@web.route("/index/")
def index():
return jsonify(api.index.index)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment