Playing PLS (WinAMP) file in Windows Media Player


 

Do you ever wanted to play PLS (web broadcast) files in Windows Media Player? I do for good reasons like below.

1. WMP can buffer up to 60 seconds (or 1 Minute) of the broadcast. Somehow I can’t find it in WinAMP (at least in free edition)
2. My Keyboard support WMP for play, pause, etc.,, but NOT WinAMP

I tried opening the PLS file in WMP, it doesn’t know how to parse the PLS file. But, if you open the PLS file, copy and Paste the HTTP URL into WMP, it plays.

image

For Example, the typical PLS file looks like this,


numberofentries=1
File1=http://85.93.151.126:8032
Title1=(#1 – 10/50) MoonBeat Radio
Length1=-1
Version=2

If you copy the HTTP URL (http://85.93.151.126:8032), Open the WMP, Click Ctrl–>U for Open URL and paste the URL, WMP buffers and plays nicely.

Now, I know the above info..who are they kidding? I wrote a VBScript and made WMP to play the PLS file automatically. For example, I go to a Radio web site, click on PLS file link (usually says "PLAY" Button or URL), my script open the PLS, parse and open WMP with the provided HTTP URL. So I don’t have to install an extra player to listen Internet Radio on my work laptop.

If you like the above idea, use my following VBScript and CMD file.

1. Copy and Paste the following script into Notepad and save it as "PlayPLS.VBS". NOTE: While saving the script from Notepad, You NEED to type the vbscriptname.vbs in QUTOES. e.g., "PlayPLS.vbs". Otherwise it will save as PlayPLS.vbs.txt

‘*****************************************************************************
‘*****************************************************************************
‘*********                       PlayPLS.vbs                        **********
‘********* Parameters: PLS file name                                **********
‘*********                                                          **********
‘********* This script plays .PLS files in Windows Media Player     **********
‘*********                                                          **********
‘********* Usage: PlayPLS.vbs Sample.PLS                            **********
‘*********                                                          **********
‘********* Written By: Anand Venkatachalapathy                      **********
‘*****************************************************************************
‘*****************************************************************************

Set WshShell = WScript.CreateObject("WScript.Shell")
Set oArg = WScript.Arguments
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")

If oArg.Count = 0 Then
    WshShell.Popup "Invalid Arguments…Please provide the PLS file name.", _
                   
7, "Play PLS in WMP",0
    WScript.Quit
End If

sPLSFileName = oArg(0)
Set f = fso.OpenTextFile(sPLSFileName, ForReading)

Do While NOT f.AtEndOfStream
    sText =  f.ReadLine
    If InStr(UCase(sText),"FILE") > 0 Then
        sURLText =  Split(sText,"=")
        sURL = """" & sURLText(1) & """"
        sCmd = "WMPlayer " & sURL
        WshShell.Run sCmd
        Exit Do
    End If
Loop

f.close
Set fso = Nothing
Set oArg = Nothing
Set WshShell = Nothing

2. Copy and Paste the following text into Notepad and save it as PlayPLS.cmd. NOTE: Use the "double quotes" when saving the name in Notepad.

C:PathOfTheFolderPlayPLS.vbs %1

3. Open your favorite radio station (mine is http://www.shoutcast.com), right click on PLS file link (or PLAY button) and save it on your desktop.

4. Open the file properties of PLS file (by right clicking on the PLS on the desktop and select properties), Click "Change" button next to the "Opens With:" text. Select the PlayPLS.cmd file by browsing to the corresponding folder and select the cmd file.

5. You are done. Go to your favorite radio web site again and click on "Play" Link. See it open in Windows Media Player.

6. Don’t forget to Thank me.

Advertisements

One thought on “Playing PLS (WinAMP) file in Windows Media Player

  1. i did in the same manner mentioned above still its is unable to be streamed….what version of media player is this code designed for ……?? what to do if this happens……

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s