def process_episode ( data ): e = Episode() e.uri = data['uri'] if 'title' in data: e.title = data['title'] if 'description' in data: e.summary = data['description'] if 'episode_number' in data: e.number = data['episode_number'] if 'genres' in data: e.genres = get_genres(data['genres']) # Media type (ignore virtual entries) if 'schedule_only' not in data or not data['schedule_only']: if 'media_type' in data: e.media = data['media_type'] # Brand/Series c_uri = None s_uri = None if 'container' in data and 'uri' in data['container']: c_uri = data['container']['uri'] if 'series_summary' in data and 'uri' in data['series_summary']: s_uri = data['series_summary']['uri'] if c_uri and c_uri != s_uri: e.brand = get_brand(c_uri, data['container']) if s_uri: e.series = get_series(s_uri, data['series_summary']) # complete the link if e.series and e.brand: e.series.brand = e.brand # Film? if 'specialization' in data: e.film = data['specialization'] == 'film' if 'year' in data: e.year = int(data['year']) # Black and White? if 'black_and_white' in data: e.baw = data['black_and_white'] # People if 'people' in data: e.credits = process_people(data['people']) # Title if e.title: r = re.search('^Episode (\d+)$', e.title) if r: e.title = None if e.number is None: e.number = util.str2num(r.group(1)) elif re.search('^\d+/\d+/\d+$', e.title): e.title = None # OK ret = e log.debug('episode = %s' % e, 5) return e
def process_episode(data): e = Episode() e.uri = data['uri'] if 'title' in data: e.title = data['title'] if 'description' in data: e.summary = data['description'] if 'episode_number' in data: e.number = data['episode_number'] if 'genres' in data: e.genres = get_genres(data['genres']) # Media type (ignore virtual entries) if 'schedule_only' not in data or not data['schedule_only']: if 'media_type' in data: e.media = data['media_type'] # Brand/Series c_uri = None s_uri = None if 'container' in data and 'uri' in data['container']: c_uri = data['container']['uri'] if 'series_summary' in data and 'uri' in data['series_summary']: s_uri = data['series_summary']['uri'] if c_uri and c_uri != s_uri: e.brand = get_brand(c_uri, data['container']) if s_uri: e.series = get_series(s_uri, data['series_summary']) # complete the link if e.series and e.brand: e.series.brand = e.brand # Film? if 'specialization' in data: e.film = data['specialization'] == 'film' if 'year' in data: e.year = int(data['year']) # Black and White? if 'black_and_white' in data: e.baw = data['black_and_white'] # People if 'people' in data: e.credits = process_people(data['people']) # Title if e.title: r = re.search('^Episode (\d+)$', e.title) if r: e.title = None if e.number is None: e.number = util.str2num(r.group(1)) elif re.search('^\d+/\d+/\d+$', e.title): e.title = None # OK ret = e log.debug('episode = %s' % e, 5) return e
def process_series ( data ): ret = None try: s = Series() s.uri = data['uri'] if 'title' in data: s.title = data['title'] if 'description' in data: s.summary = data['description'] if 'series_number' in data: s.number = data['series_number'] if 'genres' in data: s.genres = get_genres(data['genres']) if s.title: r = re.search('Series (.*)', s.title) if r: s.title = None if s.number is None: s.number = util.str2num(r.group(1)) ret = s except Exception, e: log.error(str(e))
def process_series(data): ret = None try: s = Series() s.uri = data['uri'] if 'title' in data: s.title = data['title'] if 'description' in data: s.summary = data['description'] if 'series_number' in data: s.number = data['series_number'] if 'genres' in data: s.genres = get_genres(data['genres']) if s.title: r = re.search('Series (.*)', s.title) if r: s.title = None if s.number is None: s.number = util.str2num(r.group(1)) ret = s except Exception, e: log.error(str(e))