def show_page(page): if page is 1: return show_page1() videos, has_next_page = scraper.get_videos(page) items = [{ 'label': video['title'], 'thumbnail': video['thumbnail'], 'info': { 'originaltitle': video['title'] }, 'path': plugin.url_for(endpoint='watch_video', video_id=video['url']), 'is_playable': True, } for video in videos] if has_next_page: next_page = str(int(page) + 1) items.append({ 'label': '>> page %s >>' % (next_page), 'path': plugin.url_for(endpoint='show_page', page=next_page), }) return plugin.finish(items)
def show_videos(movie_id): movie, trailers, clips = scraper.get_videos(movie_id) downloads = plugin.get_storage('downloads') resolution = plugin.get_setting( 'resolution', choices=('480p', '720p', '1080p') ) show_trailer = plugin.get_setting('show_trailer', bool) show_clips = plugin.get_setting('show_clips', bool) show_source_in_title = plugin.get_setting('show_source_in_title', bool) videos = [] if show_trailer: videos.extend(trailers) if show_clips: videos.extend(clips) items = [] for i, video in enumerate(videos): if resolution in video.get('resolutions'): url = video['resolutions'][resolution] if show_source_in_title: title = '%s (%s)' % (video['title'], video['source']) else: title = video['title'] if url in downloads: import xbmcvfs # FIXME: import from swift after fixed there if xbmcvfs.exists(downloads[url]): title = '%s - %s' % (title, _('already_downloaded')) else: title = '%s - %s' % (title, _('download_in_progress')) items.append({ 'label': title, 'thumbnail': movie['thumb'], 'info': { 'studio': movie['title'], 'tagline': video['source'], 'date': video['date'], 'count': i, }, 'context_menu': [ (_('download'), 'XBMC.RunPlugin(%s)' % plugin.url_for( endpoint='download_video', source=video['source'], url=url )) ], 'is_playable': True, 'path': plugin.url_for( endpoint='play_video', source=video['source'], url=url ), }) finish_kwargs = { 'sort_methods': ('DATE', 'TITLE', 'PLAYLIST_ORDER') } return plugin.finish(items, **finish_kwargs)
def show_videos(movie_id): movie, trailers, clips = scraper.get_videos(movie_id) downloads = plugin.get_storage('downloads') resolution = plugin.get_setting('resolution', choices=('480p', '720p', '1080p')) show_trailer = plugin.get_setting('show_trailer', bool) show_clips = plugin.get_setting('show_clips', bool) show_source_in_title = plugin.get_setting('show_source_in_title', bool) videos = [] if show_trailer: videos.extend(trailers) if show_clips: videos.extend(clips) items = [] for i, video in enumerate(videos): if resolution in video.get('resolutions'): url = video['resolutions'][resolution] if show_source_in_title: title = '%s (%s)' % (video['title'], video['source']) else: title = video['title'] if url in downloads: import xbmcvfs # FIXME: import from swift after fixed there if xbmcvfs.exists(downloads[url]): title = '%s - %s' % (title, _('already_downloaded')) else: title = '%s - %s' % (title, _('download_in_progress')) items.append({ 'label': title, 'thumbnail': movie['thumb'], 'info': { 'studio': movie['title'], 'tagline': video['source'], 'date': video['date'], 'count': i, }, 'context_menu': [(_('download'), 'XBMC.RunPlugin(%s)' % plugin.url_for( endpoint='download_video', source=video['source'], url=url))], 'is_playable': True, 'path': plugin.url_for(endpoint='play_video', source=video['source'], url=url), }) finish_kwargs = {'sort_methods': ('DATE', 'TITLE', 'PLAYLIST_ORDER')} return plugin.finish(items, **finish_kwargs)
def show_root(): videos = scraper.get_videos() shuffle(videos) items = [{ 'label': u'%s - %s' % (video['interpret'], video['title']), 'thumbnail': video['thumb'], 'is_playable': True, 'path': plugin.url_for('play_video', video_url=video['video_url']) } for video in videos] finish_kwargs = {} if plugin.get_setting('force_viewmode', bool): finish_kwargs['view_mode'] = 'thumbnail' return plugin.finish(items, **finish_kwargs)
def show_root(): videos = scraper.get_videos() shuffle(videos) items = [{ 'label': u'%s - %s' % (video['interpret'], video['title']), 'thumbnail': video['thumb'], 'is_playable': True, 'path': plugin.url_for( 'play_video', video_url=video['video_url'] ) } for video in videos] finish_kwargs = {} if plugin.get_setting('force_viewmode', bool): finish_kwargs['view_mode'] = 'thumbnail' return plugin.finish(items, **finish_kwargs)
def show_videos(movie_id): movie, trailers, clips = scraper.get_videos(movie_id) resolution_setting = int(plugin.get_setting('resolution')) resolution = ('480p', '720p', '1080p')[resolution_setting] show_trailer = plugin.get_setting('show_trailer') == 'true' show_clips = plugin.get_setting('show_clips') == 'true' show_source_in_title = plugin.get_setting('show_source_in_title') == 'true' videos = [] if show_trailer: videos.extend(trailers) if show_clips: videos.extend(clips) items = [] for i, video in enumerate(videos): if resolution in video.get('resolutions'): if show_source_in_title: title = '%s (%s)' % (video['title'], video['source']) else: title = video['title'] items.append({ 'label': title, 'thumbnail': movie['thumb'], 'info': { 'studio': movie['title'], 'tagline': video['source'], 'date': video['date'], 'count': i, }, 'is_playable': True, 'path': plugin.url_for( endpoint='play_video', source=video['source'], url=video['resolutions'][resolution] ), }) finish_kwargs = { 'sort_methods': ('DATE', 'TITLE', 'PLAYLIST_ORDER') } return plugin.finish(items, **finish_kwargs)
def show_videos(movie_id): movie, trailers, clips = scraper.get_videos(movie_id) resolution_setting = int(plugin.get_setting('resolution')) resolution = ('480p', '720p', '1080p')[resolution_setting] show_trailer = plugin.get_setting('show_trailer') == 'true' show_clips = plugin.get_setting('show_clips') == 'true' show_source_in_title = plugin.get_setting('show_source_in_title') == 'true' videos = [] if show_trailer: videos.extend(trailers) if show_clips: videos.extend(clips) items = [] for i, video in enumerate(videos): if resolution in video.get('resolutions'): if show_source_in_title: title = '%s (%s)' % (video['title'], video['source']) else: title = video['title'] items.append({ 'label': title, 'icon': movie['thumb'], 'info': { 'studio': movie['title'], 'tagline': video['source'], 'date': video['date'], 'count': i, }, 'is_playable': True, 'path': plugin.url_for(endpoint='play_video', source=video['source'], url=video['resolutions'][resolution]), }) finish_kwargs = {'sort_methods': ('DATE', 'TITLE', 'PLAYLIST_ORDER')} return plugin.finish(items, **finish_kwargs)
def show_videos(category, page): videos, has_next_page = scraper.get_videos(category, page) items = [{ 'label': video['title'], 'thumbnail': video['image'], 'info': { 'originaltitle': video['title'] }, 'path': plugin.url_for( endpoint='watch_video', video_id=video['video_id'] ), 'is_playable': True, } for video in videos] if has_next_page: next_page = str(int(page) + 1) items.append({ 'label': '>> %s %s >>' % ( plugin.get_string(30001), next_page ), 'path': plugin.url_for( endpoint='show_videos', category=category, page=next_page ), }) if int(page) > 1: prev_page = str(int(page) - 1) items.insert(0, { 'label': '<< %s %s <<' % ( plugin.get_string(30001), prev_page ), 'path': plugin.url_for( endpoint='show_videos', category=category, page=prev_page ), }) return plugin.finish(items)
def show_videos(category, page): videos, has_next_page = scraper.get_videos(category, page) items = [{ 'label': video['title'], 'thumbnail': video['image'], 'info': { 'originaltitle': video['title'] }, 'path': plugin.url_for(endpoint='watch_video', video_id=video['video_id']), 'is_playable': True, } for video in videos] if has_next_page: next_page = str(int(page) + 1) items.append({ 'label': '>> %s %s >>' % (plugin.get_string(30001), next_page), 'path': plugin.url_for(endpoint='show_videos', category=category, page=next_page), }) if int(page) > 1: prev_page = str(int(page) - 1) items.insert( 0, { 'label': '<< %s %s <<' % (plugin.get_string(30001), prev_page), 'path': plugin.url_for( endpoint='show_videos', category=category, page=prev_page), }) return plugin.finish(items)
def show_category(path, season='0'): items = [] for video in scraper.get_videos(path, season): if video['type'] == 'video': print video['title'] items.append({ 'label': video['title'], 'path': plugin.url_for( endpoint='show_video', videoId=video['id'],), 'thumbnail': video['img'], 'info':{}, 'is_playable': True }) elif video['type'] == 'season': items.append({ 'label': 'Staffel '+video['title'], 'path': plugin.url_for( endpoint='show_category_season', path=path, season=video['id']), 'is_playable': False }) return plugin.finish(items)