def search(query, page, **kwargs): items = [] for row in api.search(query): if row['type'] == 'show': items.append(_process_show(row)) elif row['type'] == 'category': slug = row['page']['href'].split('/')[-1] if slug == 'shows': slug = 'all' items.append( plugin.Item( label=row['title'], info={'plot': row['searchDescription'] or row['synopsis']}, art={'thumb': _get_image(row['tileImage'])}, path=plugin.url_for(category, slug=slug), )) elif row['type'] == 'channel': items.append( plugin.Item( label=row['title'], info={'plot': row['searchDescription'] or row['synopsis']}, art={'thumb': _get_image(row['tileImage'])}, path=plugin.url_for( play, channel=row['page']['href'].split('/')[-1], _is_live=True), playable=True, )) return items, False
def _process_items(rows): items = [] for row in rows: attribs = row['attribs'] if row['typeId'] == 'go-item-video': item = plugin.Item( label=attribs['title'], info={ 'plot': attribs['description'], 'duration': int(attribs['video-duration']) / 1000, }, art={'thumb': attribs['image-background-small']}, path=plugin.url_for(play, id=attribs['assetId']), playable=True, ) elif row['typeId'] == 'go-item-navigation': item = plugin.Item( label=attribs['title'], info={ 'plot': attribs.get('description'), }, art={'thumb': attribs['image-background-small']}, path=plugin.url_for(page, page_id=attribs['pageId']), ) items.append(item) return items
def play(livestream=None, brightcoveId=None, channel=None, **kwargs): if brightcoveId: item = api.get_brightcove_src(brightcoveId) elif livestream: item = plugin.Item(path=livestream, art=False, inputstream=inputstream.HLS(live=True)) if kwargs.get(ROUTE_LIVE_TAG) == ROUTE_LIVE_SUFFIX and not gui.yes_no( _.PLAY_FROM, yeslabel=_.PLAY_FROM_LIVE, nolabel=_.PLAY_FROM_START): item.properties['ResumeTime'] = '1' item.properties['TotalTime'] = '1' item.inputstream = inputstream.HLS(force=True, live=True) if not item.inputstream.check(): plugin.exception(_.LIVE_HLS_REQUIRED) elif channel: data = api.channel(channel) item = plugin.Item(path=data['publisherMetadata']['liveStreamUrl'], art=False, inputstream=inputstream.HLS(live=True)) item.headers = HEADERS return item
def _parse_item(row): if row['mediaType'] == 'Standalone': row['mediaType'] = 'Movie' elif row['mediaType'] == 'Clip': row['mediaType'] = 'Trailer' if row['mediaType'] in ('Movie', 'Trailer'): return plugin.Item( label=row['title'], info={ 'aired': row['_airDateISO'], 'dateadded': row['_pubDateISO'], 'genre': row['genre'], 'plot': row['shortDescription'], 'duration': row['duration'], 'mediatype': 'movie' if row['mediaType'] == 'Movie' else 'video', }, art={ 'thumb': _get_thumb(row['thumbnailSet'], 'Thumbnail') if row['mediaType'] == 'Trailer' else _get_thumb( row['thumbnailSet']) }, ) return plugin.Item()
def _add_profile(taken_names, taken_avatars): ## PROFILE AVATAR ## options = [ plugin.Item(label=_(_.RANDOM_AVATAR, _bold=True)), ] values = [ ['_random', None], ] avatars = [] unused = [] for icon_set in api.profile_icons(): for row in icon_set['icons']: icon_info = [icon_set['iconSet'], row['iconIndex']] values.append(icon_info) avatars.append(icon_info) if row['iconImage'] in taken_avatars: label = _(_.AVATAR_USED, label=icon_set['label']) else: label = icon_set['label'] unused.append(icon_info) options.append( plugin.Item(label=label, art={'thumb': row['iconImage']})) index = gui.select(_.SELECT_AVATAR, options=options, useDetails=True) if index < 0: return avatar = values[index] if avatar[0] == '_random': avatar = random.choice(unused or avatars) ## PROFLE KIDS ## kids = gui.yes_no(_.KIDS_PROFILE_INFO, heading=_.KIDS_PROFILE) ## PROFILE NAME ## name = '' while True: name = gui.input(_.PROFILE_NAME, default=name).strip() if not name: return elif name.lower() in taken_names: gui.notification(_(_.PROFILE_NAME_TAKEN, name=name)) else: break ## ADD PROFILE ## profile = api.add_profile(name, icon_set=avatar[0], icon_index=avatar[1], kids=kids) if 'message' in profile: raise PluginError(profile['message']) _set_profile(profile)
def _add_profile(taken_names, taken_avatars): ## PROFILE AVATAR ## options = [plugin.Item(label=_(_.RANDOM_AVATAR, _bold=True)),] values = ['_random',] avatars = {} unused = [] data = api.collection_by_slug('avatars', 'avatars') for container in data['containers']: if container['set']['contentClass'] == 'hidden': continue category = _get_text(container['set']['texts'], 'title', 'set') for row in container['set'].get('items', []): if row['images'][0]['url'] in taken_avatars: label = _(_.AVATAR_USED, label=category) else: label = category unused.append(row['avatarId']) options.append(plugin.Item(label=label, art={'thumb': row['images'][0]['url']})) values.append(row['avatarId']) avatars[row['avatarId']] = row['images'][0]['url'] index = gui.select(_.SELECT_AVATAR, options=options, useDetails=True) if index < 0: return avatar = values[index] if avatar == '_random': avatar = random.choice(unused or avatars.keys()) ## PROFLE KIDS ## kids = gui.yes_no(_.KIDS_PROFILE_INFO, heading=_.KIDS_PROFILE) ## PROFILE NAME ## name = '' while True: name = gui.input(_.PROFILE_NAME, default=name).strip() if not name: return elif name in taken_names: gui.notification(_(_.PROFILE_NAME_TAKEN, name=name)) else: break profile = api.add_profile(name, kids=kids, avatar=avatar) profile['_avatar'] = avatars[avatar] if 'errors' in profile: raise PluginError(profile['errors'][0].get('description')) _set_profile(profile)
def _process_items(rows, default_thumb=None): items = [] for row in rows: if row['type'] == 'video': thumb = row['thumbnail']['medium'] if 'default-medium' not in row['thumbnail']['medium'] else default_thumb if row.get('live_video'): label = _(_.LIVE_NOW, label=row['title']) path = plugin.url_for(play, slug=row['url'], _is_live=True) else: label = row['title'] path = plugin.url_for(play, slug=row['url']) info = {'duration': row['duration']['seconds'], 'plot': row['description'], 'mediatype': 'movie'} if row.get('media_type') == 'episode': info.update({ 'mediatype': 'episode', 'season': row['metadata']['season_number'], 'episode': row['metadata']['episode_number'], 'tvshowtitle': row['metadata']['series_name'], }) items.append(plugin.Item( label = label, art = {'thumb': thumb}, info = info, path = path, playable = True, )) elif row['type'] == 'series': collection_id = re.search('collections/(.*?)/', row['_links']['items']['href']).group(1) thumb = row['thumbnail']['medium'] if 'default-medium' not in row['thumbnail']['medium'] else default_thumb items.append(plugin.Item( label = row['name'], art = {'thumb': thumb}, info = {'plot': row['description']}, path = plugin.url_for(collection, id=collection_id, label=row['name'], default_thumb=thumb), )) elif row['type'] == 'season': collection_id = re.search('collections/(.*?)/', row['_links']['items']['href']).group(1) thumb = row['thumbnail']['medium'] if 'default-medium' not in row['thumbnail']['medium'] else default_thumb items.append(plugin.Item( label = 'Season {}'.format(row['season_number']), art = {'thumb': thumb}, info = {'plot': row['description']}, path = plugin.url_for(collection, id=collection_id, label=row['name'], default_thumb=thumb), )) return items
def _add_profile(taken_names, taken_avatars): ## PROFILE AVATAR ## options = [ plugin.Item(label=_(_.RANDOM_AVATAR, _bold=True)), ] values = [ '_random', ] avatars = [] unused = [] for avatar in api.profile_config()['avatars']: values.append(avatar['id']) avatars.append(avatar['id']) if avatar['id'] in taken_avatars: label = _(_.AVATAR_USED, _bold=True) else: label = _.AVATAR_NOT_USED unused.append(avatar['id']) options.append( plugin.Item(label=label, art={'thumb': _get_avatar(avatar['id'])})) index = gui.select(_.SELECT_AVATAR, options=options, useDetails=True) if index < 0: return avatar_id = values[index] if avatar_id == '_random': avatar_id = random.choice(unused or avatars) ## PROFILE NAME ## name = '' while True: name = gui.input(_.PROFILE_NAME, default=name).strip() if not name: return elif name.lower() in taken_names: gui.notification(_(_.PROFILE_NAME_TAKEN, name=name)) else: break ## ADD PROFILE ## profile = api.add_profile(name, avatar_id) if 'message' in profile: raise PluginError(profile['message']) _set_profile(profile)
def _select_profile(): profiles = api.profiles() active = api.active_profile() avatars = _avatars([x['attributes']['avatar']['id'] for x in profiles]) options = [] values = [] can_delete = [] default = -1 for index, profile in enumerate(profiles): values.append(profile) profile['_avatar'] = avatars.get(profile['attributes']['avatar']['id']) if profile['attributes']['parentalControls']['isPinProtected']: label = _(_.PROFILE_WITH_PIN, name=profile['profileName']) else: label = profile['profileName'] options.append(plugin.Item(label=label, art={'thumb': profile['_avatar']})) if profile['profileId'] == active.get('profileId'): default = index userdata.set('avatar', profile['_avatar']) userdata.set('profile', profile['profileName']) userdata.set('profile_id', profile['profileId']) elif not profile['attributes']['isDefault']: can_delete.append(profile) options.append(plugin.Item(label=_(_.ADD_PROFILE, _bold=True))) values.append('_add') if can_delete: options.append(plugin.Item(label=_(_.DELETE_PROFILE, _bold=True))) values.append('_delete') index = gui.select(_.SELECT_PROFILE, options=options, preselect=default, useDetails=True) if index < 0: return selected = values[index] if selected == '_delete': _delete_profile(can_delete) elif selected == '_add': _add_profile(taken_names=[x['profileName'] for x in profiles], taken_avatars=[avatars[x] for x in avatars]) else: _set_profile(selected)
def _select_profile(): profiles = api.profiles() options = [] values = [] can_delete = [] default = -1 avatars = {} for avatar in api.profile_avatars(): avatars[avatar['id']] = avatar['url'] for index, profile in enumerate(profiles): profile['avatar'] = avatars.get(profile['avatar_id']) values.append(profile) options.append( plugin.Item(label=profile['name'], art={'thumb': profile['avatar']})) if profile['id'] == userdata.get('profile_id'): default = index _set_profile(profile, notify=False) elif not profile['root_flag']: can_delete.append(profile) options.append(plugin.Item(label=_(_.ADD_PROFILE, _bold=True))) values.append('_add') if can_delete: options.append(plugin.Item(label=_(_.DELETE_PROFILE, _bold=True))) values.append('_delete') index = gui.select(_.SELECT_PROFILE, options=options, preselect=default, useDetails=True) if index < 0: return selected = values[index] if selected == '_delete': _delete_profile(can_delete) elif selected == '_add': _add_profile(taken_names=[x['name'].lower() for x in profiles], avatars=avatars, taken_avatars=[x['avatar_id'] for x in profiles]) else: _set_profile(selected)
def search(query, page, **kwargs): items = [] for row in api.search(query): if row['term_type'] == 'show': items.append( plugin.Item( label=row['title'], info={ 'mediatype': 'tvshow', }, art={ 'thumb': config.image( row['showAssets']['filepath_show_browse_poster']), 'fanart': config.image(row['showAssets']['filepath_brand_hero'], 'w1920-q80') }, path=plugin.url_for(show, show_id=row['show_id']), )) elif row['term_type'] == 'movie': data = row['videoList']['itemList'][0] items.append( plugin.Item( label=data['label'].strip() or data['title'].strip(), info={ 'plot': data.get('shortDescription', data['description']), 'aired': str(arrow.get(data['airDate'])), 'duration': data['duration'], 'mediatype': 'movie', 'trailer': plugin.url_for(play, video_id=row['movie_trailer_id']) if row.get('movie_trailer_id') else None, }, art={ 'thumb': _get_thumb(data['thumbnailSet']), 'fanart': _get_thumb(data['thumbnailSet'], 'Thumbnail') }, path=plugin.url_for(play, video_id=data['contentId']), playable=True, )) return items, False
def _parse_episodes(show, season): items = [] for episode in season['episodes']: if episode['isComingSoon']: continue item = plugin.Item( label=episode['title'], playable=True, path=plugin.url_for(play, id=episode['id']), info={ 'title': episode['title'], 'plot': episode['description'], 'duration': episode['duration'] * 60, 'tvshowtitle': show['title'], 'mediatype': 'episode', 'season': int(episode['seasonNumber']), 'episode': int(episode['episodeNumber']), }, art={ 'thumb': episode['images'][0]['uri'], }, ) items.append(item) return items
def _play(program_id, play_type=None, is_live=False): play_type = int(play_type) if play_type else None program_data, play_data = api.play(program_id) headers = HEADERS.copy() headers['dt-custom-data'] = play_data['drm']['customData'] item = plugin.Item( path = play_data['videoUrl'], headers = headers, inputstream = inputstream.Widevine( license_key = play_data['drm']['licenseServerUrl'], license_data = play_data['drm']['init_data'], response = 'JBlicense', ), ) if is_live and (play_type == PLAY_FROM_START or (play_type == PLAY_FROM_ASK and not gui.yes_no(_.PLAY_FROM, yeslabel=_.PLAY_FROM_LIVE, nolabel=_.PLAY_FROM_START))): item.properties['ResumeTime'] = '1' item.properties['TotalTime'] = '1' for row in play_data.get('captions', []): item.subtitles.append([row['url'], row['language']]) # for chapter in program_data.get('chapters', []): # if chapter['name'] == 'Intro': # item.properties['TotalTime'] = item.properties['ResumeTime'] = str(chapter['end']/1000 - 1) # elif chapter['name'] == 'Credits': # item.play_next = {'time': chapter['start']/1000} return item
def _parse_creators(rows, following=False): items = [] for row in rows: item = plugin.Item( label=row['title'], info={'plot': row['bio']}, art={ 'thumb': row['avatar'], 'fanart': row['banner'] }, path=plugin.url_for(creator_list, slug=row['friendly_title']), ) if following: item.context.append( (_(_.UNFOLLOW_CREATOR, creator=row['title']), 'RunPlugin({})'.format( plugin.url_for(unfollow_creator, slug=row['friendly_title'])))) else: item.context.append( (_(_.FOLLOW_CREATOR, creator=row['title']), 'RunPlugin({})'.format( plugin.url_for(follow_creator, slug=row['friendly_title'])))) items.append(item) return items
def race(slug, **kwargs): races = api.races() if slug not in races: raise Error(_.RACE_NOT_FOUND) race = races[slug] folder = plugin.Folder(race['title'], no_items_label=_.NO_STREAMS) for stream in race['streams']: if not stream['slug']: continue item = plugin.Item( label = stream['label'], path = plugin.url_for(play, slug=stream['slug']), playable = True, ) if stream['live']: item.label = _(_.LIVE_LABEL, title=stream['label']) item.context.append((_.PLAY_FROM_LIVE, "PlayMedia({})".format( plugin.url_for(play, slug=stream['slug'], play_type=PLAY_FROM_LIVE, _is_live=True) ))) item.context.append((_.PLAY_FROM_START, "PlayMedia({})".format( plugin.url_for(play, slug=stream['slug'], play_type=PLAY_FROM_START, _is_live=True) ))) item.path = plugin.url_for(play, slug=stream['slug'], play_type=settings.getEnum('live_play_type', PLAY_FROM_TYPES, PLAY_FROM_ASK), _is_live=True) folder.add_items([item]) return folder
def configure_merge(**kwargs): data = _app_data() data['regions'].pop(ALL, None) user_regions = userdata.get('merge_regions', []) avail_regions = sorted( data['regions'], key=lambda x: (data['regions'][x]['sort'], data['regions'][x]['name'])) options = [] preselect = [] for index, code in enumerate(avail_regions): region = data['regions'][code] options.append( plugin.Item(label=region['name'], art={'thumb': region['logo']})) if code in user_regions: preselect.append(index) indexes = gui.select(heading=_.SELECT_REGIONS, options=options, multi=True, useDetails=True, preselect=preselect) if indexes is None: return user_regions = [avail_regions[i] for i in indexes] userdata.set('merge_regions', user_regions)
def _page(page_id): items = [] page_data = api.page(page_id) for row in page_data['sections']: #flatten if len(page_data['sections']) == 1 and row.get('title') and row.get( 'items'): return { 'title': row['title'], 'items': _process_rows(row['items']) } data = api.section(row['id']) if not data.get('items'): continue item = plugin.Item( label=data['title'], path=plugin.url_for(section, section_id=row['id']), ) items.append(item) return {'title': page_data['title'], 'items': items}
def _get_channels(channels, query=None): items = [] for channel in sorted(channels, key=lambda x: x['title'].lower().strip()): if query and query not in channel['title'].lower(): continue plot = '' if channel['currentEpisode']: start = arrow.get(channel['currentEpisode']['airTime']) end = start.shift(minutes=channel['currentEpisode']['duration']) plot = u'[{} - {}]\n{}'.format( start.to('local').format('h:mma'), end.to('local').format('h:mma'), channel['currentEpisode']['title']) item = plugin.Item( label=channel['title'], info={'plot': plot}, art={'thumb': channel['thumb']}, playable=True, path=plugin.url_for(play, id=channel['id'], _is_live=True), ) items.append(item) return items
def play(id, **kwargs): data = api.play(id) headers = {} headers.update(HEADERS) drm_info = data.get('drmInfo') or {} cookies = data.get('cookie') or {} if drm_info: if drm_info['drmScheme'].lower() == 'widevine': ia = inputstream.Widevine(license_key=drm_info['drmLicenseUrl'], ) headers.update(drm_info.get('drmKeyRequestProperties') or {}) else: raise PluginError('Unsupported Stream!') else: ia = inputstream.HLS(live=True) return plugin.Item( path=data['url'], inputstream=ia, headers=headers, cookies=cookies, resume_from=LIVE_HEAD, ## Need to seek to live over multi-periods )
def play(asset, play_type=PLAY_FROM_LIVE, **kwargs): play_type = int(play_type) from_start = False if play_type == PLAY_FROM_START or ( play_type == PLAY_FROM_ASK and not gui.yes_no(_.PLAY_FROM, yeslabel=_.PLAY_FROM_LIVE, nolabel=_.PLAY_FROM_START)): from_start = True stream = api.play(asset, True) item = plugin.Item( path=stream['url'], inputstream=inputstream.Widevine( license_key=stream['license']['@uri']), headers=HEADERS, ) drm_data = stream['license'].get('drmData') if drm_data: item.headers['x-axdrm-message'] = drm_data if from_start: item.properties['ResumeTime'] = '1' item.properties['TotalTime'] = '1' if kwargs.get(ROUTE_LIVE_TAG): item.inputstream.properties['manifest_update_parameter'] = 'full' return item
def play(asset, play_type=PLAY_FROM_LIVE, **kwargs): play_type = int(play_type) from_start = False if play_type == PLAY_FROM_START or ( play_type == PLAY_FROM_ASK and not gui.yes_no(_.PLAY_FROM, yeslabel=_.PLAY_FROM_LIVE, nolabel=_.PLAY_FROM_START)): from_start = True stream = api.play(asset, True) item = plugin.Item( path=stream['url'], inputstream=inputstream.Widevine( license_key=stream['license']['@uri']), headers=HEADERS, ) drm_data = stream['license'].get('drmData') if drm_data: item.headers['x-axdrm-message'] = drm_data if from_start: item.resume_from = 1 return item
def search(**kwargs): query = gui.input(_.SEARCH, default=userdata.get('search', '')).strip() if not query: return userdata.set('search', query) folder = plugin.Folder(_(_.SEARCH_FOR, query=query)) for row in api.search(query): item = plugin.Item( label=row['title'], art={'thumb': row['image'].get('LARGE')}, info={}, ) if row['editorialItemType'] == 'Program': item.path = plugin.url_for(list_seasons, id=row['id']) elif row['editorialItemType'] == 'Video': item.path = plugin.url_for(play_video, id=row['id']) item.playable = True else: continue folder.add_items(item) return folder
def _select_profile(): profiles = api.profiles() active = api.active_profile() avatars = _avatars([x['attributes']['avatar']['id'] for x in profiles]) options = [] values = [] default = -1 for index, profile in enumerate(profiles): values.append(profile) profile['_avatar'] = avatars.get(profile['attributes']['avatar']['id']) if profile['attributes']['parentalControls']['isPinProtected']: label = _(_.PROFILE_WITH_PIN, name=profile['profileName']) else: label = profile['profileName'] options.append( plugin.Item(label=label, art={'thumb': profile['_avatar']})) if profile['profileId'] == active.get('profileId'): default = index userdata.set('avatar', profile['_avatar']) userdata.set('profile', profile['profileName']) userdata.set('profile_id', profile['profileId']) index = gui.select(_.SELECT_PROFILE, options=options, preselect=default, useDetails=True) if index < 0: return _set_profile(values[index])
def _select_profile(): profiles = api.user()['accountProfiles'] values = [] options = [] default = -1 for index, profile in enumerate(profiles): values.append(profile['id']) options.append( plugin.Item(label=profile['name'], art={'thumb': config.image(profile['profilePicPath'])})) if profile['id'] == userdata.get('profile_id'): default = index index = gui.select(_.SELECT_PROFILE, options=options, preselect=default, useDetails=True) if index < 0: return api.set_profile(values[index]) gui.notification(_.PROFILE_ACTIVATED, heading=userdata.get('profile_name'), icon=config.image(userdata.get('profile_img')))
def _select_profile(): account = api.account() profiles = account['profiles'] options = [] values = [] default = -1 for index, profile in enumerate(profiles): values.append(profile) options.append( plugin.Item(label=profile['name'], art={'thumb': profile['avatar']['uri']})) if profile['id'] == userdata.get('profile_id'): default = index index = gui.select(_.SELECT_PROFILE, options=options, preselect=default, useDetails=True) if index < 0: return _set_profile(values[index])
def configure_merge(**kwargs): user_providers = [x.lower() for x in userdata.get('merge_providers', [])] avail_providers = _providers(playlist=True) options = [] values = [] preselect = [] for index, key in enumerate( sorted(avail_providers, key=lambda x: (avail_providers[x]['sort'], avail_providers[x]['name']))): provider = avail_providers[key] values.append(key) options.append( plugin.Item(label=provider['name'], art={'thumb': provider['logo']})) if key in user_providers: preselect.append(index) indexes = gui.select(heading=_.SELECT_PROVIDERS, options=options, useDetails=True, multi=True, preselect=preselect) if indexes is None: return user_providers = [values[i] for i in indexes] userdata.set('merge_providers', user_providers)
def live(**kwargs): folder = plugin.Folder(_.LIVE, no_items_label=_.NO_MATCHES) data = api.live_matches() for row in data['live']: start = arrow.get(row['match_start_date']).to('local').format(_.DATE_FORMAT) sources = row['stream']['video_sources'] priority = sources[0]['priority'] item = plugin.Item( label = row['subtitle'], info = {'plot': _(_.MATCH_PLOT, series=row['seriesName'], match=row['subtitle'], start=start)}, art = {'thumb': TEAMS_IMAGE_URL.format(team1=row['team1'], team2=row['team2']).replace(' ', '')}, path = plugin.url_for(play_live, match_id=row['mid'], priority=priority), playable = True, ) if len(sources) > 1: url = plugin.url_for(select_source, match_id=row['mid'], sources=json.dumps(sources)) item.context.append((_.PLAYBACK_SOURCE, 'PlayMedia({})'.format(url))) folder.add_items(item) return folder
def replay(**kwargs): folder = plugin.Folder(_.REPLAY) now = arrow.utcnow() earliest = now.shift(hours=-24) dates = [now, earliest] for date in dates: for row in reversed(api.schedule(date)): if row['start'] < earliest or row['start'] > now or row['stop'] > now: continue icon = THUMB_URL.format('channels/{id}_landscape.png'.format(id=row['channel'])) item = plugin.Item( label = u'{}: {}'.format(row['start'].to('local').humanize(), row['title']), info = {'plot': row['desc'], 'duration': row['duration']}, art = {'thumb': icon}, path = plugin.url_for(play, media_id=row['channel'], media_type=MEDIA_CHANNEL, start=row['start'].timestamp, duration=row['duration']), playable = True, ) folder.add_items(item) return folder
def _add_menu(menuitem): item = plugin.Item( label = menuitem['text'], path = plugin.url_for(assets, title=title, asset_type=asset_type, _filter=menuitem['data'], menu=int(len(menuitem.get('menuItem', [])) > 0)), ) folder.add_items([item])
def _process_shows(rows): items = [] for row in rows: plot = _(_.EPISODE_COUNT, count=row['episodeVideoCount']['totalEpisodes']) # if row['episodeVideoCount']['totalClips']: # plot += '\n'+ _(_.CLIPS_COUNT, count=row['episodeVideoCount']['totalClips']) item = plugin.Item( label=row['title'], info={ 'genre': row['category'], 'mediatype': 'tvshow', 'plot': plot, }, art={ 'thumb': config.image(row['showAssets']['filepath_show_browse_poster']), 'fanart': config.image(row['showAssets']['filepath_brand_hero'], 'w1920-q80') }, path=plugin.url_for(show, show_id=row['showId']), ) items.append(item) return items