This commit is contained in:
fauno 2022-03-24 18:18:04 -03:00
commit 278cdd751a
6 changed files with 78 additions and 0 deletions

6
README.md Normal file
View file

@ -0,0 +1,6 @@
Totoro
======
Transmisión automática de audio. Corre sobre una RaspberryPi
o cualquier computadora con una entrada de audio, conectada a una salida
**no amplificada** de consola.

4
grabar Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
date="$(date +%s)"
ffmpeg -loglevel quiet -f alsa -i default:CARD=Device -c:a libvorbis -b:a 96K /home/alarm/grabacion-${date}.ogg &
echo $! > /tmp/grabar.pid

34
install.sh Normal file
View file

@ -0,0 +1,34 @@
#!/bin/sh
# Actualizar el sistema después de instalado
pacman-key --init
pacman-key --populate archlinuxarm
pacman -Syu --noconfirm
# Instalar las dependencias
pacman -S --noconfirm monit ffmpeg tinc alsa-utils
# Habilitar el micrófono
amixer sset Mic unmute
amixer sset Mic 70%
alsactl store
# Configurar privilegios
echo "PASSWORD=${PASSWORD}" > /etc/transmisor.conf
echo "SOURCE=${SOURCE}" >> /etc/transmisor.conf
echo "SERVER=${SERVER:-transmisor.partidopirata.com.ar}" >> /etc/transmisor.conf
echo "PORT=${PORT:-8000}" >> /etc/transmisor.conf
chown -R root:audio /etc/transmisor.conf
chmod 640 /etc/transmisor.conf
gpasswd -a alarm audio
rm /etc/monitrc
install -m 600 ./monitrc /etc/monitrc
install -m 755 ./grabar /usr/local/bin/grabar
install -m 755 ./transmitir /usr/local/bin/transmitir
install -m 600 ./totoro /etc/netctl/totoro
netctl enable totoro
netctl start totoro
systemctl enable --now monit

17
monitrc Normal file
View file

@ -0,0 +1,17 @@
set daemon 30
set log syslog
set pidfile /run/monit.pid
set idfile /var/.monit.id
set statefile /var/.monit.state
set httpd port 2812 and
use address localhost
allow localhost
check process transmitir with pidfile /tmp/transmitir.pid
start program = "/usr/local/bin/transmitir" as uid "alarm" and gid "alarm"
stop program = "/bin/sh -c 'cat /tmp/transmitir.pid | xargs kill'"
check process grabar with pidfile /tmp/grabar.pid
start program = "/usr/local/bin/grabar" as uid "alarm" and gid "alarm"
stop program = "/bin/sh -c 'cat /tmp/grabar.pid | xargs kill'"

7
totoro Normal file
View file

@ -0,0 +1,7 @@
Description='Totoro'
Interface=wlan0
Connection=wireless
Security=wpa
IP=dhcp
ESSID='Totoro'
Key='transmision pirata'

10
transmitir Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
source /etc/transmisor.conf
ffmpeg -loglevel quiet \
-f alsa -i default:CARD=Device \
-c:a libvorbis -b:a 96K -content_type audio/ogg \
-rw_timeout 20000000 \
"icecast://source:${PASSWORD}@${SERVER}:${PORT}/${SOURCE}" &
echo $! > /tmp/transmitir.pid