[Util] Open PLS Playlist in Windows Media Player
[UPDATE: I finally built an installer and added some error handling, so this should be easier to set up and use. Download the setup from http://www.codeplex.com/openplsinwmp.
Some web radio stations (like the super cool SomaFM) only offer PLS playlists, and Windows Media Player doesn't support PLS playlists even though they're about the simplest file imaginable.
I whipped up a simple app (OpenPlsInWMP) that parses the stream url out of a PLS file and shells out to WMP, so if you associate PLS files with OpenPlsInWM it'll seem like Windows Media Player decided to play nice with PLS files.
It's working pretty well for me. If the stream is interrupted you may have to kill WMP and click the PLS link again - it doesn't seem to restart as well as with ASX streams. YMMV.
Download It [updated]
Dirt Simple Code:
using System;
using System.IO;
namespace Jon.Galloway.Wrote.Me
{
class OpenPlsInWM
{
[STAThread]
static void Main(string[] args)
{
if (args.GetUpperBound(0) > -1)
{
string filename = args[0];
using (StreamReader sr = new StreamReader(filename))
{
string line;
while ((line = sr.ReadLine()) != null)
{
if (line.ToLower().StartsWith("file1="))
{
string url = line.Split('=')[1];
System.Diagnostics.Process.Start("wmplayer.exe",url);
break;
}
}
}
}
else
{
Console.WriteLine("Usage: OpenPlsInWM \"playlist.pls\"");
Console.WriteLine("Associate PLS file extension with this application to allow Windows Media Player to play them.");
}
}
}
}