Updated: 3/4/2003; 3:19:43 PM.
Weblogs
About Weblog technology and usage
        

Wednesday, February 05, 2003

Since I've discovered Jon Udell's excellent channelroll macro last year, I never managed to make it work on my Radio instance. I kept receiving a message about channeltitle not being defined. I've had no time to debug it to determine the cause of the problem.

Today I finally tackled it and found it after 2 hours of trial and errors, discovering UserTalk while doing it.

The roor cause was not in Jon's macro but in my subscription data: in my early discovery of the News reader I had subscribed to http://www.soapware.org/discuss/reader$4.opml, because it had an orange XML icon, like the RSS feeds usually have.

But this dummy is an OPML file, not an RSS feed !

Thus in my aggregatorData.services table, adr^.compilation for this entry had a format unknown, and no channeltitle and no channellink elements.

The Radio subscription page is foolproofed against this kind of problems, because the feed does not show up in my Radio subscription page.

Looking at the code that is called in radiowwwsystempagessubscriptions.txt, radio.html.viewSubscriptions, it is:

if sizeof (adr^.compilation) > 0 {
 local (title = adr^.compilation.channeltitle);
 local (channeldescription = "", channellink = "");
 if defined (adr^.compilation.channeldescription) {
  channeldescription = radio.string.decodeEntities (adr^.compilation.channeldescription)};
 if defined (adr^.compilation.channellink) {
  channellink = adr^.compilation.channellink};

Jon's macro just doesn't perform these checks and it failed when adr^.compilation.channeltitle was not defined.

I modified Jon's macro a little to add these checks and finally got it running.

I also added a counter for the number of channels in the channelrooll, something I wanted to know since a while.

It's not perfect code, I have no time to delve further in UserTalk, but it may help those who got the same problerm I met.

Thanks Jon for this neat little tool. I had no expectations about it beign completely foolproof. This little addendum will help those who have the same problem I encountered, and in doing it I learnt a few things about Radio's underlying implementation.

on subs()
{
 local (t);
 local(numberOfFeeds = 0);
 new (tableType, @t);
 for adr in (@aggregatorData.services)
  {
      if defined (adr^) {
        if defined (adr^.compilation) {
          local(title = "problem");
          local(channelUrl = "problem");
            if defined (adr^.compilation.channeltitle) {
              title = adr^.compilation.channeltitle;
            };
            if defined (adr^.compilation.channellink) {
              channelUrl = adr^.compilation.channellink;
            };
            numberOfFeeds++;
              local(rssUrl = nameOf(adr^));
              local (l);
              new (listType, @l);
              l[0] = channelUrl;
              l[0] = rssUrl;
              t[title] = l;
        };
      };
  };
 target.set(@t);
 table.sortBy("Name");
 target.clear();
 local(s = "<p class='realsmall'>currently subscribed to " + numberOfFeeds + " feeds:</p>");
 for adr in (@t)
  {
  local(title = string.replace(nameOf(adr^),"&apos;","&#39;"));
  local(l = adr^);
  local(channelUrl = l[1]);
  local(rssUrl = l[2]);
  s = s + "<p class='realsmall'><a href='http://127.0.0.1:5335/system/pages/subscriptions?url=" + string.urlEncode(rssUrl) + "'><img border='0' src='http://radio.weblogs.com/0105673/images/tinyCoffeCup.jpg' alt='Radio UserLand users: click to subscribe. Other folks: use the RSS link to acquire this channel.'></a> <a href='" + channelUrl + "'>" + title + "</a> (<a href='" + rssUrl + "'>rss</a>)</p>";
  };
 s = s + "<p class='realsmall'>Here's <a href='http://radio.weblogs.com/0100887/2002/02/24.html#a88'>how this works</a>.</p>";
 return (s);
}


3:39:37 PM    comment []

Finance sector throws arms around blogging. [Marc's Voice]
10:54:33 AM    comment []

© Copyright 2003 Patrick Chanezon.
 
February 2003
Sun Mon Tue Wed Thu Fri Sat
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28  
Jan   Mar


Click here to visit the Radio UserLand website.

Subscribe to "Weblogs" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.