blob: 059eabd9f217a947fe291e0a250ea8f0983632c4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#!/bin/bash
cat >&1 <<EOF
<!DOCTYPE>
<html>
<head>
<title>Title</title>
</head>
<body>
<h1>Radio index</h1>
EOF
echo '<h2>Lists</h2><ul>'
find hashes -type f | while read filepath
do
hash_string="$(basename ${filepath})"
file ${filepath} | grep 'JSON text data' > /dev/null 2>&1
if [ $? -eq 0 ]
then
if [ "$(cat ${filepath} | jq -r '.type')" == "list" ]
then
echo '<li><a href="http://z.kaotisk-hund.com:8010/v0/application/json/'${hash_string}'">'${hash_string}'</a></li>'
fi
fi
done
echo '</ul>'
echo '<h2>Shows</h2><ul>'
find hashes -type f | while read filepath
do
hash_string="$(basename ${filepath})"
file ${filepath} | grep 'JSON text data' > /dev/null 2>&1
if [ $? -eq 0 ]
then
if [ "$(cat ${filepath} | jq -r '.type')" == "show" ]
then
echo '<li><a href="http://z.kaotisk-hund.com:8010/v0/application/json/'${hash_string}'">'${hash_string}'</a></li>'
fi
continue
fi
done
echo '</ul>'
echo '<h2>audio/ogg</h2><ul>'
find hashes -type f | while read filepath
do
hash_string="$(basename ${filepath})"
file ${filepath} | grep 'Ogg data, Vorbis audio' > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo '<li><a href="http://z.kaotisk-hund.com:8010/v0/audio/ogg/'${hash_string}'">'${hash_string}'</a></li>'
continue
fi
done
echo '</ul>'
cat >&1 <<EOF
</body>
</html>
EOF
|