예제 #1
0
def main(params):
    if not params.has_key('mode') or params['mode'] == 'categeories':
        
        logo = 'http://c3.cdn.sweflix.com/sweflxlogo2.png'
        categories = scraper.get_categories()
        for category, titel in categories.iteritems():
            utils.add_directory_link(titel.encode('utf-8'), 
                                     logo, 
                                     category, 
                                     '', 
                                     is_folder=True, 
                                     is_playable=False, 
                                     total_items=20)

    elif params['mode'] == 'ltst':
        videos = scraper.get_all_movies()
        for vid in videos:
            video = scraper.get_video_information(vid)
            try:
                add_video(video)
            except TypeError:
                print_video_error(video)

    elif params['mode'] == 'rec':
        videos=scraper.get_all_movies()
        for vid in videos:
            video = scraper.get_video_information(vid)
            if video['rek'] == '1':
                try:
                    add_video(video)
                except TypeError:
                    print_video_error(video)

    elif params['mode'] == 'pplr':
        videos=scraper.get_all_movies_views()
        for vid in videos:
            video = scraper.get_video_information(vid)
            try:
                add_video(video)
            except TypeError:
                print_video_error(video)
                
    elif params['mode'] == 'alpha':
        videos=scraper.get_all_movies_alpha()
        for vid in videos:
            video = scraper.get_video_information(vid)
            try:
                add_video(video)
            except TypeError:
                print_video_error(video)

    elif params['mode'] == 'play_video':
        utils.play_video(params['url'])
        subtitles=scraper.get_video_subtitle(params['srt'])
        player = xbmc.Player()
        while not xbmc.Player().isPlaying():
            xbmc.sleep(10000)
        player.setSubtitles(subtitles)
    utils.end_directory()
예제 #2
0
def show_categories():
    categories = scraper.get_categories()
    items = [{
        'label': category['title'],
        'path': plugin.url_for(
            endpoint='show_videos',
            category=category['link'],
            page='1',
        ),
    } for category in categories]
    return plugin.finish(items)
def show_categories():
    items = [{
        'label': category['title'],
        'path': plugin.url_for(
            endpoint='show_subcategories',
            path=category['path']
        )
    } for category in scraper.get_categories()]
    items.append({
        'label': _('search'),
        'path': plugin.url_for('video_search')}
    )
    return plugin.finish(items)
예제 #4
0
def show_categories():
    categories = scraper.get_categories()
    items = [{
        'label':
        category['title'],
        'path':
        plugin.url_for(
            endpoint='show_videos',
            category=category['link'],
            page='1',
        ),
    } for category in categories]
    return plugin.finish(items)
예제 #5
0
def show_categories():
    __log('show_categories start')
    entries = scraper.get_categories()
    items = [{
        'label': e['title'],
        'url': plugin.url_for('show_subcategories', path=e['path'])
    } for e in entries]
    items.append({
        'label': plugin.get_string(30001),
        'url': plugin.url_for('video_search')
    })
    __log('show_categories end')
    return plugin.add_items(items)
def main(params):
    if not params.has_key('mode') or params['mode'] == 'list_categories':
        html = scraper.open_page('https://www.thenewboston.com/videos.php')
        categories = scraper.get_categories(html)
        logo = 'http://thenewboston.com/images/theNewBoston_logo.png'
        for category in categories:
            utils.add_directory_link(category['title'], 
                                     logo, 
                                     'list_topics', 
                                     category['title'], 
                                     is_folder=True, 
                                     is_playable=False, 
                                     total_items=20)

    elif params['mode'] == 'list_topics':
        title = params['url']
        html = scraper.open_page('https://www.thenewboston.com/videos.php')
        topics = scraper.get_topics(html, title)
        logo = 'http://thenewboston.com/images/theNewBoston_logo.png'
        for topic in topics:
            utils.add_directory_link(topic['title'], 
                                     logo, 
                                     'list_lessons', 
                                     quote(topic['url']), 
                                     is_folder=True, 
                                     is_playable=False,
                                     total_items=int(topic['count']))

    elif params['mode'] == 'list_lessons':
        url = unquote(params['url'])
        html = scraper.open_page(url)
        lessons = scraper.get_lessons(html)
        logo = 'http://thenewboston.com/images/theNewBoston_logo.png'
        for lesson in lessons:
            utils.add_directory_link(lesson['title'], 
                                     logo, 
                                     'play_video', 
                                     quote(lesson['url']), 
                                     is_folder=False, 
                                     is_playable=True,
                                     total_items=1)


    elif params['mode'] == 'play_video':
        html = scraper.open_page(unquote(params['url']))
        youtube_url, youtube_id = scraper.get_youtube(html)
        url = ("plugin://plugin.video.youtube/?path=/root/video"
               "&action=play_video&videoid={0}").format(youtube_id)
        utils.play_video(url)

    utils.end_directory()
예제 #7
0
def show_categories():
    items = [{
        'label':
        category['title'],
        'path':
        plugin.url_for(endpoint='show_path', path=category['path'])
    } for category in scraper.get_categories()]
    items.append({
        'label': _('search'),
        'path': plugin.url_for('video_search')
    })
    items.append({
        'label': _('show_my_favs'),
        'path': plugin.url_for('show_my_favs')
    })
    return plugin.finish(items)
예제 #8
0
def index():
    items = []
    #Suche
    items.append({
        'label': 'Search',
        'path': plugin.url_for(
            endpoint='search',
        ),
        'is_playable': False
        })
    #Kategorien
    for category in scraper.get_categories():
        items.append({
        'label': category['title'],
        'path': plugin.url_for(
            endpoint='show_category',
            path=category['path'],
        ),
        'is_playable': False
        })
    return plugin.finish(items)