summaryrefslogtreecommitdiff
path: root/dot/local/bin/musopen
blob: 9f3f253adc07c62caf742f4a3ae01dc2f391d66a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh

CAPTURE=
JSON=$(curl -s https://musopen.org/radio/next/)

for v in url piece piece_url; do
  eval $v='$(printf %s "$JSON" | jq -r .'$v')'
done

printf '%s (%s)\n' "$piece" "$piece_url"
filename=${piece_url%/}.mp3
filename=${filename##*/}

[ "$CAPTURE" ] || filename=

exec mpv "$url" ${filename+ --stream-capture="$filename"}