It appears that you have JavaScript disabled. Click here to find out what you're missing on this site.

BitWorking Theories on software development

by Joe Gregorio

A short guide to the guts of Aggie

Lets follow Aggie through a single cycle of starting up and reading all the channels you have selected.

  1. Aggie opens Aggie.xfg to get it's settings, including which OPML file to find the list of channels in. [Note that if Aggie.xfg does not exist then Aggie copies Aggie.xfg.orig to Aggie.xfg and tries again]
  2. Then Aggie tries to open the OPML file. For each entry in the OPML file Aggie instantiates a Site object. If the OPML file is named myChannels.opml and it is missing then Aggie copies myChannels.opml.orig to myChannels.opml and then tries again. [Note that the distribution of Aggie only includes Aggie.xfg.orig and myChannels.opml.orig. This makes it safe to have new versions dropped over and old install w/o the user losing their settings.]
  3. The Site object is responsible for it's threading. Site has a Go() method and a GoThreaded() method. The GoThreaded() method is used when the user presses the Go button, it spawns a thread to pull the channel and returns immediately. The Go() method in not threaded and does not return until the channel has been retreived, or and error has orrured. Go() is used when a new channel is added, in which case no processing should be done until that channel is successfully added or has failed to be added. Each instance of Site pulls the channel down and stores it locally. Only three Sites are kept running at any one time and a time event is used to periodically check on their progress and spawn new threads if necessary. The timer event also takes care of updating the progress bar.
  4. Aggie.Merge() is called which offers each Site a chance to parse it's RSS file and insert the parsed contents into "Aggregate.xml". Site calculates an MD5 hash for each story on the concatenation of title, link and description. If this MD5 has already been seen then the story is not displayed. The list of all MD5 hashes seen the last, and only the last, time a channel was loaded is stored in the OPML file.
  5. Aggie.Transform() converts "Aggregate.xml" into "Aggie.html" using the XSL (XML Style Sheet) Aggie.xsl.
  6. Each site then gets a chance to write itself back into the OPML file. This is so they can store their new set of MD5 values. N.B. Aggie distinguishes between different types of OPML files. Aggie can read and write its own OPML files and OPML files from AmphetaDesk. AmphetaDesk is very robust to missing/extra attributes in the XML file. Aggie will only read OPML files produced by Radio, thus MD5 values will not be stored between runs of Aggie. [More testing is needed to determine if writing values back into a Radio OPML file will cause it to break Radio.]