repo: music
action: commit
revision: 
path_from: 
revision_from: 7d7440fe0a7fcf769ff429945b380e341d41dc8f:
path_to: 
revision_to: 
git.thebackupbox.net
music
git clone git://git.thebackupbox.net/music
commit 7d7440fe0a7fcf769ff429945b380e341d41dc8f
Author: epoch 
Date:   Tue Dec 17 02:30:49 2019 -0600

    changed all the logger calls to set the priority too so each type of message can be handled differently logserver-side. did git -A and grabbed all the mpd compat stuff too. very WIP.

diff --git a/.gitignore b/.gitignore
index 4c205008613d0817a662f39b5f500df5f97d960c..
index ..cfe7a4f03678369a2b3890f3d8157a084a074788 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 qargs
+pad
diff --git a/mpd/cache/command_list_ok_output b/mpd/cache/command_list_ok_output
new file mode 100644
index 0000000000000000000000000000000000000000..34af105392ea60d1ec6b092c92d8dbcc9b65c6b0
--- /dev/null
+++ b/mpd/cache/command_list_ok_output
@@ -0,0 +1,8 @@
+volume: 0
+OK
+list_OK
+song: derp
+songid: 0
+OK
+list_OK
+list_OK
diff --git a/mpd/currentsong b/mpd/currentsong
new file mode 100755
index 0000000000000000000000000000000000000000..88f19dd4278e4286405f23377110aa82ff532cae
--- /dev/null
+++ b/mpd/currentsong
@@ -0,0 +1,12 @@
+#!/bin/sh
+echo 'Pos: 0'
+echo 'Id: 0'
+echo 'Prio: 0'
+#echo 'file: http://swagjukebox.tk/' #$(music-nowplaying)
+echo 'file:' "$(music-nowplaying)"
+echo 'time: 0'
+echo 'duration: 0'
+echo 'title: kek'
+echo 'song: derp'
+echo 'songid: 0'
+echo 'artist: kek'
diff --git a/mpd/mpd.sh b/mpd/mpd.sh
new file mode 100755
index 0000000000000000000000000000000000000000..03c78c64849a12e8d51936dd41ac5566b5edf3f2
--- /dev/null
+++ b/mpd/mpd.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+echo 'OK MPD 0.19'
+while read line;do
+  echo 'got: ' "$line" >&2
+  if [ "$line" = "command_list_ok_begin" ];then
+    > ./cache/command_list_output
+    continue
+  elif [ "$line" = "command_list_end" ];then
+    cat ./cache/command_list_output
+    rm ./cache/command_list_output
+    echo list_OK
+    continue
+  fi
+  if [ -f ./cache/command_list_output ];then
+    ./$line >> ./cache/command_list_output
+    echo list_OK >> ./cache/command_list_output
+  else
+    ./$line
+    echo OK
+  fi
+done
+#tail -f >&2
diff --git a/mpd/next b/mpd/next
new file mode 100755
index 0000000000000000000000000000000000000000..38e7c8a3e0d682f252080de5ced190211a988a88
--- /dev/null
+++ b/mpd/next
@@ -0,0 +1,2 @@
+#!/bin/sh
+music-next
diff --git a/mpd/pause b/mpd/pause
new file mode 100755
index 0000000000000000000000000000000000000000..8ac7c830236c2065efa74155c412a328ca9d3489
--- /dev/null
+++ b/mpd/pause
@@ -0,0 +1,7 @@
+#!/bin/sh
+if [ $1 = 0 ];then
+  music-pause
+fi
+if [ $1 = 1 ];then
+  music-unpause
+fi
diff --git a/mpd/play b/mpd/play
new file mode 100755
index 0000000000000000000000000000000000000000..8de877f8f33a03d60c5d40145672ea07b18348ac
--- /dev/null
+++ b/mpd/play
@@ -0,0 +1,2 @@
+#!/bin/sh
+music-play
diff --git a/mpd/previous b/mpd/previous
new file mode 100755
index 0000000000000000000000000000000000000000..bd67af4035a32cb4c2e6e3556a563fd46982d62b
--- /dev/null
+++ b/mpd/previous
@@ -0,0 +1,2 @@
+#!/bin/sh
+music-prev
diff --git a/mpd/stats b/mpd/stats
new file mode 100755
index 0000000000000000000000000000000000000000..cdb2c1f627f4738a3bc6f2a48baeecc32e86b884
--- /dev/null
+++ b/mpd/stats
@@ -0,0 +1,8 @@
+#!/bin/sh
+echo artists: 666
+echo albums: 123
+echo songs: -5
+echo uptime: 1000 years
+echo db_playtime: 2 seconds
+echo db_update: 0
+echo playtime: 6
diff --git a/mpd/status b/mpd/status
new file mode 100755
index 0000000000000000000000000000000000000000..47ce0a40d99fba2b2eeba57f7f66f6664897b64f
--- /dev/null
+++ b/mpd/status
@@ -0,0 +1,7 @@
+#!/bin/sh
+echo volume: -1
+echo state: $(./status-state)
+echo repeat: 0
+echo random: 1
+echo single: 0
+echo consume: 0
diff --git a/mpd/status-state b/mpd/status-state
new file mode 100755
index 0000000000000000000000000000000000000000..ff5471a8f6ec3c979c127131abadf9fb3924cecb
--- /dev/null
+++ b/mpd/status-state
@@ -0,0 +1,13 @@
+#!/bin/bash
+pid="$(cat "${PREFIX}/var/run/music-player.pid")"
+state="$(ps -o state= -p "$pid")"
+if [ "$state" ];then
+  if [ "$state" = "T" ];then #it is stopped. let's send it a CONT
+    echo 'pause'
+  fi
+  if [ "$state" = "S" ];then #it is running, let's pause it.
+    echo 'play'
+  fi
+else
+  echo 'stop'
+fi
diff --git a/mpd/talk.sh b/mpd/talk.sh
new file mode 100755
index 0000000000000000000000000000000000000000..cf67889a54cfcae815d09148436ac360894c148a
--- /dev/null
+++ b/mpd/talk.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+while read line;do
+  echo $line | festival --tts --batch
+done
diff --git a/music-next b/music-next
index 507851c60b2468bd910ebc2fcead9e8c8714e0b0..
index ..111b068caa053f774c78a2469fadf8dc3cc9dfca 100755
--- a/music-next
+++ b/music-next
@@ -1,3 +1,3 @@
 #!/bin/sh
