Skip to main content
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'}
```

Metadata

Release files for clok 2.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clok 2.0.2
File Size Uploaded
clok-2.0.2.tar.gz 198.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clok 2.0.2
File Interpreter ABI Platform
clok-2.0.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 410.1 kB

Release files / clok-2.0.2.tar.gz

Download URL clok-2.0.2.tar.gz
Size 198.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ca8459269d965299da545591b33e6e8a59c490b9626dbdff8ddc136b2ff89b64
BLAKE2b-256 checksum
How to use checksums
e01689e3e9191157d80437caaa6f689ac967ac5bbadc3706c2b1c1aed9a903e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / clok-2.0.2-py2.py3-none-any.whl

Download URL clok-2.0.2-py2.py3-none-any.whl
Size 211.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a57bcc696676b20f29b06f7162165e279a46af284f9c0337aae7b7c80c0a3d46
BLAKE2b-256 checksum
How to use checksums
33c0460aff27fe2354ad742f182d9a9d0929b52ec27ff73dc78b410b7ff01536
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

2.0.2 This release

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page