diff options
author | Andrew Cady <d@jerkface.net> | 2016-12-26 12:01:10 -0500 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2016-12-26 12:01:10 -0500 |
commit | 06a09db3fee550d211002e77d7dda64ccec06e71 (patch) | |
tree | 9614b46b43a27eb2072858deac97d933ddb78169 /dot/local/bin/musopen | |
parent | 817db44134697e1d8647305eaedc6253a76c96af (diff) |
new commands
Diffstat (limited to 'dot/local/bin/musopen')
-rw-r--r-- | dot/local/bin/musopen | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/dot/local/bin/musopen b/dot/local/bin/musopen new file mode 100644 index 0000000..9f3f253 --- /dev/null +++ b/dot/local/bin/musopen | |||
@@ -0,0 +1,16 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | CAPTURE= | ||
4 | JSON=$(curl -s https://musopen.org/radio/next/) | ||
5 | |||
6 | for v in url piece piece_url; do | ||
7 | eval $v='$(printf %s "$JSON" | jq -r .'$v')' | ||
8 | done | ||
9 | |||
10 | printf '%s (%s)\n' "$piece" "$piece_url" | ||
11 | filename=${piece_url%/}.mp3 | ||
12 | filename=${filename##*/} | ||
13 | |||
14 | [ "$CAPTURE" ] || filename= | ||
15 | |||
16 | exec mpv "$url" ${filename+ --stream-capture="$filename"} | ||