Skip to content

Instantly share code, notes, and snippets.

@spvkgn
Last active July 15, 2018 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spvkgn/3e9282f80c56b9fcad6a59690b53a34a to your computer and use it in GitHub Desktop.
Save spvkgn/3e9282f80c56b9fcad6a59690b53a34a to your computer and use it in GitHub Desktop.
Fetch lyrics with DeaDBeeF player
#!/bin/sh
DEADBEEF=$(which deadbeef)
ARTIST_NAME=$($DEADBEEF --nowplaying-tf "%artist%")
TRACK_TITLE=$($DEADBEEF --nowplaying-tf "%title%")
printf "\033c"
ARTIST=$(echo "$ARTIST_NAME" | perl -MURI::Escape -ne 'chomp;print uri_escape($_),"\n"')
TITLE=$(echo "$TRACK_TITLE" | perl -MURI::Escape -ne 'chomp;print uri_escape($_),"\n"')
LYRICS_TEXT=$(wget --user-agent="Mozilla/5.0 Gecko/20100101" \
--no-check-certificate --quiet --timeout=30 -O - \
"https://makeitpersonal.co/lyrics?artist=$ARTIST&title=$TITLE" | sed '1{/^$/d}')
printf "\033[1m$ARTIST_NAME - $TRACK_TITLE\033[m\n\n$LYRICS_TEXT" | less -Rsw~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment