def all_videos():
    #grab kwargs
    page_num = int(
        plugin.args["page"][0]) if "page" in plugin.args.keys() else 1
    token = plugin.args["token"][0] if "token" in plugin.args.keys() else ""
    playlist = plugin.args["playlist"][0] if "playlist" in plugin.args.keys(
    ) else "all"
    upload_playlist = youtubelib.get_upload_playlist(
    ) if playlist == "all" else playlist

    for liz in youtubelib.get_videos(playlist, upload_playlist, token,
                                     page_num):
        if liz.getProperty("type") == "youtube_video":
            addDirectoryItem(plugin.handle,
                             plugin.url_for(play, liz.getProperty("videoid")),
                             liz, False)
        elif liz.getProperty("type") == "next":
            addDirectoryItem(
                plugin.handle,
                plugin.url_for(all_videos,
                               playlist=playlist,
                               page=int(liz.getProperty("page")),
                               token=liz.getProperty("token")), liz, True)
    kodiutils.add_sort_methods(plugin.handle)
    xbmcplugin.setContent(plugin.handle, 'episodes')
    endOfDirectory(plugin.handle)
Exemplo n.º 2
0
def all_videos():
    #grab kwargs
    page_num = int(plugin.args["page"][0]) if "page" in plugin.args.keys() else 1
    token = plugin.args["token"][0] if "token" in plugin.args.keys() else ""
    playlist = plugin.args["playlist"][0] if "playlist" in plugin.args.keys() else "all"
    upload_playlist = youtubelib.get_upload_playlist() if playlist == "all" else playlist

    for liz in youtubelib.get_videos(playlist, upload_playlist, token, page_num):
        if liz.getProperty("type") == "youtube_video":
            addDirectoryItem(plugin.handle, plugin.url_for(play, liz.getProperty("videoid")), liz, False)
        elif liz.getProperty("type") == "next":
            addDirectoryItem(plugin.handle, plugin.url_for(all_videos, playlist=playlist, page=int(liz.getProperty("page")), token=liz.getProperty("token")), liz, True)
    kodiutils.add_sort_methods(plugin.handle)
    xbmcplugin.setContent(plugin.handle, 'episodes')
    endOfDirectory(plugin.handle)