pnm strip player help

pnm strip player help

am 21.02.2007 15:02:47 von ByronDallas

Begging your pardon, :) but I sure could use a little help. I have a
script here that was given to me by a friend of a friend :) And the
middle person knows just as much as I do about cgi/perl, which is
nothing. I know just enough to make this script work at my server (after
several, and I mean several attempts) But whether it is scripted
correctly, I don't know. What I mean, where a line ends and a new line
begins. I do know that a semi-colon ends the line. And can you tell me
the reason for these

||

Some I removed and a couple HAD to stay in. Does that sound correct?

Any help sure would be appreciated.

#!/usr/bin/perl -w
# name script 'pnm.pl'
use CGI;
my $q = new CGI;
my $Song = $q->param('song')
|| '';if ($Song eq '') {print "Content-type: text/||html\n\n";
print qq~PNM ||Launcher name="f" id="f" ||method="post" action="pnm.pl">URL name="song" id="song" value="" ||size="50" maxlength="300"
/> ||~;}else {chomp($Song);print "Content-type:
||audio/x-pn-realaudio-plugin\n\n";print("$Song\n");}

Re: pnm strip player help

am 21.02.2007 19:17:05 von Joe Smith

Byron wrote:
> I don't know. What I mean, where a line ends and a new line
> begins. I do know that a semi-colon ends the line. And can you tell me
> the reason for these
>
> ||
>
> Some I removed and a couple HAD to stay in. Does that sound correct?
>
> Any help sure would be appreciated.

my $Song = $some_variable || ''; # Set $Song to '' if not otherwise defined.

> #!/usr/bin/perl -w
> # name script 'pnm.pl'
> use CGI;
> my $q = new CGI;
> my $Song = $q->param('song')
> || '';if ($Song eq '') {print "Content-type: text/||html\n\n";
> print qq~PNM ||Launcher > name="f" id="f" ||method="post" action="pnm.pl">URL > name="song" id="song" value="" ||size="50" maxlength="300"
> /> ||~;}else {chomp($Song);print "Content-type:
> ||audio/x-pn-realaudio-plugin\n\n";print("$Song\n");}

Get rid of all the other instances of || and start a new line after each ; .
The last statement {print("$Song\n");} doesn't really do anything.

-Joe

Re: pnm strip player help

am 21.02.2007 22:21:49 von ByronDallas

He Joe, I think this is the changes you wanted me to do. I tried making
the changes but I kept getting errors. I'm sure it was a coding error on
my part.

>#!/usr/bin/perl -w
>use CGI::Carp qw(fatalsToBrowser);
># name script 'pnm2.pl'
>use CGI;
>my $q =3D new CGI;
>my $Song =3D $some_variable || ''; =A0
># Set $Song to '' if not otherwise defined.
>if ($Song '')

I had to leave this print in from the bottom:

print("$Song\n");

or I would loose my form url after I clicked onto it.

And if I removed these || from the
|| method=3D"post"

I loose the encrypted song url that the server generates.

I think you'll understand better with what is going on with an example.

This is how I have it coded now. And it seems to be working ok. Please
correct me on any mistakes if there wrong.

http://www.byrondallas.p4h.biz/test/pnm2.txt

This is the tool:

http://www.byrondallas.p4h.biz/test/pnm2.pl

If you will paste the strip below into the tool and click onto it, you
will be able to get the encrypted clickable url. I click "Show Last" on
webtv. It also allows me to time the song from an archive list. Just
click off the form and then back up to change the time settings.

rtsp://archive.wfmu.org/archive/GK/gk041218.rm?start=3D"01:5 5:18"&end=3D"0=
1:57:52"

I don't know if the code is correct, I just know that's what I had to do
to get the tool to perform. Do you see any problems with this? and if so
please correct me. :) I wasn't sure about these || and was worried about
deleting some and leaving some.

Thanks Joe!

Re: pnm strip player help

am 22.02.2007 07:11:42 von Joe Smith

Byron wrote:

> I removed these || from the
> || method="post"
> I loose the encrypted song url that the server generates.

The || there is wrong. It should be either


or

and it sounds like the latter is what you don't want.

> I had to leave this print in from the bottom:
> print("$Song\n");
> or I would loose my form url after I clicked onto it.

Well, "print "DarkSideOfTheMoon.mp3\n" won't do anything.

> rtsp://archive.wfmu.org/archive/GK/gk041218.rm?start="01:55: 18"&end="01:57:52"

Oh, that's different.

> Content-type: audio/x-pn-realaudio-plugin

Sorry, I can't help you with that.
-Joe

Re: pnm strip player help

am 22.02.2007 14:05:02 von ByronDallas

Joe wrote:

>The || there is wrong. It should be either =A0
>
>or
>  
>and it sounds like the latter is what you don't
>want.

Thanks Joe, this is how the line looks now and it seems to be working
fine.



http://byrondallas.p4h.biz/test/pnm3.pl

And it generates the incrypted url for me.

rtsp://archive.wfmu.org/archive/SO/so021110.rm?start=3D"1:32 :21"&end=3D"1:=
35:21"

http://byrondallas.p4h.biz/test/pnm2.pl?song=3Drtsp%3A%2F%2F archive.wfmu.o=
rg%2Farchive%2FSO%2Fso021110.rm%3Fstart%3D%221%3A32%3A21%22% 26end%3D%221%3=
A35%3A21%22

Now I'll see what I can do about the print line.

Re: pnm strip player help

am 22.02.2007 14:53:20 von ByronDallas

I'm sorry Joe, I meant the line is like this: (uppercase)

Re: pnm strip player help

am 22.02.2007 15:42:00 von ByronDallas

Hey Joe, the bottom line on pnm4 reads like this after removing
print("$Song\n");

print "Content-type: audio/x-pn-realaudio-plugin\n\n";
}

This is the player without the print line.
http://www.byrondallas.p4h.biz/test/pnm4.pl

I'm not sure if your on a computer or WebTV. But on WebTV when I copy
this strip into the form and click it, it seems to play the strip and
even gives me the encrypted url, but I can't hear anything.

rtsp://archive.wfmu.org/archive/SO/so021110.rm?start="1:32:2 1"&end="1:35:21"

It may just be a WebTV thing???

and the line:
"Content-type: audio/x-pn-realaudio-plugin\n\n";
}

is the the type of audio plugin WebTV uses. Which you probably guessed
it anyway. :)

Re: pnm strip player help

am 23.02.2007 16:19:20 von ByronDallas

Hey Joe, I really appreciate all the help you've given me. I don't know
if your into Pink Floyd or not, but you did make mention of them, so
here ya go.

http://www.byrondallas.p4h.biz/audio/rams/Pink-Floyd_The-Wal l_Side-2.ram