Wednesday, July 23, 2008

Move Mail.app RSS Feeds to NetNewsWire

Like Dave Thomas, I recently decided to give Mail.app a try as an RSS reader. Overall the experience hasn't been great, but it wasn't poor enough that I thought the effort to switch was justified.

And then I decided to quit my job*. Next week will by my last week with ThoughtWorks and I'll need to turn in my laptop. I tend to store as much as possible online so this type of situation isn't a big deal, but going with Mail.app seems to have been a decision in the wrong direction. Maybe Mail.app stores my RSS feeds online somewhere, but it wasn't immediately obvious to me.

A quick google search revealed a Mac OSX Hint on how to dump your RSS feeds to the command line. This was quite helpful, but what I really needed was an OPML file that I could send to NetNewsWire.

I wrote the following script for anyone that finds themselves in the same situation. This script will grab all the feeds and write them to an OPML file. I'm sure it can be cleaned up or done more easily, but this works.

feeds = %x[IFS=$'\n';for i in $(find ~/Library/Mail/RSS/ -name "Info.plist");do grep "<string>http://" $i | sed "s/.*\(http[^<]*\).*/\1/";done].split("\n")
feeds = feeds.collect { |element| element.gsub(/<string>/, "<outline xmlUrl=\"") }
feeds = feeds.collect { |element| element.gsub(/<\/string>/, "\"/>") }
xml = <<-eos
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.1">
<head>
<title>mySubscriptions</title>
</head>
<body>
#{feeds.join("\n")}
</body>
</opml>
eos

File.open("mail_app_export.ompl", "w") { |file| file << xml }

note: This file works in NetNewsWire, but I had better success by logging on to newsgator.com and importing on their website. When you import on their website it pulls the feed names and other information. The NetNewsWire didn't seem to pull the additional information.

*For those interested, I'm joining DRW Trading.

6 comments:

  1. Anonymous8:00 AM

    Hi Jay.

    I use NewsFire RSS reader (I recommend it) and I had a similar problem migrating my feeds from Mail.app, as NewsFire wanted an OPML file too.

    Good luck for your new job.

    Ric.

    ReplyDelete
  2. Anonymous9:23 AM

    Hum personnaly I use google reader and subscribe to its feed in Opera. It works very well, on every machine I use (home and work) and whatever the OS they use.

    ReplyDelete
  3. Anonymous7:28 AM

    Jay, any chance you'll be able to continue blogging when you go to DRW? Most financial firms are not real keen on the idea of public dissemination of *anything* they are working on.

    I realize your blog postings are usually very high-level discussions of language features and never give away any client details, but they may not see it that way.

    You might want to check their policy if you haven't already.

    ReplyDelete
  4. Anonymous8:26 AM

    I'll continue to blog. For 3.5 years I've been blogging without giving away client information, so I don't think I'll have much trouble.

    Thanks for the interest though.

    Cheers, Jay

    ReplyDelete
  5. Seems like DRW is mostly a .NET shop (from careers page at least), are you going back into the .NET world or are you going to help bring them the Ruby love?

    ReplyDelete
  6. Anonymous11:37 AM

    One of the reasons I took a job at DRW was because they are interested in using the right tool for the job. A lot of people talk about it, they seem to actually do it.

    So, I expect to do some C#, Ruby, C++, Perl, and several other languages -- which will probably be reflected by future blog entries.

    ReplyDelete

Note: Only a member of this blog may post a comment.