Smart morning (or any time) radio for the Raspberry Pi
This is my current setup for playing (and stopping) radio automatically on my Pi.
It consists of:
- a cronjob to schedule the radio play/stop, leveraging all the flexibility cron offers
- a Bash script for the missing flexibility: check for holidays, disable specific dates, set the volume, etc
- a (optional) web interface to disable running on specific dates easily
- cron
- mpc
- mpd
- Install the dependencies. On Raspbian:
$ sudo apt install mpc mpd
- Clone the repo:
$ sudo git clone https://github.com/rc2dev/radioauto.git /opt/radioauto
- Configure the host parameters:
$ sudo mkdir /etc/radioauto
$ sudo cp /opt/radioauto/docs/host.conf.sample /etc/radioauto/host.conf
$ sudo -e /etc/radioauto/host.conf
- Create the cronjob from the sample:
$ sudo cp /opt/radioauto/docs/cron.sample /etc/cron.d/radioauto
$ sudo -e /etc/cron.d/radioauto
If you are not familiar with cron, read man 5 crontab
.
- (Optional: web interface) Point your webserver root to the
web
directory and enable PHP.
Be sure to allow it to read/write the configuration directory:
$ sudo chgrp www-data /etc/radiodata
$ sudo chmod g+rwx /etc/radiodata
- (Optional: holidays) To prevent radioauto to run on holidays:
$ sudo -e /etc/radioauto/holidays.txt
Fill this file with the holidays in the format MM-DD
or YYYY-MM-DD
, one per line.
Your Pi should automatically start and stop streaming at the configured time.
If you ever need to disable it ad-hoc for a specific date, just access the web interface.
- Logo made by Those Icons from www.flaticon.com
Licensed under GPLv3
Copyright (C) 2017-2020 Rafael Cavalcanti