~dricottone/blog

ref: 5889487670bfb940ccd9dbb930a01413d6e16414 blog/scripts/lastfm.sh -rwxr-xr-x 740 bytes
58894876Dominic Ricottone Makefile cleanup 1 year, 1 month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh

PASSWD="$(cat lastfm-passwd)"

USER="al__dente"
URI="https://ws.audioscrobbler.com/2.0/?method=user.gettoptracks&user=${USER}&api_key=${PASSWD}&format=json&period=1month&limit=5"
FEED="$(curl --get --no-progress-meter "$URI" | jq --raw-output '[.toptracks.track[] | {track: .name, artist: .artist.name}]')"

echo "<ol>"
echo "${FEED}" | jq --raw-output '.[0] | "  <li>\(.track) by \(.artist)</li>"'
echo "${FEED}" | jq --raw-output '.[1] | "  <li>\(.track) by \(.artist)</li>"'
echo "${FEED}" | jq --raw-output '.[2] | "  <li>\(.track) by \(.artist)</li>"'
echo "${FEED}" | jq --raw-output '.[3] | "  <li>\(.track) by \(.artist)</li>"'
echo "${FEED}" | jq --raw-output '.[4] | "  <li>\(.track) by \(.artist)</li>"'
echo "</ol>"