Created
August 10, 2017 04:30
-
-
Save i-sync/29c8315d8704b7d5e87d3314bd3eba7b to your computer and use it in GitHub Desktop.
play telegram bot voice
This file contains 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 | |
#this file is check "voice.sh" script whether is running | |
#if "voice.sh" script is running , nothing to do | |
#else run "voice.sh" script | |
result=`ps aux | grep -i "voice.sh" | grep -v "grep" | wc -l` | |
echo $result | |
if [ $result -ge 1 ] | |
then | |
echo "voice.sh is running..." | |
#/bin/bash /home/pi/sh/voice.sh | |
else | |
echo "voice.sh is not running..." | |
echo "start voice.sh script..." | |
#check mpc is playing , pause | |
playing=`mpc | grep playing | wc -l` | |
if [ $playing -ge 1 ] | |
then | |
mpc pause | |
fi | |
#run voice.sh | |
/bin/bash /home/pi/sh/voice.sh | |
#check mpc is pause, resume | |
paused=`mpc | grep paused | wc -l` | |
if [ $paused -ge 1 ] | |
then | |
mpc play | |
fi | |
fi |
This file contains 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 | |
#this file is really play script | |
#check telegram bot voice path | |
path=~/tmp/* | |
#voice backup folder | |
backup=~/tmp/backup | |
#use mplayer play telegram bot voice | |
player=/usr/bin/mplayer | |
#reminder voice | |
reminder=~/tmp/remind/reminder.mp3 | |
#if first voice, play reminder voice | |
flag=true | |
for file in $path | |
do | |
#check $file whether is file | |
if [ -f $file ];then | |
#echo $file | |
if [ "$flag" ] ; then | |
$player $reminder | |
flag=false | |
fi | |
$player $file | |
$player $file | |
mv $file $backup | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment