def video_list_to_listitem(self, video): duration = video.get(Keys.LENGTH) date = video.get(Keys.CREATED_AT)[:10] if video.get(Keys.CREATED_AT) else '' year = video.get(Keys.CREATED_AT)[:4] if video.get(Keys.CREATED_AT) else '' image = video.get(Keys.PREVIEW) if video.get(Keys.PREVIEW) else Images.VIDEOTHUMB if Keys.MEDIUM in image: image = image.get(Keys.MEDIUM) channel = video[Keys.CHANNEL] context_menu = list() context_menu.extend(menu_items.refresh()) name = channel.get(Keys.DISPLAY_NAME) if channel.get(Keys.DISPLAY_NAME) else channel.get(Keys.NAME) if self.has_token: context_menu.extend(menu_items.edit_follow(channel[Keys._ID], name)) # context_menu.extend(menu_items.edit_block(channel[Keys._ID], name)) context_menu.extend(menu_items.channel_videos(channel[Keys._ID], channel[Keys.NAME], name)) if video[Keys.GAME]: context_menu.extend(menu_items.go_to_game(video[Keys.GAME])) context_menu.extend(menu_items.add_blacklist(channel[Keys._ID], name)) context_menu.extend(menu_items.add_blacklist(b64encode(video[Keys.GAME].encode('utf-8', 'ignore')), video[Keys.GAME], list_type='game')) context_menu.extend(menu_items.set_default_quality('video', channel[Keys._ID], channel[Keys.NAME], video[Keys._ID])) context_menu.extend(menu_items.run_plugin(i18n('play_choose_quality'), {'mode': MODES.PLAY, 'video_id': video[Keys._ID], 'ask': True, 'use_player': True})) info = self.get_plot_for_video(video) info.update({'duration': str(duration), 'year': year, 'date': date, 'premiered': date, 'mediatype': 'video'}) return {'label': self.get_title_for_video(video), 'path': kodi.get_plugin_url({'mode': MODES.PLAY, 'video_id': video[Keys._ID]}), 'context_menu': context_menu, 'is_playable': True, 'info': info, 'content_type': 'video', 'art': the_art({'poster': image, 'thumb': image, 'icon': image})}
def clip_to_listitem(self, clip): duration = clip.get(Keys.DURATION) plot = clip.get(Keys.DESCRIPTION) date = clip.get(Keys.CREATED_AT)[:10] if clip.get(Keys.CREATED_AT) else '' year = clip.get(Keys.CREATED_AT)[:4] if clip.get(Keys.CREATED_AT) else '' image = clip.get(Keys.THUMBNAILS) if clip.get(Keys.THUMBNAILS) else Images.VIDEOTHUMB if Keys.MEDIUM in image: image = image.get(Keys.MEDIUM) broadcaster = clip[Keys.BROADCASTER] context_menu = list() context_menu.extend(menu_items.refresh()) name = broadcaster.get(Keys.DISPLAY_NAME) if broadcaster.get(Keys.DISPLAY_NAME) else broadcaster.get(Keys.NAME) if self.has_token: context_menu.extend(menu_items.edit_follow(broadcaster[Keys.ID], name)) # context_menu.extend(menu_items.edit_block(broadcaster[Keys.ID], name)) context_menu.extend(menu_items.channel_videos(broadcaster[Keys.ID], broadcaster[Keys.NAME], name)) if clip[Keys.GAME]: context_menu.extend(menu_items.go_to_game(clip[Keys.GAME])) context_menu.extend(menu_items.add_blacklist(broadcaster[Keys.ID], name)) context_menu.extend(menu_items.add_blacklist(b64encode(clip[Keys.GAME].encode('utf-8', 'ignore')), clip[Keys.GAME], list_type='game')) context_menu.extend(menu_items.set_default_quality('clip', broadcaster[Keys.ID], broadcaster[Keys.NAME], clip_id=clip[Keys.SLUG])) context_menu.extend(menu_items.run_plugin(i18n('play_choose_quality'), {'mode': MODES.PLAY, 'slug': clip[Keys.SLUG], 'ask': True, 'use_player': True})) info = self.get_plot_for_clip(clip) info.update({'duration': str(duration), 'year': year, 'date': date, 'premiered': date, 'mediatype': 'video'}) return {'label': self.get_title_for_clip(clip), 'path': kodi.get_plugin_url({'mode': MODES.PLAY, 'slug': clip[Keys.SLUG]}), 'context_menu': context_menu, 'is_playable': True, 'info': info, 'content_type': 'video', 'art': the_art({'poster': image, 'thumb': image, 'icon': image})}
def stream_to_listitem(self, stream): channel = stream[Keys.CHANNEL] video_banner = channel.get(Keys.PROFILE_BANNER) if not video_banner: video_banner = channel.get(Keys.VIDEO_BANNER) if channel.get(Keys.VIDEO_BANNER) else Images.FANART preview = stream.get(Keys.PREVIEW) if Keys.MEDIUM in preview: preview = preview.get(Keys.MEDIUM) logo = channel.get(Keys.LOGO) if channel.get(Keys.LOGO) else Images.VIDEOTHUMB image = preview if preview else logo title = self.get_title_for_stream(stream) if stream.get(Keys.STREAM_TYPE) == 'watch_party': color = get_vodcast_color() title = u'[COLOR={color}]{title}[/COLOR]'.format(title=title, color=color) info = self.get_plot_for_stream(stream) info.update({'mediatype': 'video'}) context_menu = list() context_menu.extend(menu_items.refresh()) name = channel.get(Keys.DISPLAY_NAME) if channel.get(Keys.DISPLAY_NAME) else channel.get(Keys.NAME) if self.has_token: context_menu.extend(menu_items.edit_follow(channel[Keys._ID], name)) # context_menu.extend(menu_items.edit_block(channel[Keys._ID], name)) context_menu.extend(menu_items.channel_videos(channel[Keys._ID], channel[Keys.NAME], name)) if channel[Keys.GAME]: context_menu.extend(menu_items.go_to_game(channel[Keys.GAME])) context_menu.extend(menu_items.add_blacklist(channel[Keys._ID], name)) context_menu.extend(menu_items.add_blacklist(b64encode(channel[Keys.GAME].encode('utf-8', 'ignore')), channel[Keys.GAME], list_type='game')) context_menu.extend(menu_items.set_default_quality('stream', channel[Keys._ID], channel[Keys.NAME])) context_menu.extend(menu_items.run_plugin(i18n('play_choose_quality'), {'mode': MODES.PLAY, 'channel_id': channel[Keys._ID], 'ask': True, 'use_player': True})) return {'label': title, 'path': kodi.get_plugin_url({'mode': MODES.PLAY, 'channel_id': channel[Keys._ID]}), 'context_menu': context_menu, 'is_playable': True, 'info': info, 'content_type': 'video', 'art': the_art({'fanart': video_banner, 'poster': image, 'thumb': image, 'icon': image})}