Last active
April 9, 2017 13:55
-
-
Save fern4lvarez/5424c6f2875d601b852ce9df25e55976 to your computer and use it in GitHub Desktop.
What are you listening to now?
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
#!/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