Created
October 6, 2019 08:40
-
-
Save i-sync/d1c59f29e4f018e5ab9f565cfdf4eb8f to your computer and use it in GitHub Desktop.
voice check for telegram
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [program:voice-producor] | |
| command=/home/pi/voice/voice-producor.sh | |
| user=pi | |
| stderr_logfile=/home/pi/voice/voicep.log | |
| stdout_logfile=/home/pi/voice/voicep.log | |
| stopasgroup=true | |
| stopsignal=QUIT | |
| [program:voice-consumer] | |
| command=/home/pi/voice/voice-consumer.sh | |
| user=pi | |
| stderr_logfile=/home/pi/voice/voicec.log | |
| stdout_logfile=/home/pi/voice/voicec.log | |
| stopasgroup=true | |
| stopsignal=QUIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/bash | |
| #variable | |
| player=/usr/bin/omxplayer | |
| reminder=/home/pi/tmp/remind/reminder.mp3 | |
| backup=/home/pi/tmp/backup/ | |
| FIFO=/home/pi/voice/fifo1 | |
| #create a named pipe | |
| if [[ ! -e $FIFO ]]; then | |
| mkfifo $FIFO | |
| fi | |
| #read | |
| while read file < $FIFO | |
| do | |
| echo $file | |
| #check mpc is running, pause | |
| playing=`mpc | grep playing | wc -l` | |
| if [ $playing -ge 1 ] | |
| then | |
| mpc pause | |
| fi | |
| #playing message | |
| $player $reminder | |
| $player $file | |
| $player $file | |
| mv $file $backup | |
| #if mpc is paused , resume | |
| paused=`mpc | grep paused | wc -l` | |
| if [ $paused -ge 1 ] | |
| then | |
| mpc play | |
| fi | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| FIFO=/home/pi/voice/fifo1 | |
| if [[ ! -e $FIFO ]]; then | |
| mkfifo $FIFO | |
| fi | |
| inotifywait -m /home/pi/tmp -e close_write | | |
| while read path action file; do | |
| #echo "########$path$file#########" | |
| echo "$path$file" >> $FIFO | |
| #echo "$path$file" >> ~/inotify.txt | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment