def fromXml(self, xml): seasons = xml.getElementsByTagName('seasons')[0] ss = {} for x in seasons.getElementsByTagName('season'): s = Season.fromXml(x) ss[s.name] = s xml.removeChild(seasons) name = xml.getElementsByTagName('name')[0].childNodes[0].data.strip() path = xml.getElementsByTagName('path')[0].childNodes[0].data.strip() s = Series(path,name) s.seasonInfo = ss return s
def fromXml(self, xml): episodes = xml.getElementsByTagName('episodes')[0] es = {} for x in episodes.getElementsByTagName('episode'): e = Episode.fromXml(x) es[e.name] = e xml.removeChild(episodes) name = xml.getElementsByTagName('name')[0].childNodes[0].data.strip() path = xml.getElementsByTagName('path')[0].childNodes[0].data.strip() numeric = xml.getAttribute('numeric') s = Season(path,name,numeric) s.episodeInfo = es return s