View previous topic :: View next topic |
Author |
Message |
Guest
|
Posted: Thu Dec 01, 2005 7:56 pm Post subject: how to filter metadata |
|
|
hello,
i have a one-line player
echo "GET / HTTP/1.0\n\n" | netcat localhost 8888 | sox -t mp3 - -t ossdsp /dev/dsp
which works very fine, but how i can filter (grep) metadata off the stream?
please think simple, thanks.
sorry for my bad english.
greetings from germany,
terx |
|
Back to top |
|
|
karlH Code Warrior
Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Thu Dec 01, 2005 8:33 pm Post subject: |
|
|
With that you won't get an MP3 metadata as you haven't requested any, what you can do with 2.3.x is use a stats client, a simple example is
curl -X STATS http://admin:hackme@host:8000/
Just filter for the stats relating to the mountpoint. You'll be able to use netcat in a similar way if need be.
karl. |
|
Back to top |
|
|
Guest
|
Posted: Thu Dec 01, 2005 9:00 pm Post subject: |
|
|
> With that you won't get an MP3 metadata as you haven't requested any
how can i request this? is there any documentation, rfc, or something else?
terx |
|
Back to top |
|
|
Guest
|
Posted: Thu Dec 01, 2005 9:34 pm Post subject: |
|
|
here, i wrote a small perl script (getmeta.pl):
#!/usr/bin/perl -w
$|=1;
while (<STDIN>) {
print;
if ($_ =~ /StreamTitle='([^\']+)';/) {
print STDERR ((scalar localtime time) . " $1\n");
}
}
that filter the metadata off the stream and write them to stderr (with a time stamp). stdin is directly forwarded to stdout.
the new command:
echo "GET / HTTP/1.0\nIcy-MetaData:1\n\n" | netcat localhost 8000 | ./getmeta.pl | sox -t mp3 - -t ossdsp /dev/dsp
or with ripping
echo "GET / HTTP/1.0\nIcy-MetaData:1\n\n" | netcat localhost 8000 | ./getmeta.pl | sox -t mp3 - -t ogg - | tee streamrip.ogg | sox -t ogg - -t ossdsp /dev/dsp
and without filtering metadata
echo "GET / HTTP/1.0\n\n" | netcat localhost 8000 | sox -t mp3 - -t ogg - | tee streamrip.ogg | sox -t ogg - -t ossdsp /dev/dsp
and all of them works fine! (please ignore any error messages from sox.) |
|
Back to top |
|
|
Guest
|
Posted: Thu Dec 01, 2005 9:36 pm Post subject: |
|
|
all (c) by terx, tux@nemero.com and the perl script is free and open (gpl) |
|
Back to top |
|
|
|