Hacking iPodder

May 18, 2005

So, I’ve been enjoying listening to radio (internet only or radio) at my convenience lately by using a nice software tool called iPodder. It checks the different websites while it runs in the background (monitors the RSS feed) for what are called podcasts and then automatically downloads them to my hard drive.

Yes, it is a dumb name for it – it stems from the iPod device. Yes, they work fine without an iPod – any MP3 player, including a PC, will work out just fine. Yes, distributing files like this was around long before the iPod, the iPod just made it popular. No, I have no control over what people call this. Not My Fault. Anyway…

iPodder is an open source tool and is quite nice for a second version tool that is available for free. With a couple of big exceptions – the assumption that if you are using it you must also be using the bloated iTunes or the bloated Windows Media Player. If you aren’t, well, then you are persona non grata as far as the program is concerned. I use Foobar2000 since it is fast, stable and has a small memory footprint. However, if your favorite tool for getting this content makes it rather difficult to play said content it can be a bit frustrating.

Don’t get me wrong – great tool, still in its infancy and contrary to some posts it has some great people helping out on the message boards when people have questions.

I’ve found a way around the problem listed above if you are using WinXP or, presumably, any variant of Windows. However, this has only been tested on Windows XP using foobar2000 as my mp3 player.

First, create a DOS batch file with the following contents:

@echo off

set str=
:loop
if “%str%” NEQ “” set str=%str% %1
if “%str%” EQU “” set str=%1
shift
if “%1” NEQ “” goto loop

“c:\program files\foobar2000\foobar2000.exe” /add “%str%”

Place this file wherever you want; I put my file into the “c:\program files\ipodder\” directory as a file named enqueue.cmd ( your file will need to end with either .cmd or .bat for this to work without modification).

Now open up IPodder and select File -> Preferences and then select the Advanced tab. Check the option labeled “Run this command after each download” and then fill in the text box field with the following statement:

“c:\program files\ipodder\enqueue.cmd” %f

That should be it! If you have iPodder set to not have a default player (File -> Preferences, Player tab, “No Player” radio button selected) then when a podcast is completed downloading it will run your command.

Now, for those that are paranoid and unsure of what batch scripts do, here is a quick breakdown of the above script.

@echo off

This stops the batch file from writing each line of the batch file to the screen as it gets evaluated. Doesn’t change the functionality much, except that it will run faster with the echoing off.

set str=
:loop
if “%str%” NEQ “” set str=%str% %1
if “%str%” EQU “” set str=%1
shift
if “%1” NEQ “” goto loop

This is the slightly arcane bit and caused me a bit of debugging since I haven’t used DOS scripting for a while. Basically, this creates a variable, str, and then checks to see if it isn’t empty. If it isn’t, it sets the variable to itself plus the first variable passed at the command line. If it is empty, then it sets the variable to the first variable passed at command line. After those evaluations, it ‘shifts’ all of the command line variables to the left, dropping the first one and replacing it with the second and so on down the line. Then, if the new first variable is not empty it loops around and does it again. If the new first variable is empty then it doesn’t loop and goes to our command.

“c:\program files\foobar2000\foobar2000.exe” /add “%str%”

This is the command you want to execute with any command line parameters plus our new ‘str’ variable which is all of the command line variables, seperated by spaces. By enclosing our variable in quotation marks it is executed as a single parameter instead of individual parameters. In foobar2000 the ‘/add’ parameter tells foobar2000 to add the parameter to the current playlist – otherwise it clears the current playlist and adds the file as the only entry. Not what we want when we are listing to lots of stuff each day.

Have fun, embrace and extend. Let me know if you have a question and I’ll attempt an answer.

Advertisements

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

%d bloggers like this: