Skip to main content

Listen to radio and set up alarms from your computer, control it from a web ui.

Project description

Clok
====

[![https://badge.fury.io/py/clok](https://badge.fury.io/py/clok.png)](https://badge.fury.io/py/clok)
[![Build Status](https://travis-ci.org/fspot/clok.svg)](https://travis-ci.org/fspot/clok)
[![Coverage Status](https://coveralls.io/repos/fspot/clok/badge.png)](https://coveralls.io/r/fspot/clok)
[![License](https://pypip.in/license/clok/badge.svg)](https://pypi.python.org/pypi/clok/)

Listen to radio and set up alarms from your computer, and control it from a web UI. Relies on `mplayer`.

![Screenshot](https://framapic.org/FASezG3yXdaR/1n2hthSsAA9e.png)

#### Features :

- easy to install (pure python dependencies: just `pip install clok`)
- easy to use (just type `clok`)
- list / add / remove / edit radios and alarms
- can play online streams (webradios), but also local tracks or playlists
- player controls: play / pause / volume up / volume down / mute / go backward / go forward
- extra player controls for playlists : previous track / next track / shuffle
- alarms settings allow to chose trigger time, duration, days of week
- can be controlled via web ui or via REST API (python client inside)
- web ui translated in french and english (according to system language)

Installation
------------

```
$ sudo apt-get install mplayer
$ sudo pip install clok
```


Usage
-----

```
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]
```

Example
-------

```
$ 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`.


Launch at startup
-----------------

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
```


Python client
-------------

```python
>>> 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'}
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clok-2.0.2.tar.gz (198.9 kB view details)

Uploaded Source

Built Distribution

clok-2.0.2-py2.py3-none-any.whl (211.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file clok-2.0.2.tar.gz.

File metadata

  • Download URL: clok-2.0.2.tar.gz
  • Upload date:
  • Size: 198.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for clok-2.0.2.tar.gz
Algorithm Hash digest
SHA256 ca8459269d965299da545591b33e6e8a59c490b9626dbdff8ddc136b2ff89b64
MD5 076824318d9a303c3f723f3b1cb9ef1d
BLAKE2b-256 e01689e3e9191157d80437caaa6f689ac967ac5bbadc3706c2b1c1aed9a903e7

See more details on using hashes here.

File details

Details for the file clok-2.0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for clok-2.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a57bcc696676b20f29b06f7162165e279a46af284f9c0337aae7b7c80c0a3d46
MD5 cdd5e0f46de71cb0c79dce2f485a566c
BLAKE2b-256 33c0460aff27fe2354ad742f182d9a9d0929b52ec27ff73dc78b410b7ff01536

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page