There are two scripts, one to repeat the track when it has to be done, and a daemon which restarts the repeat process if the user changes the current track. Note: the daemon doesn't take care if you seek in the track, so... if you had like to repeat the same track and seek into it just hack the script and why not leave a comment with your modifications.
The repeat script
#!/bin/sh
# Repeat the same track
function repeat ()
{
min=`mpc|head -2|tail -1|awk '{print $3}'|cut -d: -f1`
sec=`mpc|head -2|tail -1|awk '{print $3}'|cut -d: -f2`
tmin=`mpc --format %time%|head -1|cut -d: -f1`
tsec=`mpc --format %time%|head -1|cut -d: -f2`
sleep $(( ($tmin*60+$tsec) - ($min*60+$sec) )) && mpc prev && repeat
}
repeat
The daemon
#!/bin/sh
# Daemon which takes care of restarting the repeat process
# if the user changes the current track
function restart ()
{
killall mpd-repeat-track.sh
mpd-repeat-track.sh&
}
restart
while sleep 2
do
file=/tmp/mpd-repeat-track.sh
current=`mpc|head -1`
last=`cat $file`
echo $current > $file
[ x"$current" != x"$last" ] && restart
done
Now run mpd-repeat-trackd.sh and it will just work<tm>.
You can follow the changes here:
- http://mykey57.free.fr/pub/misc/bin/mpd-repeat-track.sh
- http://mykey57.free.fr/pub/misc/bin/mpd-repeat-trackd.sh
Old links:
Happy Independence Day pics 2016
ReplyDeleteHappy Independence Day Greetings 2016
Happy Independence Day Scraps 2016
Best Independence Day Messages 2016
Happy Independence Day Wallpapers 2016
Happy Independence day poems in English
Happy Deepavali Quotes 2016
Happy Deepavali Wishes 2016
box office collection