- categories_doc = grab_xml(BASE_URL + self.params["categories"], 24*3600)
- by_channel = Node("By Channel", self)
- by_genre = Node("By Genre", self)
- for category in categories_doc.xpath("//category"):
- cid = category.attrib["id"]
- category_name = category.xpath("name/text()")[0]
- if "genre" in category.attrib:
- parent = by_genre
- elif cid in ["abc1", "abc2", "abc3", "abc4", "original"]:
- parent = by_channel
- elif cid in ["featured", "recent", "last-chance", "trailers"]:
- parent = self
- else:
- continue
- node = Node(category_name, parent)
- self.categories_map[cid] = node
-
- def link_series(self):
- # Create a duplicate within each category for each series
- for s in self.series_info.itervalues():
- for cid in s.categories:
- parent = self.categories_map.get(cid)
- if parent:
- IviewSeriesNode(s.title, parent, self.params, s.series_ids)
+ by_category_node = Node("By Category", self)
+ def category(name, slug):
+ IviewIndexNode(name, by_category_node, API_URL + "/category/" + slug)
+
+ category("Arts & Culture", "arts")
+ category("Comedy", "comedy")
+ category("Documentary", "docs")
+ category("Drama", "drama")
+ category("Education", "education")
+ category("Lifestyle", "lifestyle")
+ category("News & Current Affairs", "news")
+ category("Panel & Discussion", "panel")
+ category("Regional Australia", "regional")
+ category("Sport", "sport")
+
+ def load_channels(self):
+ by_channel_node = Node("By Channel", self)
+ def channel(name, slug):
+ IviewIndexNode(name, by_channel_node, API_URL + "/channel/" + slug)
+
+ channel("ABC1", "abc1")
+ channel("ABC2", "abc2")
+ channel("ABC3", "abc3")
+ channel("ABC4Kids", "abc4kids")
+ channel("News", "news")
+ channel("ABC Arts", "abcarts")
+ channel("iView Exclusives", "iview")
+
+ def load_featured(self):
+ IviewFlatNode("Featured", self, API_URL + "/featured")