2018-06-24 23:12:57 +02:00
|
|
|
## UPDATE 06-2018
|
2018-06-24 23:05:02 +02:00
|
|
|
After many trouble with button management, I try install with just mpd (many mpc client are available on smartphone).
|
2016-08-15 22:32:44 +02:00
|
|
|
|
2018-06-24 23:12:57 +02:00
|
|
|
### 1. Config raspbian 9 post-install :
|
2018-06-24 23:00:09 +02:00
|
|
|
```console
|
|
|
|
root@raspberrypi:/home/pi# raspi-config
|
|
|
|
```
|
2018-06-24 23:09:16 +02:00
|
|
|
configure
|
|
|
|
* tzdata
|
|
|
|
* locales
|
|
|
|
* network
|
|
|
|
* force audio output on jack and not hdmi
|
2018-06-24 23:12:57 +02:00
|
|
|
### 2. Update, upgrade and install mpd
|
2018-06-24 23:00:09 +02:00
|
|
|
```console
|
|
|
|
root@raspberrypi:/home/pi# apt update && apt upgrade -y && apt install mpc mpd && systemctl enable mpd
|
|
|
|
```
|
2018-06-24 23:12:57 +02:00
|
|
|
### 3. Add your radio link on new file:
|
2018-06-24 23:00:09 +02:00
|
|
|
```console
|
|
|
|
root@raspberrypi:/home/pi# nano /var/lib/mpd/playlists/radios.m3u
|
|
|
|
```
|
2018-06-24 23:09:16 +02:00
|
|
|
for example
|
2018-06-24 23:00:09 +02:00
|
|
|
```txt
|
|
|
|
#France Inter
|
|
|
|
https://chai5she.cdn.dvmr.fr/franceinter-midfi.mp3
|
|
|
|
#Sing-Sing
|
|
|
|
http://stream.sing-sing.org:8000/singsing128
|
|
|
|
```
|
2018-06-24 23:12:57 +02:00
|
|
|
### 4. Ajust sound volume
|
|
|
|
```console
|
|
|
|
pi@raspberrypi:~ $ alsamixer
|
|
|
|
```
|
|
|
|
put 100% !!!
|
|
|
|
### 5. Create bash script who autoplay radios on boot
|
2018-06-24 23:00:09 +02:00
|
|
|
```console
|
|
|
|
pi@raspberrypi:~ $ nano /home/pi/autoplay.sh
|
|
|
|
```
|
|
|
|
```bash
|
|
|
|
#!/bin/sh
|
2017-01-22 13:55:05 +01:00
|
|
|
|
2018-06-24 23:00:09 +02:00
|
|
|
if mpc status | awk 'NR==2' | grep playing; then
|
|
|
|
echo "mpc déja lancé, je ne fait que passer..."
|
|
|
|
else
|
|
|
|
echo "chargement des radios"
|
|
|
|
mpc clear
|
|
|
|
mpc load radios
|
|
|
|
mpc play
|
|
|
|
fi
|
|
|
|
```
|
2018-06-24 23:12:57 +02:00
|
|
|
### 6. Add crontab
|
2018-06-24 23:00:09 +02:00
|
|
|
```console
|
|
|
|
pi@raspberrypi:~ $ crontab -e
|
|
|
|
```
|
|
|
|
```bash
|
|
|
|
@reboot sh /home/pi/autoplay.sh &
|
2018-06-24 23:24:30 +02:00
|
|
|
# France Inter tout les matins a 8h
|
|
|
|
00 08 * * * mpc play 1
|
|
|
|
# Sing-Sing le soir à 19h
|
|
|
|
10 19 * * * mpc play 2
|
2018-06-24 23:00:09 +02:00
|
|
|
```
|
2018-10-27 13:20:42 +02:00
|
|
|
|
|
|
|
To avoid write error on disk, restart mdp every day
|
|
|
|
```console
|
|
|
|
root@raspberrypi:~ $ crontab -e
|
|
|
|
```
|
|
|
|
```bash
|
|
|
|
00 04 * * * service mpd restart
|
|
|
|
```
|