repo: music
action: commit
revision: 
path_from: 
revision_from: 17332b75d8a01f29eef22f8c5959baa0b9b9b12d:
path_to: 
revision_to: 
git.thebackupbox.net
music
git clone git://git.thebackupbox.net/music
commit 17332b75d8a01f29eef22f8c5959baa0b9b9b12d
Author: epoch 
Date:   Thu Jul 30 08:19:09 2020 -0500

    added an HTTP header you can pass to get the album art sent with the icy-title as sixels

diff --git a/music-stream b/music-stream
index a3a218c3df5acf9f0e7274574afce8014bc66c4a..
index ..5c55e279a5e04d4941ec4dded8c27c87b62e92e0 100755
--- a/music-stream
+++ b/music-stream
@@ -3,9 +3,19 @@ set -eo pipefail
 logger -p info -n logserver "new listener! ${NCAT_REMOTE_ADDR}:${NCAT_REMOTE_PORT}"
 icy_metaint=16384
 while read -t 2 LINE;do
-  printf "%s\n" "$LINE"
-done \
-  | if stdbuf -oL grep -i "Icy-Metadata:" | stdbuf -oL cut -d: -f2- | stdbuf -oL grep 1 >/dev/null;then
+#  printf "%s\n" "$LINE"
+  if printf "%s\n" "$LINE" | grep -i "^Icy-Metadata: " | cut -d: -f2- | grep 1 >/dev/null;then
+    export want_icy=1
+  fi
+  if printf "%s\n" "$LINE" | grep -i "^Sixel-Albumart: " | cut -d: -f2- | grep 1 >/dev/null;then
+    export want_six=1
+  fi
+  if [ "$LINE" = $'\r' ];then
+    break
+  fi
+done
+
+if [ "$want_icy" = "1" ];then
   printf "HTTP/1.1 200 OK\r\n"
   printf "icy-metaint: %s\r\n" "${icy_metaint}"
   printf "Content-Type: audio/ogg\r\n\r\n"

-----END OF PAGE-----