Song Change: writing to directly to file instead of running a command
Added by Richard Turner over 3 years ago
This is probably specific to Linux and I am adding it here as it's not a general Audacious message.
Rather than launch a command/script for every single song change, I've been trying to launch a single background script to listen to a named pipe. Audacious/Song Change would then write certain variables to the pipe which the background task would then read, format, and send off to a log file.
But... I've not come up with a way to get Song Change to accept something like, say, "echo '%a - %b - %T' > named-pipe" that actually sends anything to the pipe.
Is this currently possible?
TIA...
Replies (1)
RE: Song Change: writing to directly to file instead of running a command - Added by Jim Turner over 3 years ago
Hi Richard,
I just tried this (using the command: echo "%T by %a" >>/tmp/testpipe) on Linux and it works just as I'd expect! However, in order to get anything written to a named pipe, you'll first need to have your "reader" program running and waiting on the pipe for data to come in! Also note the double-'>'s (>>) in order to append each song output as it changes!
Here's a sample "reader" script:
#!/bin/bash pipe=/tmp/testpipe trap "rm -f $pipe" EXIT if [[ ! -p $pipe ]]; then mkfifo $pipe fi while true do if read line <$pipe; then if [[ "$line" == 'quit' ]]; then break fi echo $line fi done echo "Reader exiting"
Hope this helps!
Jim