Skip to content

Instantly share code, notes, and snippets.

@gengue
Last active July 16, 2016 01:13
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 gengue/cce49475681c9fdd4a16aa4ca7640823 to your computer and use it in GitHub Desktop.
Save gengue/cce49475681c9fdd4a16aa4ca7640823 to your computer and use it in GitHub Desktop.
Get song lyrics from terminal.
#!/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
@gengue
Copy link
Author

gengue commented Apr 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment