def parse_xbmc_url(self, string): """ Takes a string input which is a URL representation of the program object """ d = utils.get_url(string) self.title = d['title'] self.episode_title = utils.remove_cdata(d['episode_title']) self.description = d['description'] self.duration = d['duration'] self.category = d['category'] self.url = d['url'] self.rating = d['rating'] timestamp = time.mktime(time.strptime(d['date'], '%d/%m/%Y %H:%M:%S')) self.date = datetime.date.fromtimestamp(timestamp) self.thumbnail = d['thumbnail']
def parse_category_series(category_soup, index_soup): category_xml = parse_series(category_soup) series_list = [] categories = category_xml.findAll('item') index = json.loads(index_soup) for program in categories: id = -1 try: if program.find('player').has_key('url'): id = int(program.find('player').get('url').split('/')[6]) except: print "@@@ No id entry found!" if id != -1: for series in index: new_series = create_new_series(series) ok = False for p in series['f']: if int(p['a']) == id: ok = True break if ok == True: for s in series_list: if int(new_series.id) == int(s.id): ok = False break if ok == True and not new_series.has_keyword("shopdownload"): print "ABC iView: Found series: %s" % (new_series.get_list_title()) if new_series.get_image() == None or len(new_series.get_image()) == 0: new_series.image = program.find('thumbnail').get('url') if new_series.get_plot() == None or len(new_series.get_plot()) == 0: description = program.find('description') if description == None: new_series.plot = '' else: new_series.plot = utils.remove_cdata(description.string) if new_series.num_episodes > 0: series_list.append(new_series) return series_list