aboutsummaryrefslogtreecommitdiff
path: root/create_static_list.sh
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-10-10 07:42:13 +0300
committerkaotisk <kaotisk@arching-kaos.org>2024-10-10 07:42:13 +0300
commit8281be7ba874e116ccc43e41d1275c1d531c54dc (patch)
tree9f2495682205807db74842674b4bedfbc27b0daf /create_static_list.sh
parent3c508f9bf96bc425eb183f676214ed9b9d14b84e (diff)
downloadarching-kaos-radio-8281be7ba874e116ccc43e41d1275c1d531c54dc.tar.gz
arching-kaos-radio-8281be7ba874e116ccc43e41d1275c1d531c54dc.tar.bz2
arching-kaos-radio-8281be7ba874e116ccc43e41d1275c1d531c54dc.zip
Implementation
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