def search(): query = plugin.keyboard(heading=_('title')) if query and len(query) > 3: log('search gots a string: "%s"' % query) videos, count = videos_scraper.Scraper().search_videos(query) items = __format_videos(videos) return plugin.finish(items)
def show_episodes_by_show(show_name): scraper = videos_scraper.Scraper() videos = scraper.get_episodes_by_show_name(show_name) items = __format_videos(videos) finish_kwargs = { 'sort_methods': ('PLAYLIST_ORDER', 'DATE', 'SIZE', 'DURATION'), 'update_listing': 'update' in plugin.request.args } return plugin.finish(items, **finish_kwargs)
def show_video_topics(): scraper = videos_scraper.Scraper() items = [{ 'label': topic['name'], 'path': plugin.url_for(endpoint='show_videos_by_topic', topic_id=topic['id'], page='1'), } for topic in scraper.get_video_topics()] items.append({ 'label': _('search'), 'path': plugin.url_for(endpoint='search') }) return plugin.finish(items)
def shows_ci_especial(page): scraper = videos_scraper.Scraper() page = int(page) menuargc = 'temaCanalId=126&canalId=126&tipoEmisionId=2' videos = scraper.get_single_episodes(menuargc, page) count = len(videos) items = __format_videos(videos) if count >= 15: next_page = str(page + 1) items.insert( 0, { 'label': '>> %s %s >>' % (_('page'), next_page), 'path': plugin.url_for(endpoint='shows_ci_especial', show_name='Especial', page=next_page, update='true') }) if page > 1: previous_page = str(page - 1) items.insert( 0, { 'label': '<< %s %s <<' % (_('page'), previous_page), 'path': plugin.url_for(endpoint='shows_ci_especial', show_name='Especial', page=previous_page, update='true') }) finish_kwargs = { 'sort_methods': ('PLAYLIST_ORDER', 'DATE', 'SIZE', 'DURATION'), 'update_listing': 'update' in plugin.request.args } return plugin.finish(items, **finish_kwargs)
def show_videos_by_topic(topic_id, page): scraper = videos_scraper.Scraper() limit = 30 page = int(page) start = (page - 1) * limit videos, count = scraper.get_videos_by_topic_id(topic_id, start, limit) items = __format_videos(videos) if count > page * limit: next_page = str(page + 1) items.insert( 0, { 'label': '>> %s %s >>' % (_('page'), next_page), 'path': plugin.url_for(endpoint='show_videos_by_topic', topic_id=topic_id, page=next_page, update='true') }) if page > 1: previous_page = str(page - 1) items.insert( 0, { 'label': '<< %s %s <<' % (_('page'), previous_page), 'path': plugin.url_for(endpoint='show_videos_by_topic', topic_id=topic_id, page=previous_page, update='true') }) finish_kwargs = { 'sort_methods': ('PLAYLIST_ORDER', 'DATE', 'SIZE', 'DURATION'), 'update_listing': 'update' in plugin.request.args } return plugin.finish(items, **finish_kwargs)
def play_video(id): video = videos_scraper.Scraper().get_video(id) return plugin.set_resolved_url(video['url'])
def play_video(id): video = videos_scraper.Scraper().get_video(id) return plugin.set_resolved_url(item=video['url'], subtitles=video['url_sub'])