Fandom

Music Player Daemon Community Wiki

Hack:mpd lyric.sh

525pages on
this wiki
Add New Page
Talk0 Share
 #!/bin/bash
 export prog=less
 dir=/home/music/lyrics
 mkdir -p $dir
 cd $dir
 waitLyric () {
       [ "$(mpc|wc -l)" -lt 3 ] && return 0
       while mpc | head -1 | grep "$1" > /dev/null;
       do
               sleep 1;
       done
       kill $(ps -ef | grep "$2" | grep "$1" | sed "s/[^ ]\+ \+\([0-9]\+\).*/\1/")
 }
 
 while sleep 1;
 do
       clear
       out=$(mpc)
       [ "$(echo "$out"|wc -l)" -lt 3 ] && continue;
       title=$(echo "$out" | head -1)
 
       if [ -f "$title" ]; then
               waitLyric "$title" "$prog" &
               $prog "$(echo "$title" | head -1)"
               clear
       else
               read -p "No lyrics found... create? (y/n)" answer
               if [ "$answer" = "y" ];
               then
                       ${EDITOR:-vi} "$title"
               else
                       while mpc | head -1 | grep "$title" > /dev/null;
                       do
                               sleep 1;
                       done
               fi
       fi
 done

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki