I'm still intent on writing a little curses based client for Fever because a) I want to learn C and NCurses and b) I would find this quite handy. However, as is typical for my life, what would make a cute weekend project for many is realistically months (a year? I've had this on my todo list since the start of this year and haven't started yet) for me because there is just no such thing as "spare time".
So in the meantime I thought I would play about with getting my Hot Items as an RSS feed (I'm kind of surprised you can't by default since you can for your saved items) so I could at least use that within Snownews; I really don't need to care about things like synchronising yet. The Fever API allows you to get responses as XML so it's fairly straight forward to convert to RSS via XSLT like so:
<?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output encoding="utf-8" indent="yes" method="xml" media-type="application/rss+xml" /> <xsl:template match="/response/links"> <rss version="2.0"> <channel> <title>Fever Hot items</title> <link>http://myfeverinstall.com/</link> <description/> <xsl:apply-templates /> </channel> </rss> </xsl:template> <!-- Drop the following --> <xsl:template match="api_version | auth | last_refreshed_on_time | use_celsius"/> <xsl:template match="link"> <item> <xsl:apply-templates select="url" /> <xsl:apply-templates select="title" /> <description/> </item> </xsl:template> <xsl:template match="url"> <link><xsl:value-of select="."/></link> </xsl:template> <xsl:template match="title"> <title><xsl:value-of select="preceding-sibling::temperature"/> - <xsl:value-of select="."/></title> </xsl:template> </xsl:stylesheet>
I've dabbled quite a bit in XSLT over the past few years, but I've always been modifying others' templates rather than starting from scratch. The only bit that threw me was how to ignore certain elements from the XML structure, but that's just the empty template matching bit. I've merged the temperature rating from Fever in with the title and since the API only returns the titles and links, the description element is blank - I can open them up with elinks to read them.
To make this work within Snownews I have added the feed as follows in my
exec:curl -o - --data "api_key=md5checksum" "http://myfeverinstall.com/?api=xml&links"||Fever|xsltproc /path/to/feverapi2rss.xsl -
api_key is the md5 checksum of my Fever install account email address and password, as per the API documentation:
md5 -s "email@example.com:feverpassword"
Snownews might be old hat by now, but it is pretty flexible.