Last active
July 16, 2016 01:13
-
-
Save gengue/cce49475681c9fdd4a16aa4ca7640823 to your computer and use it in GitHub Desktop.
Get song lyrics from terminal.
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/bash | |
if [ "$#" -eq 0 ]; then | |
artist_name=`osascript -e'tell application "iTunes"' -e'get artist of current track' -e'end tell'` | |
song_title=`osascript -e'tell application "iTunes"' -e'get name of current track' -e'end tell'` | |
else | |
artist_name=$1 | |
song_title=$2 | |
fi | |
artist=`perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$artist_name"` | |
title=`perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$song_title"` | |
song=`curl -s "https://makeitpersonal.co/lyrics?artist=$artist&title=$title"` | |
echo -e "$artist_name - $song_title\n$song" | less -FX |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
based on https://gist.github.com/febuiles/1549991