Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 07-13-2005, 05:46 PM   #1 (permalink)
Psycho
 
keyshawn's Avatar
 
[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
__________________
currently reading:

currently playing :

Last edited by keyshawn; 07-13-2005 at 05:48 PM.. Reason: clarified the title
keyshawn is offline  
Old 07-14-2005, 05:07 AM   #2 (permalink)
I am Winter Born
 
Pragma's Avatar
 
Location: Alexandria, VA
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.
Pragma is offline  
Old 07-27-2005, 06:30 AM   #3 (permalink)
Junkie
 
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.
SinisterMotives is offline  
Old 07-27-2005, 06:49 AM   #4 (permalink)
Psycho
 
keyshawn's Avatar
 
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.
__________________
currently reading:

currently playing :
keyshawn is offline  
 

Tags
linux, mplayer, perl, script, webradio


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



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

Tilted Forum Project

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