Listen to radio and set up alarms from your computer, and control it from a web UI.
Listen to radio and set up alarms from your computer, and control it from a web UI. Relies on mplayer
.
pip install clok
)clok
)$ sudo apt-get install mplayer
$ sudo pip install clok
Clok
Usage:
clok [-a ADDRESS -p PORT --database FILE --log LOG]
clok -h | --help
clok -v | --version
Options:
-h --help Show this screen.
-v --version Show version.
-d --database FILE Specify the database filename (JSON storage).
[default: ./db.json]
-a --address ADDRESS Specify on which address to listen.
[default: 0.0.0.0]
-p --port PORT Specify on which port to listen.
[default: 8000]
--log LOG Specify where to log messages, and which level to set.
Can be "stderr", "syslog", or a filename, followed by the level.
[default: stderr:INFO]
$ clok -d /home/fred/clokdb.json -p 8080
This command will run clok
on port 8080 and store radios and alarms settings in JSON file /home/fred/clokdb.json
.
Clok is easy to launch at startup. For example with supervisord
:
[program:clok]
command=/usr/local/bin/clok -d /home/fred/clokdb.json
user=fred
directory=/home/fred
stopsignal=INT
>>> from clok.client import ClokClient
>>> cc = ClokClient()
>>> cc.list_alarms().json()
{u'alarms': [{u'shuffle': False, u'uuid': u'52f5f8e0-7d09-4d40-b0bd-0acab3220383', u'days': [0, 1, 2, 3, 4], u'disabled': False, u'start': 27000, u'webradio': u'7baec513-0fe8-48f0-9411-69f8b40bc580', u'duration': 1800}], u'status': u'success'}
>>> cc.pause().json()
{u'status': u'success'}