album.dcgi - gophercgis - Collection of gopher CGI/DCGI for geomyidae
(HTM) hg clone https://bitbucket.org/iamleot/gophercgis
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
album.dcgi
---
1 #!/bin/sh
2
3 . ../common/config.sh
4
5 ALBUM_CGI="${CGI_BASEDIR}/bandcamp/album.dcgi"
6
7
8 extract_json()
9 {
10 awk '
11 /trackinfo:/ {
12 sub(/^[[:space:]]*trackinfo:[[:space:]]*/, "");
13 sub(/,$/, "");
14 print
15 }
16 '
17 }
18
19 url="$2"
20
21
22 echo "t"
23 echo "tBandcamp"
24 echo "t"
25
26 echo "[h|URL|${url}|server|port]"
27 echo "t"
28
29 curl -Lgs -- "${url}" |
30 extract_json |
31 jq -r '
32 .[] |
33 "[h|" + (.track_num | tostring) + " - " + (.title | gsub("\\|"; "\\|")) + "|" +
34 "URL:\(.file."mp3-128" | gsub("\\|"; "\\|"))" + "|server|port]"
35 '