Skip to content

Instantly share code, notes, and snippets.

@fern4lvarez
Last active April 9, 2017 13:55
Show Gist options
  • Save fern4lvarez/5424c6f2875d601b852ce9df25e55976 to your computer and use it in GitHub Desktop.
Save fern4lvarez/5424c6f2875d601b852ce9df25e55976 to your computer and use it in GitHub Desktop.
What are you listening to now?
#!/usr/bin/env bash
# http://www.last.fm/api/account/create
API_KEY=""
USER=""
TRACKS=$(curl -s https://ws.audioscrobbler.com/2.0/\?method\=user.getRecentTracks\&user\=${USER}\&api_key\=${API_KEY}\&limit\=1\&format\=json)
TRACK=$(echo $TRACKS | sed 's/#//g' | jq '.recenttracks.track[0]')
echo "Listening to:"
echo " Artist: $(echo $TRACK | jq '.artist.text')"
echo " Title: $(echo $TRACK | jq '.name')"
echo " Album: $(echo $TRACK | jq '.album.text')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment