Commit 0d90269
chasinglightning
·
2025-01-10 19:07:26 -0500 EST
parent ee9b70c
update nowplaying to something actually cool
1 files changed,
+26,
-1
+26,
-1
| ... | ... | @@ -1,3 +1,28 @@ | |
| 1 | 1 | #!/bin/bash | |
| 2 | + | # inspired by https://codeberg.org/hyperreal/bin/src/branch/main/amimullvad | |
| 3 | + | # | |
| 4 | + | # requires curl & charmbracelet/gum | |
| 5 | + | # | |
| 6 | + | # i have my API key stored in a private var file sourced by bashrc so either do that too or just uncomment below and put it there | |
| 7 | + | # | |
| 8 | + | # | |
| 9 | + | # LASTFM_APIKEY="" | |
| 2 | 10 | ||
| 3 | - | python3 /home/kat/Documents/Scripts/lastfm.py | |
| 11 | + | user="springpool" | |
| 12 | + | ||
| 13 | + | URL="https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=$user&api_key=$LASTFM_APIKEY&format=json&limit=1" | |
| 14 | + | ||
| 15 | + | artist=$(curl -s ${URL} | jq -r '.recenttracks.track[0].artist."#text"') | |
| 16 | + | album=$(curl -s ${URL} | jq -r '.recenttracks.track[0].album."#text"') | |
| 17 | + | song=$(curl -s ${URL} | jq -r '.recenttracks.track[0].name') | |
| 18 | + | ||
| 19 | + | left=$(printf "%s\n%s\n%s\n" "artist" "album" "song") | |
| 20 | + | right=$(printf "%s\n%s\n%s\n" "$artist" "$album" "$song") | |
| 21 | + | ||
| 22 | + | final_left=$(gum style --foreground "#a6d189" --border none --width 20 --margin "1 2" --padding "0 1" --align left "$left") | |
| 23 | + | final_right=$(gum style --foreground "#f4b8e4" --border none --width 20 --margin "1 0" --align left "$right") | |
| 24 | + | ||
| 25 | + | join=$(gum join --horizontal --align right "$final_left" "$final_right") | |
| 26 | + | all=$(gum style --border-foreground "#99d1db" --border double --width 50 --padding "0 1" --align center "$join") | |
| 27 | + | ||
| 28 | + | gum join --vertical "$all" |