Skip to content

Commit

Permalink
duct-taped circular import
Browse files Browse the repository at this point in the history
  • Loading branch information
rptr committed Aug 18, 2019
1 parent 0571b13 commit d294057
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
7 changes: 6 additions & 1 deletion libresign/flaskapp.py
Expand Up @@ -19,10 +19,15 @@
from flask import Flask, request, render_template, redirect, send_file

import libresign.config as config
import libresign.web as web
from libresign.request import Request

app = Flask(__name__)
web = None

def run (web_):
global web
web = web_
app.run(debug=True, use_reloader=False, threaded=True, port=config.HTTP_PORT, host="0.0.0.0")

# in case we want to add some more bells and whistles
def file_request (request_type):
Expand Down
14 changes: 9 additions & 5 deletions libresign/web.py
Expand Up @@ -50,15 +50,19 @@ def stop():
# TODO use other server than werkzeug and deal with shutdown at that point
pass

class WebPusher():
def push_request (self, request):
global msg_queue

if msg_queue:
msg_queue.put(request)

def web_thread():
web = WebPusher()
logging.info("starting web server")
flaskapp.app.run(debug=True, use_reloader=False, threaded=True, port=config.HTTP_PORT, host="0.0.0.0")
flaskapp.run(web)
logging.info("stopping web server")

def push_request (request):
if msg_queue:
msg_queue.put(request)

def get_playlist ():
playlist = signd.get_playlist()
return playlist.playlist
Expand Down

0 comments on commit d294057

Please sign in to comment.