def get_actors(self, nfo_path): """Get actor info from the nfo file""" dom = self.readNfo(nfo_path) root = dom.firstChildElement("tvshow") series_id = int(root.firstChildElement("id").text()) actors = [] elem_actor = root.firstChildElement("actor") while not elem_actor.isNull(): actor = Actor() actor.set(elem_actor, series_id, '', 'nfo') if not actor in actors: actors.append(actor) elem_actor = elem_actor.nextSiblingElement("actor") return actors
series_info_remote = urllib2.urlopen(series_info_url) self.logger.info("Grabbed url %s" % (series_info_url)) except urllib2.HTTPError, e: self.logger.error("Error grabbing url %s" % (series_info_url)) return None series_info_memory = cStringIO.StringIO(series_info_remote.read()) series_info_zip = zipfile.ZipFile(series_info_memory, 'r') #Parse it up and put the info into a list of Actor objects dom = QtXml.QDomDocument() dom.setContent(series_info_zip.read("actors.xml")) actor_info_list = [] actors = dom.firstChildElement("Actors") actor_node = actors.firstChildElement("Actor") while not actor_node.isNull(): actor = Actor() actor.set(actor_node, series_id, self.tvdb_banner_url, 'tvdb') actor_info_list.append(actor) actor_node = actor_node.nextSiblingElement("Actor") return actor_info_list def get_series_banners(self, series_id): """Gets information about banners for a given series""" series_info_url = "%s/series/%s/all/en.zip" % \ (self.tvdb_apikey_url, series_id) try: series_info_remote = urllib2.urlopen(series_info_url) self.logger.info("Grabbed url %s" % (series_info_url)) except urllib2.HTTPError, e: self.logger.error("Error grabbing url %s" % (series_info_url)) return None series_info_memory = cStringIO.StringIO(series_info_remote.read())