Tilted Forum Project Discussion Community

Tilted Forum Project Discussion Community (https://thetfp.com/tfp/)
-   Tilted Technology (https://thetfp.com/tfp/tilted-technology/)
-   -   [Perl] [Linux] Mplayer Webradio script (https://thetfp.com/tfp/tilted-technology/91934-perl-linux-mplayer-webradio-script.html)

keyshawn 07-13-2005 05:46 PM

[Perl] [Linux] Mplayer Webradio script
 
Hey,

I found this script


online to simply play your favorite web radio stations
Code:

#!/usr/bin/perl -w
 
 #NOTE: "mplay woxy" plays the woxy stream quickly and
#without a browser. If you need your terminal, "q" stops the stream, do
#your deed, and up arrow gets the stream right back (or of course Ctrl+
#Shift+T for a new tab in gnome-terminal).
 
        # mplay.pl -
        # command line streaming of your fav stations
        # usage: mplay <channel>
 
        use strict;
 
        help() unless defined(my $chan = shift);
 
        if ($chan =~ /woxy/) {
                system("mplayer http://woxy.com/stream/mpg64.pls");
        }
        elsif ($chan =~ /wjcu/) {
                system("mplayer http://streaming.jcu.edu:8000/listen.pls");
        }
        elsif ($chan =~ /case/) {
                system("mplayer http://129.22.71.14/cgi-bin/swsend/tmp/wruw128k.mp3");
        }
        elsif ($chan =~ /emer/) {
                system("mplayer http://www.wers.org/wers.pls");
        }
        elsif ($chan =~ /talk/) {
                system("mplayer http://broadcast.rantradio.com:9010");
        }
        else { help(); }
 
        sub help {
 
        print <<EOF;
 
        Usage: mplay <channel>
 
        Channels:
        woxy - Woxy.com -
        wjcu - John Carroll - 88.7 - 397.4438
        case - WRUW - 91.1 - 368-2208
        emer - Emerson College - WERS
        talk - RantRadio Talk
 
        EOF
 
        exit;
        }

When I try to run this script in its current directory [I named the script mplay.pl] I received this output error:

Code:

Can't find string terminator "EOF" anywhere before EOF at ./mplay.pl line 35.
I don't program really [unless you want to include messing with BASIC 3 years ago] so I can't really help you out, I hope I've given enough information to help.

Catcha back on the flipside,
keyshawn

Pragma 07-14-2005 05:07 AM

The problem is that the "EOF" statement shouldn't be indented. Perl expects it to be at the absolute start of the line - otherwise it treats the line as text to be printed. Remove the space in front of it and it should work.

SinisterMotives 07-27-2005 06:30 AM

Quote:

Originally Posted by Pragma
The problem is that the "EOF" statement shouldn't be indented. Perl expects it to be at the absolute start of the line - otherwise it treats the line as text to be printed. Remove the space in front of it and it should work.

For future reference, the same thing applies in PHP.

keyshawn 07-27-2005 06:49 AM

hey,

thanks for the tip, I was able to get the script working now - although now, I ran into a couple problems with mplayer...grr.

catcha back on the flipside,
will.


All times are GMT -8. The time now is 09:08 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54