+ categories = series["e"].split()
+ info = SeriesInfo(title, sid, categories)
+ self.series_info.append(info)
+
+ def load_categories(self):
+ 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:
+ for cid in s.categories:
+ parent = self.categories_map.get(cid)
+ if parent:
+ IviewSeriesNode(s.title, parent, self.params, s.sid)