-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: music
action: commit
revision:
path_from:
revision_from: b2fc25e9124943c98b67d38ecd42402804e88786:
path_to:
revision_to:

git.thebackupbox.net

music

git://git.thebackupbox.net/music

commit b2fc25e9124943c98b67d38ecd42402804e88786
Author: epoch <epoch@hacking.allowed.org>
Date:   Mon Dec 30 18:22:30 2019 -0600

    added a couple more things to the Make install target. finally added the script I have been using to scrape X11 window titles and set them as the now-playing info. was using -e instead of -c for music-radio trying to run music-stream for some dumb reason. music-stream now logs remote IP and port

diff --git a/Makefile b/Makefile

index 394619c261c67f3ed8d9ba2d13131d23ad31aa2e..

index ..2af5d36e9e49fd06f333a02b706b6d74b2d9f27d 100644

--- a/Makefile
+++ b/Makefile
@@ -34,3 +34,5 @@ install: all
 	install music-stream-mp3 $(PREFIX)/bin/
 	install pad $(PREFIX)/bin/
 	install music-listeners $(PREFIX)/bin/
+	install music-getplaying $(PREFIX)/bin/
+	install music-setnowplaying-xwintitle $(PREFIX)/bin/
diff --git a/music-radio b/music-radio

index 0959c9187f6c6447a8bb072459ffac9b3aa34f87..

index ..66e715877346df61a4cc0365dbfec99e9a415f36 100755

--- a/music-radio
+++ b/music-radio
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+set -o pipefail
 lsmod | grep snd_aloop > /dev/null || sudo modprobe snd_aloop
 logger -p info -n logserver "RADIO IS NOW ON. http://$(domainname):8901/"
-exec ncat -vklp 8901 -e music-stream
+exec ncat -vklp 8901 -c music-stream
diff --git a/music-setnowplaying-xwintitle b/music-setnowplaying-xwintitle
new file mode 100755
index 0000000000000000000000000000000000000000..51972655152e17c9227756023def4a80a5451b5e
--- /dev/null
+++ b/music-setnowplaying-xwintitle
@@ -0,0 +1,13 @@
+#!/bin/sh
+wid="$(xwininfo | grep ^xwin | tail -n1 | cut '-d ' -f4)"
+if [ ! "$wid" ];then
+  exit 1
+fi
+while xdotool getwindowname "$wid";do
+  sleep 1
+done \
+  | stdbuf -oL sed 's/[ -]*Mozilla Firefox$//g' \
+  | stdbuf -oL grep '..' \
+  | stdbuf -oL uniq \
+  | stdbuf -o0 tr '\n' '\0' \
+  | xargs -n1 -0 music-setnowplaying
diff --git a/music-stream b/music-stream

index c0699e64a64baec88a0aa487feefaddb9f6ef41d..

index ..895da496e71ce9557e85be651d240fe72f40621c 100755

--- a/music-stream
+++ b/music-stream
@@ -1,5 +1,6 @@
 #!/bin/bash
-logger -p info -n logserver "new listener!"
+set -o pipefail
+logger -p info -n logserver "new listener! ${NCAT_REMOTE_ADDR}:${NCAT_REMOTE_PORT}"
 icy_metaint=65536
 while read -t 2 LINE;do
   printf "%s\n" "$LINE"
@@ -17,4 +18,4 @@ else
   stdbuf -o0 pacat --record -d alsa_output.pci-0000_00_07.0.analog-stereo.monitor --format=s16le \
     | stdbuf -o0 oggenc - -r -C 2 -R 44100 -q 2
 fi
-logger -p info -n logserver "a listener dropped out. :("
+logger -p info -n logserver "a listener dropped out. :( ${NCAT_REMOTE_ADDR}:${NCAT_REMOTE_PORT}"

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

-- Response ended

-- Page fetched on Sun Jun 2 19:00:05 2024