Skip to Content.
Sympa Menu

baslinux - Re: [BL] MPlayer

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: Stephen Clement <s.clement AT sympatico.ca>
  • To: baslinux AT lists.ibiblio.org
  • Subject: Re: [BL] MPlayer
  • Date: Tue, 10 May 2005 00:30:31 -0400

sindi keesan wrote:


#!/bin/sh
wget -q $1 -O /tmp/urlfile && sed -e 's/http:\/\//WORKShttp:\/\//g' -e 's/rstp:\/\//WORKSrstp:\/\//g' -e 's/pnm:\/\//^WORKSpnm:\/\//g' /tmp/urlfile |grep WORKS |sed -e 's/WORKS//g'

With this it will automatically fetch the file and search out the URL's. Getting it to automatically play is beyond the use of this script, however.


Both URLs? How do I use this script, by typing the name of the script and what else? When I am searching for new stations, I run across .pls or .m3u files - should I set up the browser to feed them to this script? Then feed the output to my mplay script? Using ; or a pipe?

You would use the script like so:

script_name http://www.randomwebsite.com/thisisanm3ufile.m3u



There may be other URL formats besides pnm and rstp and http - ftp? Could it look for the first (or maybe the last) string with :// and cut off
the first space before that string and preceding characters, and the space after that string and following characters? These strings all seem to be ???:/ or ????://


I'm not understanding what you're asking...do you want this:

Random junk in .pls files...
File1=http://www.radiostation.com/play.mp3
Random junk in .pls files...

Do you want that to become just the URL of the file?



Yes, except the URLS are not all http rstp or pnm, I have seen other formats used by realaudio or wmp, and I have not yet even looked at an ogg URL. They all seem to be three or four letters followed by '://'

I don't know how sed works - what is s/ or g/ or WORKS? (I should read about all this but there is too much other exciting stuff to keep up with).

Basically, s/ tells it we're going into replace mode. /g says to do that for all of them instead of just the first one it encounters.


The other problem is that sometimes there are two URLS, the first of which is a short intro sometimes asking for donations, the second the actual broadcast, so it would need to clip out the second URL.

I'll attempt at fixing this.



The URL ends up as /tmp/urlfile? I don't know how I would incorporate this in a browser but I will experiment.


You have to copy the URL as an option to the script.


I don't follow 'copy as an option'. Do I click on the .pls or .m3u or .asf link somehow? Or copy it all to a file and run the file through your script?

Use like so:

scriptname http://www.website.com/radio.m3u



I will try to hear the difference once I find a 20K OGG broadcast.
All the formats I have tried sound infinitely better than listening to radio broadcasts from 60-75 miles away, even at 20K, though this is supposed to be less than FM quality I think (is that 64K?).



Yes, FM quality is supposedly 64K. Also, I will say too that I find OGG to be superior.


I have created a new version of my script, it is pasted below:

#!/bin/sh
wget $1 -O /tmp/urlfile && sed -e 's/http:\/\//WORKShttp:\/\//g' -e 's/rstp:\/\//WORKSrstp:\/\//g' -e 's/pnm:\/\//^WORKSpnm:\/\//g' /tmp/urlfile |grep WORKS |sed -e 's/^/BLAH/g' -e 's/BLAH.*WORKS/WORKS/g' |sed -e 's/WORKS//g'

Note that my mail client might at some newlines.

This updated version removes any garbage before the URL. Any other requests for things you would like this to do?

Also, in order to add a new protocol, in the second section (right after the '&& sed -e) copy and paste the -e and a part in quotes and change the protocol to the one you please to make it support recognizing more protocols.

Thanks,

Stephen Clement




Archive powered by MHonArc 2.6.24.

Top of Page