Sporkmonger

purveyor of fabulously ambiguous eating utensils

Item Sorting Order

Posted by sporkmonger
Written October 18th, 2005

I just released FeedTools 0.2.16 with some handy new goodies. It should hopefully work with Ruby 1.8.3 now, and should properly sort items by date. (It used to occaisionally leave the time field as nil, which would cause those entries to end up getting sorted to the very end.)

The parser now assumes that feeds are published in reverse chronological order, and so if a timestamp is missing, it tries to fix the problem and assign a timestamp of 1 second after the previous entry in order to maintain proper sorting order. It’s all nicely unit tested and should work for all feeds that aren’t intentionally designed to break it. (For example, cases where items 1 and 3 have no timestamp, but item 2 does.) I’ll probably deal with that situation in the next release, but since it’s highly unlikely to ever happen and has only mild side-effects, I’m not overly concerned. At worst, some items show up in the wrong order.

More importantly, if you’re playing around with the Universal Subscription Mechanism, FeedTools should properly figure out what the real url of the feed is. It will override the default feed url with the url within the feed if you gave FeedTools a url that doesn’t use http or https as the protocol. For example, a feed accessed via the file protocol that’s been stored in some temporary folder somewhere. Obviously, if you can retrieve the feed over http, you don’t really need to worry about correcting the subscription url, so it won’t override it in those cases.

Atom 0.3 became a headache this time round. As it turns out, there’s a namespace issue of sorts between Atom 1.0 and Atom 0.3. Or well, at least, they have different namespaces, but the same element names, so I have to check for the elements twice, once with the Atom 1.0 namespace, and then again with the Atom 0.3 namespace. Kind of irritating. But less so than, say, RSS, where there’s no namespace at all.

Speaking of which, I thought I should mention that, even if someone has messed up namespaces, FeedTools usually still won’t break. FeedTools checks for the elements it’s looking for, both in a namespace aware mode, as well as a namespace ignorant mode.

Anyways.

Namespace Awareness Week

Posted by sporkmonger
Written October 1st, 2005

FeedTools 0.2.15 includes the beginnings of namespace support for FeedTools. Namespace awareness was one of the last few features that I had on the list to have in for 0.2. Once those are fully in place I’ll be moving on to putting in more advanced, higher level features like subscription management with OPML import/export.

Version 0.3 will likely include some significant API changes, just as the jump from 0.1 to 0.2 did. Just a heads-up.

Still remaining on the to-do list for 0.2:

  • full namespace awareness
  • proper encoding/charset handling with iconv
  • dealing with relative urls
  • dealing with malformed feeds with multiple root nodes

(i.e. All the low-hanging fruit has already been picked.)

Patches are, of course, welcome! The parts of the code that need work are marked clearly with TODO in big all-caps letters. The unit tests for atom support could really use some work too. By which I mean, there’s only one or two tests right now. It’s definately the most undertested portion of the library.

Oh, yeah. And the API page has returned after a long hiatus due to lighttpd config file woes. (I made the mistake of copying from an example config file that contained a couple of unneccessary url rewrites. Those rewrites munged up the index files and the redirects and generally wreaked havoc on all things not-rails.) Apologies for not getting that back into working order sooner.