#!/bin/bash bold='\x1b[01m' form=/tmp/getlyric-form.tmp songs=/tmp/getlyric-songs.tmp lyric=/tmp/getlyric-lyric.tmp tmp=/tmp/getlyric-tmp.tmp if xmmsctrl playing then song=`xmmsctrl title` song=`perl -e '$s=$ARGV[0];$s=~s/.mp3$//i;$s=~s/^[0-9]+ //;print $s' "$song"` interpret=`echo $song | cut -d'-' -f1` title=`echo $song | cut -d'-' -f2` interpret=${interpret:0:$((${#interpret}-1))} title=${title:1:${#title}} else echo -n "Interpret: " && read interpret echo -n "Title: " && read title fi sep="$" curl -s -F "search=norm" -F "int=${interpret}" -F "tit=${title}" "http://www.lyriks.de/lyriks/search.php?hijack" > $form grep '(.*)<\/a>
/\1'${sep}'\2/' > $songs lines=`wc -l $songs | cut -d" " -f7` if [ $lines -gt 1 ] then cut -d${sep} -f2 $songs | cat -n echo "" echo -ne "Select one: ${bold}" read nr echo -e "${reset}" echo "" else nr=1 fi id=`cut -d${sep} -f1 $songs | sed -n -e $nr'p'` curl -s "http://www.basc.de/lyriks/display.php?id=$id" > $lyric lines=`wc -l $lyric | cut -d" " -f5` lines=$(($lines - 130)) tail -n $lines $lyric > $tmp mv $tmp $lyric lines=$(($lines - 41)) head -n $lines $lyric > $tmp mv $tmp $lyric ( echo -e "${bold}${interpret} - ${title}${reset}" echo "" sed -e 's/
//' \ -e "s/´/'/g" \ -e "s/´/'/g" $lyric ) | less rm $form rm $songs rm $lyric