Last active
July 15, 2018 14:21
-
-
Save spvkgn/3e9282f80c56b9fcad6a59690b53a34a to your computer and use it in GitHub Desktop.
Fetch lyrics with DeaDBeeF player
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/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