Wednesday, October 15, 2008

Dynamic FeedFlare using AppJet server side Javascript

Dynamic FeedFlares using AppJet server side Javascript


In this example, if the item category is "Music" then return a custom link, else show nothing.

AppJet

http://appjet.com/app/3454754/source

/* appjet:version 0.1 */

page.setMode("plain")

print(html("""<FeedFlare>
"""));

if (request.params.category) {

if (request.params.url) {

if (request.params.category=="Music") {

print(html("""<Text>Stream with BitLet</Text>
<Link href="http://www.bitlet.org/music/play?torrent="""
+request.params.url
+"""" />
"""));
}
}
}


print(html("""</FeedFlare>"""));


FeedFlare

http://pastebin.ca/raw/1227586

<FeedFlareUnit>
<Catalog>
<Title>BitLet Stream Music</Title>
<Description>Stream using BitLet.org if category is Music</Description>
</Catalog>
<DynamicFlare href="http://bitletfeedflarestreamif.appjet.net/?category=${a:category[1]/@term}&amp;url=${a:link[(@rel='enclosure')]/@href}"/>
</FeedFlareUnit>