The Finer Points of Podcasts with RSSOwl

Since I’ve been using Google Reader for my feed-reading needs the last few months, I have been spoiled by Reader’s nonchalant handling of just about any feed I throw into it. It’s also available anywhere the internet is, which is very convenient for keeping breaks at work useful and non-boring. (The breaks that don’t involve food, anyway.) I also like the fact that “just about any feed” includes podcasts, so I have a convenient way to keep track of those at work as well.

Unfortunately, podcasts with Reader rely on frequent browser use – something I’m trying to limit – and a 6′ headphone tether to the computer. There is also no good way for Reader to sync with a portable device so podcasts can be heard sans computer with direct net connection.

My solution is to use RSSOwl with a couple custom filters and a custom batch script to sync to a removable USB device (my phone). Here’s how to do the magic and make your life easier.

This setup provides the following critical functions:

  • Feed syncronization with Google Reader (built-in to RSSOwl)
  • Automatic downloading of podcasts/media attachments on articles (RSSOwl filters)
  • Syncronization of new downloads to removable device (Batch script)
  • Automatic deletion of local files by the batch script, if they are removed from device (which I do after listening)
The first two are pretty straightforward; the second two involve batch script magic.
First, use RSSOwl’s import wizard to set up sync with Reader. This is pretty straightforward and there’s plenty of info on the RSSOwl Help page.
Second, set up a filter for automatic media download. You can create a new filter from the “News and Filters” window (in the Tools menu) or, for this example,  click the attachment link at the bottom of the post and select “Automate Download…”
This automatically creates a filter set to match all items and a default action of “Download Attachments”. Select your download folder and your filter is complete. If you want to add other feeds to the same filter – far simpler than setting up a filter for every feed – click the feed name in the criteria bar. To only download attachments on posts that haven’t been read, you can set up conditions based on the state of the news.
Now for the fun part: automating sync with a USB device, in this case my phone. I wanted to satisfy the following criteria:
  • Copy new items to device
  • Maintain a local copy of files so I can listen to them on the computer
  • If they are deleted from the device (i.e., listened to), delete from local folder
  • Use only built-in commands – no need to install separate sync programs
After a bit of logical wrangling, pencil scribbling, and beta-testing various schemes with colored plastic frogs, I emerged with (and bored my wife with explanations of) this fairly simple system:
  • RSSOwl Downloads files to a “New files” folder
  • The script copies all the files in the “New” folder to the device, then
  • Moves them to the “Current” folder (leaving the “New” folder empty)
  • Then the script compares the contents of the “Current” folder and the Device
  • Files that do not exist on the device are deleted from the “Current” folder

The beauty of this system is that it doesn’t matter if we do the copy first or the compare first: both end up with the same result. And, thanks to Google and some batch scripting wizards on forums, this is all possible with built-in shell commands. The file comparison code is hacked up based on this forum thread (particularly message 5). Here’s a simplified version of my script:

@echo off
setlocal
echo PodSync v0.1
:: February 2012
:: This script is public domain, it being nothing very ground-breaking and the hard stuff
:: came from http://forums.techguy.org/dos-other/704816-solved-batch-file-compares-contents.html

:: Move to our working dir and set dir vars
:: If working dir is not on the boot volume, add the /d flag
	cd c:\Documents and Settings\USER\My Documents\My Music\podsync\
	set dirNEW=c:\Documents and Settings\USER\My Documents\My Music\podsync\new\
	set dirCUR=c:\Documents and Settings\USER\My Documents\My Music\podsync\current\
	set dirDEV=f:\Music\Podcasts\

:: Make sure dirs exist
    if not exist "%dirNEW%" echo dirNEW not found & goto :errors
    if not exist "%dirCUR%" echo dirCUR not found & goto :errors
    if not exist "%dirDEV%" echo Device not found & goto :errors

:: Copy new podcasts to the device
:: could just use copy here, drop the /e flag
	echo Dirs exist, copying to device...
	xcopy /e /y "%dirNEW%*.mp3" "%dirDEV%"
:: Move new podcasts to the current folder, which indicates unlistened
	echo Moving new files to current...
	move /y "%dirNEW%*.mp3" "%dirCUR%"

:: Now we magically compute the difference between Device and Current and delete
:: files in Current that don't exist on the device
:: Compare CUR with DEV, delete files in CUR that aren't in DEV
echo Ready to compare and delete
for /f "delims=" %%a in ('dir /b /a-d "%dirCUR%" 2^>NUL') do if not exist "%dirDEV%%%a" del "%dirCUR%%%a"

:eof
echo Thank you, have a nice day!
pause
exit

:errors
echo ERROR!
pause

And there we are! Syncing my podcasts is a simple as plugging in my phone, running the script (which is made even simpler with Launchy), and waiting for it to finish.

Advertisements