PDA

View Full Version : PNM Player Script (request)


Jinxy
02-21-2007, 05:47 AM
Can anybody tell me where I can find a script for a pnm player like these two:

http://www.expandinghead.net/tool/pnm.pl

http://msnaudio.netfirms.com/cgi-bin/pnm.cgi

These tools allow me to time a ram strip like this here, and also adds a start tag and some sort of encryption to the strip. Just place the strip inside the tool and you will see what I mean.

rtsp://archive.wfmu.org/archive/HK/hk060901.rm?start="0:15:08"&end="0:18:00"

Thanks

rwedge
02-24-2007, 02:26 AM
It amounts to sending the realaudio header and location of the ram file to the terminal#!/usr/bin/perl
use CGI;
my $q = new CGI;
my $Song = $q->param('song') || '';

if ($Song eq '') {
print "Content-type: text/html\n\n";
print qq~
<html>
<head>
<title>PNM Launcher</title>
</head>
<body>
<form name="f" method="get">
<input type="text" name="song" value="" size="50" maxlength="300">
</form>
</body>
</html>
~;
}
else {
chomp($Song);
print "Content-type: audio/x-pn-realaudio-plugin\n\n";
print"$Song\n";
}

Jinxy
02-24-2007, 05:10 PM
Thanks rwedge, I tried that script on a page but when I copied the strip into the form, it didn't quite work. Am I missing something?

rwedge
02-24-2007, 07:34 PM
try <form name="f" method="get" action="scriptname.pl">where scriptname.pl is the name you give the perl script. It's been awhile since I have used webtv.

Jinxy
02-24-2007, 10:15 PM
Hey rwedge, this is what I've got so far. When I copy the strip into the form and click on it, the url disappears and it gives me the encrypted url (in my "Show Last") but I can't hear anything and nothing is playing in my status bar.

#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
use CGI;
my $q = new CGI;
my $Song;
$q->param('song') || '';
if ($Song eq '') {
print "Content-type: text/html\n\n";
print qq~
<html>
<head>
<title>PNM Launcher</title>
</head>
<body>
<form name="f" method="GET" action="pnm.pl">
<input type="text" name="song" value="" size="50" maxlength="300">
</form>
</body>
</html> ~;
}
else { chomp($Song);
print "Content-type: audio/x-pn-realaudio-plugin\n\n"; print"$Song\n";
}

rwedge
02-24-2007, 11:25 PM
my $Song = $q->param('song') || '';

Jinxy
02-25-2007, 03:09 AM
Thanks man!!!

http://alpha1omega.uni.cc/pnmy.pl

rwedge
02-25-2007, 04:13 AM
You are welcome!

Jinxy
03-03-2007, 06:37 PM
Hey rwedge, I hope you don't mind me asking you a few more questions? I found this player script awhile back doing a search and I thought it wasn't any good.

http://alpha1omega.uni.cc/pnms.txt

Each time I transloaded the script to my server and then clicked onto the file, I never saw a form to paste a strip into. So I discarded the file. But the other day I was searching for scripts and I seem to remember looking at a cgi file that was just a blank page. So I transloaed the script again and linked to it from an html page and it worked fine. This is the cgi file here:

http://alpha1omega.uni.cc/pnms.pl

This is the html page that links to the player.

http://alpha1omega.uni.cc/pnm_html.html

Is the script above doing anything different than your script and is it necassary to have a form on my other cgi scripts or can I create a blank page like the script above and link to them? Or LOL does that script just have a coding error?

Thanks

rwedge
03-03-2007, 11:57 PM
The script is basically the same as I posted. It uses a drawn out method to "print", "if if" instead of "if else" and nothing is done to check the input, like "chomp". All in all it is not written very well.

Both scripts will accept requests from outside sources.

Jinxy
03-04-2007, 12:13 AM
Thanks again rwedge! I guess that's what I needed to hear, that yours was the best. :)