rssreader
Overview
rssreader provides RSS aggregation functions: it supports RSS 2.0 (but does not support atom). The RSS entries are held in the internal Mnesia table.
Configuration
The rssreader component does not provide any configuration functionality.
API
During the system start the component will create (if needed) three additional Mnesia tables: rss_list, rss_detail and contentmeta.
The following API is provided (all functions are exported from the rssreader module):
add_rss(URL) - add an RSS feed (pointed by the URL) into the database and a subscription list
delete_rss(URL) - removes a feed from the database
get_all_rss_list() - returns a list of #rss_list{} elements describing the subscribed feeds
get_rss() - triggers rereads all of the sources and put fetched elements to the database
get_all_rss() - returns all RSS items (#rss_detail records) that resides in the database
get_rss_name(URL) - returns the name of the feed available under the provided URL
Moreover, together with rssreader module, this components is shipped with two wparts:
wpart_rss_reader - that allows user to display the RSS entries on the site (no attributes are available - all of the elements that are stored in the database will be rendered)
wpart_rss_editor - which allows user to display a list of RSS entries with delete button next to each. Note that the proper dispatcher entry must be set up to handle the deletion request
Example
The most common usage of this module is as follows (we assume the e_component has started without an error):
1 %% add an RSS feed, for example the XKCD one:
2 1> rssreader:add_rss("http://xkcd.com/rss.xml").
3 "Added RSS Item: Packages"
4 "Added RSS Item: The Race: Part 1"
5 "Added RSS Item: The Race: Part 2"
6 "Added RSS Item: The Race: Part 3"
7 ok
8 %% we read the records
9 2> rr(rssreader).
10 [contentmeta,rss_detail,rss_list,xmerl_event,
11 xmerl_fun_states,xmerl_scanner,xmlAttribute,xmlComment,
12 xmlContext,xmlDecl,xmlDocument,xmlElement,xmlNamespace,
13 xmlNode,xmlNsNode,xmlObj,xmlPI,xmlText]
14 %% get all subscribed channels
15 3> rssreader:get_all_rss_list().
16 [#rss_list{url = "http://xkcd.com/rss.xml",
17 name = "xkcd.com"}]
Now we can use two wpart tags in our views to display the saved RSS entries and manage them.
