Geeks With Blogs

Lance's TextBox
 

In my last post I showed how I can create an RSSBus template to take the Where's Tim RSS feed and output it as a Google Earth KML format.  This time I'll create an RSSBus script to take Tim's most recent location and output an RSS feed of pizza restaurants that he might eat lunch at today.  I'll do this by “pipelining“ together Tim's feed with another restaurant feed.

What's the difference in an RSSBus script and an RSSBus template?  Not much.  A script outputs an RSS feed, and a template outputs any format you like.  They both look the same syntactically, except the template has non-script mixed in with it (like the KML xml elements in the previous example).

In this script, first I call feedRange (one of the free operations that comes installed with RSSBus) and give it Tims location feed as input.  I'll also pass as input the range of items in the feed that I am interested in (in this case, the range is 0 through 0 since I only want his most recent location):

<rsb:call op="feedRange?first=0&feed=http%3a%2f%2fwww.timhibbard.com%2fwherestim%2frss_location.aspx&last=0">
<rsb:call>

Now the effect of this feedRange operation call is that the code inside the rsb:call element will be “executed“ by RSSBus for each item output by the feedRange operation.  In this case that will only be one item - the most recent one from Tims location feed.

Right now there is no code inside the rsb:call, so I'll add some.  Inside I'll make a call to another operation; the yahooLocalSearch operation (another freebie that comes installed with RSSBus).  This operation consumes one of Yahoo's web services and outputs local businesses given a location and search filter as input.  I'll call the operation and pass it the georss point of Tims location, the query “pizza“ (because maybe Tim feels like eating pizza today), and a radius of 10 miles.  

  <rsb:call op="yahooLocalSearch?location=[georss:point | LSplit(' ',2)]%2c[georss:point | LSplit(' ',1)]&query=pizza&radius=10">
    <rsb:push/>
  <rsb:call>

Inside this rsb:call I will do an rsb:push, which simply pushes out each item returned by yahooLocalSearch into the output stream (an RSS feed).  Here's a listing of the full RSSBus script:

 

<rsb:call op="feedRange?first=0&feed=http%3a%2f%2fwww.timhibbard.com%2fwherestim%2frss_location.aspx&last=0">
  <rsb:call op="yahooLocalSearch?location=[georss:point | LSplit(' ',2)]%2c[georss:point | LSplit(' ',1)]&query=pizza&radius=10">
    <rsb:push/>
  rsb:call> 
rsb:call>
Now, it just so happens that Yahoo thinks Tim's location is Topeka, KS.  I guess Yahoo needs to do some work there.  :)  But, the result of these 5 simple lines of RSSBus script is a dynamic RSS feed of restaurants close to whatever Tim's location is.

 

I think Papa Murphy's Take 'n' Bake sounds good.  :)

Technorati tags:     

Posted on Thursday, June 15, 2006 11:19 AM Programming , Software | Back to top


Comments on this post: Where's Tim's Lunch?

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Lance Robinson | Powered by: GeeksWithBlogs.net