def make_info(item, show=None, people=None): if people is None: people = {} if show is None: show = {} # logger.log('Making Info: Show: %s' % (show), log_utils.LOGDEBUG) # logger.log('Making Info: Item: %s' % (item), log_utils.LOGDEBUG) info = {} info['originaltitle'] = info['title'] = item['title'] if 'originaltitle' in item: info['originaltitle'] = item['originaltitle'] info['mediatype'] = 'tvshow' if 'aired_episodes' in item else 'movie' if 'overview' in item: info['plot'] = info['plotoutline'] = item['overview'] if 'runtime' in item and item['runtime'] is not None: info['duration'] = item['runtime'] * 60 if 'certification' in item: info['mpaa'] = item['certification'] if 'year' in item: info['year'] = item['year'] if 'season' in item: info['season'] = item['season'] if 'episode' in item: info['episode'] = item['episode'] if 'number' in item: info['episode'] = item['number'] if 'genres' in item and item['genres']: genres = get_genres() item_genres = [ genres[genre] for genre in item['genres'] if genre in genres ] info['genre'] = ', '.join(item_genres) if 'network' in item: info['studio'] = item['network'] if 'status' in item: info['status'] = item['status'] if 'tagline' in item: info['tagline'] = item['tagline'] if 'watched' in item and item['watched']: info['playcount'] = 1 if 'plays' in item and item['plays']: info['playcount'] = item['plays'] if 'rating' in item: info['rating'] = item['rating'] if 'votes' in item: info['votes'] = item['votes'] if 'released' in item: info['premiered'] = item['released'] if 'trailer' in item and item['trailer']: info['trailer'] = utils2.make_trailer(item['trailer']) if 'first_aired' in item: info['aired'] = info['premiered'] = utils2.make_air_date( item['first_aired']) info.update(utils2.make_ids(item)) if 'aired_episodes' in item: info['episode'] = info['TotalEpisodes'] = item['aired_episodes'] info['WatchedEpisodes'] = item[ 'watched_count'] if 'watched_count' in item else 0 info['UnWatchedEpisodes'] = info['TotalEpisodes'] - info[ 'WatchedEpisodes'] # override item params with show info if it exists if 'certification' in show: info['mpaa'] = show['certification'] if 'year' in show: info['year'] = show['year'] if 'runtime' in show and show['runtime'] is not None: info['duration'] = show['runtime'] * 60 if 'title' in show: info['tvshowtitle'] = show['title'] if 'network' in show: info['studio'] = show['network'] if 'status' in show: info['status'] = show['status'] if 'trailer' in show and show['trailer']: info['trailer'] = utils2.make_trailer(show['trailer']) if show: info['mediatype'] = 'episode' info.update(utils2.make_ids(show)) info.update(utils2.make_people(people)) return info
def make_info(item, show=None, people=None): if people is None: people = {} if show is None: show = {} # logger.log('Making Info: Show: %s' % (show), log_utils.LOGDEBUG) # logger.log('Making Info: Item: %s' % (item), log_utils.LOGDEBUG) info = {} info['originaltitle'] = info['title'] = item['title'] if 'originaltitle' in item: info['originaltitle'] = item['originaltitle'] info['mediatype'] = 'tvshow' if 'aired_episodes' in item else 'movie' if 'overview' in item: info['plot'] = info['plotoutline'] = item['overview'] if 'runtime' in item and item['runtime'] is not None: info['duration'] = item['runtime'] * 60 if 'certification' in item: info['mpaa'] = item['certification'] if 'year' in item: info['year'] = item['year'] if 'season' in item: info['season'] = item['season'] if 'episode' in item: info['episode'] = item['episode'] if 'number' in item: info['episode'] = item['number'] if 'genres' in item and item['genres']: genres = get_genres() item_genres = [genres[genre] for genre in item['genres'] if genre in genres] info['genre'] = ', '.join(item_genres) if 'network' in item: info['studio'] = item['network'] if 'status' in item: info['status'] = item['status'] if 'tagline' in item: info['tagline'] = item['tagline'] if 'watched' in item and item['watched']: info['playcount'] = 1 if 'plays' in item and item['plays']: info['playcount'] = item['plays'] if 'rating' in item: info['rating'] = item['rating'] if 'votes' in item: info['votes'] = item['votes'] if 'released' in item: info['premiered'] = item['released'] if 'trailer' in item and item['trailer']: info['trailer'] = utils2.make_trailer(item['trailer']) if 'first_aired' in item: info['aired'] = info['premiered'] = utils2.make_air_date(item['first_aired']) info.update(utils2.make_ids(item)) if 'aired_episodes' in item: info['episode'] = info['TotalEpisodes'] = item['aired_episodes'] info['WatchedEpisodes'] = item['watched_count'] if 'watched_count' in item else 0 info['UnWatchedEpisodes'] = info['TotalEpisodes'] - info['WatchedEpisodes'] # override item params with show info if it exists if 'certification' in show: info['mpaa'] = show['certification'] if 'year' in show: info['year'] = show['year'] if 'runtime' in show and show['runtime'] is not None: info['duration'] = show['runtime'] * 60 if 'title' in show: info['tvshowtitle'] = show['title'] if 'network' in show: info['studio'] = show['network'] if 'status' in show: info['status'] = show['status'] if 'trailer' in show and show['trailer']: info['trailer'] = utils2.make_trailer(show['trailer']) if show: info['mediatype'] = 'episode' info.update(utils2.make_ids(show)) info.update(utils2.make_people(people)) return info