dots


commit
0d90269
parent
ee9b70c
author
chasinglightning
date
2025-01-10 19:07:26 -0500 EST
update nowplaying to something actually cool
1 files changed,  +26, -1
M home/.local/bin/nowplaying
+26, -1
 1@@ -1,3 +1,28 @@
 2 #!/bin/bash
 3+# inspired by https://codeberg.org/hyperreal/bin/src/branch/main/amimullvad
 4+#
 5+# requires curl & charmbracelet/gum
 6+#
 7+# 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
 8+#
 9+#
10+# LASTFM_APIKEY=""
11 
12-python3 /home/kat/Documents/Scripts/lastfm.py
13+user="springpool"
14+
15+URL="https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=$user&api_key=$LASTFM_APIKEY&format=json&limit=1"
16+
17+artist=$(curl -s ${URL} | jq -r '.recenttracks.track[0].artist."#text"')
18+album=$(curl -s ${URL} | jq -r '.recenttracks.track[0].album."#text"')
19+song=$(curl -s ${URL} | jq -r '.recenttracks.track[0].name')
20+
21+left=$(printf "%s\n%s\n%s\n" "artist" "album" "song")
22+right=$(printf "%s\n%s\n%s\n" "$artist" "$album" "$song")
23+
24+final_left=$(gum style --foreground "#a6d189" --border none --width 20 --margin "1 2" --padding "0 1" --align left "$left")
25+final_right=$(gum style --foreground "#f4b8e4" --border none --width 20 --margin "1 0" --align left "$right")
26+
27+join=$(gum join --horizontal --align right "$final_left" "$final_right")
28+all=$(gum style --border-foreground "#99d1db" --border double --width 50 --padding "0 1" --align center "$join")
29+
30+gum join --vertical "$all"