summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroantoine <antoine.ouvrard@nereide.fr>2016-08-15 22:32:44 +0200
committeroantoine <antoine.ouvrard@nereide.fr>2016-08-15 22:32:44 +0200
commitd9fef1e417dc35d61f5bebccf0b10807baa9ddf4 (patch)
treebe21d873538389f7eaeea641631d5c63726ef31f
AOU:initialisation du projet
-rw-r--r--LICENSE13
-rw-r--r--README9
-rw-r--r--btn_track.sh40
-rw-r--r--mpc.service11
-rw-r--r--radios.m3u12
5 files changed, 85 insertions, 0 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..8cffccc
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,13 @@
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ Version 2, December 2004
+
+ Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
+
+ Everyone is permitted to copy and distribute verbatim or modified
+ copies of this license document, and changing it is allowed as long
+ as the name is changed.
+
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. You just DO WHAT THE FUCK YOU WANT TO. \ No newline at end of file
diff --git a/README b/README
new file mode 100644
index 0000000..b494f79
--- /dev/null
+++ b/README
@@ -0,0 +1,9 @@
+This project contain files to transform raspbian on web radio player with one button to manage.
+
+#Installation
+- Start from raspbian jessie 8
+- Add a simple push button on GPIO number 24.
+- Install mpd `apt install mpd mpc`
+- Copy/Paste btn_track.sh script in $HOME
+- Create mpc.service
+`sudo nano /etc/systemd/system/mpc.service`
diff --git a/btn_track.sh b/btn_track.sh
new file mode 100644
index 0000000..1deb649
--- /dev/null
+++ b/btn_track.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+#Set GPIO ID with push button
+GPIO_ID="24"
+
+#Initialize GPIO
+echo $GPIO_ID > /sys/class/gpio/export
+echo in > /sys/class/gpio/gpio$GPIO_ID/direction
+
+#Start MPC
+mpc clear
+mpc load radios
+mpc repeat on
+mpc play
+
+printf "MPC started"
+
+i=0
+echo "Loop"
+while true
+do
+ echo "Until"
+ until /bin/grep 1 /sys/class/gpio/gpio$GPIO_ID/value >> /dev/null
+ do
+ /bin/sleep .1
+ done
+ echo "End until"
+ i=$((i+1))
+ if [ $i -ge 30 ]
+ then
+
+ sudo systemctl poweroff
+ echo "Shutdown..."
+ break
+ fi
+
+ echo "Next Track"
+ /usr/bin/mpc next
+done
+echo "End loop" \ No newline at end of file
diff --git a/mpc.service b/mpc.service
new file mode 100644
index 0000000..e6fb8f2
--- /dev/null
+++ b/mpc.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Mpc service
+Requires=mpd.service
+
+[Service]
+Type=simple
+User=pi
+ExecStart=/bin/sh /home/pi/btn_track.sh
+
+[Install]
+WantedBy=multi-user.target
diff --git a/radios.m3u b/radios.m3u
new file mode 100644
index 0000000..2d6250a
--- /dev/null
+++ b/radios.m3u
@@ -0,0 +1,12 @@
+#Inter
+http://audio.scdn.arkena.com/11008/franceinter-midfi128.mp3
+#Culture
+#http://audio.scdn.arkena.com/11010/franceculture-midfi128.mp3
+#FIP
+#http://stream.dnm.radiofrance.fr/fip1-high.mp3
+#sing sing
+http://stream.sing-sing.org:8000/singsing128
+#RTL
+#http://streaming.radio.rtl.fr/rtl-1-44-96
+#Paradise Radio
+http://stream-uk1.radioparadise.com/mp3-192 \ No newline at end of file