diff --git a/README.md b/README.md index 9b03b7f..17acc94 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # mp3printer a mp3 printer, written in python and jquery with websockets -You need python3, vlc, vlc bindings for python, youtube-dl and tornado. Start by running ```sudo sh startup.sh``` and the mp3 printer will listen for http requests at port 80. +You need python3, vlc, vlc bindings for python, yt-dlp and tornado, optionally pychromecast for casting support. Start by running `sudo ./startup.sh` and the mp3 printer will listen for http requests at port 80. +Running `./startup.sh --help` will show a list of possible options. Record scratch sound is by "Raccoonanimator" and can be found here: https://freesound.org/people/Raccoonanimator/sounds/160907/ + +Icon is a combination of two icons from the [Tango Desktop Project](http://tango.freedesktop.org/). diff --git a/connections.py b/connections.py index 0c3c21e..00cbdb6 100644 --- a/connections.py +++ b/connections.py @@ -2,11 +2,12 @@ import json class Connections: - def __init__(self): + def __init__(self, ioloop): self.lock = Lock() + self._ioloop = ioloop self._clients = [] - def add_conneciton(self, handler): + def add_connection(self, handler): self.lock.acquire() try: self._clients.append(handler) @@ -20,11 +21,10 @@ def close_connection(self, handler): finally: self.lock.release() - def message_clients(self, message): self.lock.acquire() try: for client in self._clients: - client.write_message(json.dumps(message)) + self._ioloop.add_callback(client.write_message, json.dumps(message)) finally: self.lock.release() diff --git a/index.html b/index.html index 2e52ed6..e40a103 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,15 @@