aboutsummaryrefslogtreecommitdiff
path: root/create_static_list.sh
diff options
context:
space:
mode:
Diffstat (limited to 'create_static_list.sh')
-rwxr-xr-xcreate_static_list.sh59
1 files changed, 59 insertions, 0 deletions
diff --git a/create_static_list.sh b/create_static_list.sh
new file mode 100755
index 0000000..059eabd
--- /dev/null
+++ b/create_static_list.sh
@@ -0,0 +1,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