-logger -n logserver "music next'd"
+logger -p info -n logserver "music next'd"
 exec kill -USR2 "$(cat ${PREFIX}/var/run/music-init.pid)"
diff --git a/music-pause b/music-pause
index 42b0d14c200b41d666988a79e34e0b14350452fd..
index ..1e8425f126323837f2fae5059fd5710fd7c1a6f8 100755
--- a/music-pause
+++ b/music-pause
@@ -1,4 +1,4 @@
 #!/bin/sh
 #exec pkill -STOP mpv
-logger -n logserver 'music paused'
+logger -p info -n logserver 'music paused'
 exec kill -STOP $(cat ${PREFIX}/var/run/music-player.pid)
diff --git a/music-playlist b/music-playlist
index 9a4d9a462f8473cad28492c3fdf43ae529d71f1a..
index ..7e37d09458d077d2ece12bc6b8c12b3b90e24e42 100755
--- a/music-playlist
+++ b/music-playlist
@@ -15,4 +15,4 @@ fi
 export "QARGS_CHILD_PIDFILE=${PREFIX}/var/run/music-player.pid"
 qargs music-player > $music_init_pid
 rm ${PREFIX}/var/cache/music-nowplaying.txt
-logger -n logserver 'ran out of music to play'
+logger -p notice -n logserver 'ran out of music to play'
diff --git a/music-prev b/music-prev
index 244c7cd998c3291640682d824723bd53e04c32ce..
index ..0085de629a5b21e409947a2ce3077ed3e8f0c03b 100755
--- a/music-prev
+++ b/music-prev
@@ -1,3 +1,3 @@
 #!/bin/sh
-logger -n logserver "music prev'd"
+logger -p info -n logserver "music prev'd"
 exec kill -USR1 "$(cat ${PREFIX}/var/run/music-init.pid)"
diff --git a/music-radio b/music-radio
index 77dea0ad271b708223fdb04f05b8a7cc99244f20..
index ..0959c9187f6c6447a8bb072459ffac9b3aa34f87 100755
--- a/music-radio
+++ b/music-radio
@@ -1,4 +1,4 @@
 #!/bin/sh
 lsmod | grep snd_aloop > /dev/null || sudo modprobe snd_aloop
-logger -n logserver "RADIO IS NOW ON. http://$(domainname):8901/"
+logger -p info -n logserver "RADIO IS NOW ON. http://$(domainname):8901/"
 exec ncat -vklp 8901 -e music-stream
diff --git a/music-setnowplaying b/music-setnowplaying
index 7ecf0ff6cf2df8711e0188c9219b4fcd1bb3e429..
index ..d9fee94a2c85ceab7abb061f949613d39fa60992 100755
--- a/music-setnowplaying
+++ b/music-setnowplaying
@@ -1,3 +1,3 @@
 #!/bin/sh
-logger -n logserver "$1"
+logger -p notice -n logserver "$1"
 printf "%s\n" "$1" > ${PREFIX}/var/cache/music-nowplaying.txt
diff --git a/music-stream b/music-stream
index 55c85b95c63c5c9cd429ce0225ee8c57a85a900a..
index ..c0699e64a64baec88a0aa487feefaddb9f6ef41d 100755
--- a/music-stream
+++ b/music-stream
@@ -1,4 +1,5 @@
 #!/bin/bash
+logger -p info -n logserver "new listener!"
 icy_metaint=65536
 while read -t 2 LINE;do
   printf "%s\n" "$LINE"
@@ -16,3 +17,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. :("
diff --git a/music-unpause b/music-unpause
index cf502d68fcc11de7407790303095ea077ebddf45..
index ..7aedb2eae39a5b7df153751b3d794eacc836c35d 100755
--- a/music-unpause
+++ b/music-unpause
@@ -1,4 +1,4 @@
 #!/bin/sh
 #exec pkill -CONT mpv
-logger -n logserver 'music unpaused'
+logger -p info -n logserver 'music unpaused'
 exec kill -CONT $(cat ${PREFIX}/var/run/music-player.pid)

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