예제 #1
0
def __C_MENU(C_ID):
    #0: Refresh
    #1: Delete
    menuItems = [AddonString(30031), AddonString(30039)]
    try:
        ret = xbmcgui.Dialog().select(
            'Manage: ' + CONFIG['channels'][C_ID]['channel_name'], menuItems)
        if ret == 0:
            __parse_uploads(False, CONFIG['channels'][C_ID]['playlist_id'])
        elif ret == 1:
            cname = CONFIG['channels'][C_ID]['channel_name']
            cdir = CHANNELS + '\\' + C_ID
            __logger(cdir)
            #Are you sure to remove X...
            ret = xbmcgui.Dialog().yesno(
                AddonString(30035).format(cname),
                AddonString(30036).format(cname))
            if ret == True:
                local_index_file = CHANNELS + '\\' + C_ID + '\\index.json'
                __Remove_from_index(local_index_file)
                CONFIG['channels'].pop(C_ID)
                __save()
                #Remove from library?
                ret = xbmcgui.Dialog().yesno(
                    AddonString(30035).format(cname),
                    AddonString(30037).format(cname))
                if ret:
                    success = recursive_delete_dir(cdir)
                    if success:
                        xbmc.executebuiltin("CleanLibrary(video)")
        else:
            pass
    except KeyError:
        pass
예제 #2
0
def __MUSIC_MENU(C_ID):
    #0: Refresh
    #1: Delete
    menuItems = [AddonString(30031), AddonString(30039)]
    try:
        ret = xbmcgui.Dialog().select(
            'Manage: ' + CONFIG['music_videos'][C_ID]['channel_name'],
            menuItems)
        if ret == 0:
            __parse_music(False, CONFIG['music_videos'][C_ID]['playlist_id'])
        elif ret == 1:
            cname = CONFIG['music_videos'][C_ID]['channel_name']
            cdir = MUSIC_VIDEOS + '\\' + C_ID
            __logger(cdir)
            #Are you sure to remove X...
            ret = xbmcgui.Dialog().yesno(
                AddonString(30035).format(cname),
                AddonString(30036).format(cname))
            if ret == True:
                CONFIG['music_videos'].pop(C_ID)
                __save()
                #Remove from library?
                ret = xbmcgui.Dialog().yesno(
                    AddonString(30035).format(cname),
                    AddonString(30037).format(cname))
                if ret:
                    success = recursive_delete_dir(cdir)
                    if success:
                        xbmc.executebuiltin("CleanLibrary(video)")
    except KeyError:
        pass
예제 #3
0
def __parse_music(fullscan, playlist_id, page_token=None, update=False):
    __logger('Getting info for playlist: ' + playlist_id)
    url = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=50&playlistId=" + playlist_id + "&key=" + addon.getSetting(
        'API_key')
    reply = c_download(url)
    last_video_id = 'Nevergonnagiveyouup'
    while True:
        reply = c_download(url)
        vid = []
        totalResults = int(reply['pageInfo']['totalResults'])
        if addon.getSetting('toggle_import_limit') == 'true':
            totalResults = min(int(reply['pageInfo']['totalResults']),
                               int(addon.getSetting('import_limit')))
        if (PARSER['total_steps'] == 0):
            PARSER['total_steps'] = int(totalResults * 4)
        PARSER['total'] = totalResults
        if PARSER['steps'] < 1 and LOCAL_CONF['update'] == False:
            PDIALOG.create(AddonString(30016), AddonString(30025))
        try:
            if 'last_video' in CONFIG['music_videos'][
                    reply['items'][0]['snippet']['channelId']]:
                last_video_id = CONFIG['music_videos'][reply['items'][0][
                    'snippet']['channelId']]['last_video']['video_id']
        except KeyError:
            pass
            __logger('no previous scan found')
        for item in reply['items']:
            if LOCAL_CONF['update'] == False and PDIALOG.iscanceled():
                return
            season = int(
                item['snippet']['publishedAt'].split('T')[0].split('-')[0])
            VIDEOS.append(item)
            PARSER['items'] += 1
            PARSER['steps'] += 1
            if item['snippet']['resourceId']['videoId'] == last_video_id:
                break
            vid.append(item['snippet']['resourceId']['videoId'])
            if LOCAL_CONF['update'] == False:
                # There seems to be a problem with \n and progress dialog in leia
                # so let's not use it in leia....
                if PY_V >= 3:
                    # "Downloading channel info"
                    dialog_string = AddonString(30016) + str(
                        PARSER['items']) + '/' + str(PARSER['total'])
                else:
                    dialog_string = AddonString(30016) + str(
                        PARSER['items']) + '/' + str(PARSER['total'])
                PDIALOG.update(
                    int(100 * PARSER['steps'] / PARSER['total_steps']),
                    dialog_string)
        __get_video_details(vid)
        if 'nextPageToken' not in reply or not fullscan or PARSER[
                'items'] >= PARSER['total']:
            break
        page_token = reply['nextPageToken']
        url = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=50&playlistId=" + playlist_id + "&pageToken=" + page_token + "&key=" + addon.getSetting(
            'API_key')
    if len(VIDEOS) > 0:
        __render('music')
예제 #4
0
def __get_video_details(array):
    x = [array[i:i + 50] for i in range(0, len(array), 50)]
    for stacks in x:
        get = ','.join(stacks)
        url = "https://www.googleapis.com/youtube/v3/videos?part=contentDetails&id=" + get + "&key=" + addon.getSetting(
            'API_key')
        reply = c_download(url)
        for item in reply['items']:
            VIDEO_DURATION[item['id']] = __yt_duration(
                item['contentDetails']['duration'])
            if VIDEO_DURATION[item['id']] == "0":
                __logger('Buggy ass video: ' + item['id'])
            PARSER['steps'] += 1
예제 #5
0
def __select_playlists(a, C_ID=[], selected=None):
    menuItems = []
    _preselect = []
    __logger(a)
    #__logger(json.dumps(a, indent=4, sort_keys=True))
    if C_ID:
        for idx, i in enumerate(a['items']):
            menuItems.append(i['snippet']['title'])
            if i['id'] in CONFIG['playlists'][C_ID]['playlist_id']:
                _preselect.append(idx)
        dialog = xbmcgui.Dialog()
        #Choose playlists
        ret = dialog.multiselect(AddonString(30049),
                                 menuItems,
                                 preselect=_preselect)
        if ret:
            __logger(ret)
            playlist_ids = []
            for x in ret:
                playlist_ids.append(a['items'][x]['id'])
            return playlist_ids
        else:
            sys.exit("Nothing chosen")
    else:
        for i in a['items']:
            menuItems.append(i['snippet']['title'])
        __logger(a['items'])
        dialog = xbmcgui.Dialog()
        #Choose playlist
        ret = dialog.multiselect(AddonString(30049), menuItems)
        if ret:
            __logger(ret)
            playlist_ids = []
            title_suggestion = a['items'][min(ret)]['snippet']['title']
            for x in ret:
                playlist_ids.append(a['items'][x]['id'])
            __logger(playlist_ids)
            #Name of playlist
            playlist_title = __ask(title_suggestion, AddonString(30050))
            return_object = {}
            return_object['title'] = playlist_title
            return_object['items'] = playlist_ids
            return return_object
        else:
            sys.exit("Nothing chosen")
예제 #6
0
def __Remove_from_index(a):
    index_file = addon_path + '\\index.json'
    if xbmcvfs.exists(index_file):
        if PY_V >= 3:
            with xbmcvfs.File(index_file) as f:  # PYTHON 3 v19+
                INDEX = json.load(f)  #
        else:
            f = xbmcvfs.File(index_file)  # PYTHON 2 v18+
            INDEX = json.loads(f.read())
            f.close()

    local_index_file = a
    if PY_V >= 3:
        with xbmcvfs.File(local_index_file) as f:  # PYTHON 3 v19+
            LOCAL_INDEX = json.load(f)  #
    else:
        f = xbmcvfs.File(local_index_file)  # PYTHON 2 v18+
        LOCAL_INDEX = f.read()
        f.close()
    res = list(filter(lambda i: i not in LOCAL_INDEX, INDEX))
    INDEX = res
    __logger(INDEX)
    __save(data=INDEX, file=index_file)
예제 #7
0
def __PLAYLIST_MENU(C_ID):
    #0: Refresh
    #1: Delete
    menuItems = [
        AddonString(30031), 'add/remove playlist items',
        AddonString(30039)
    ]
    try:
        ret = xbmcgui.Dialog().select(
            'Manage: ' + CONFIG['playlists'][C_ID]['channel_name'], menuItems)
        if ret == 0:
            __parse_playlists(False, CONFIG['playlists'][C_ID]['playlist_id'],
                              C_ID)
        elif ret == 1:
            playlists = __get_playlists(
                CONFIG['playlists'][C_ID]['original_channel_id'])
            data_set = __select_playlists(playlists, C_ID)
            if data_set:
                __logger(data_set)
                __logger('playlists follows:')
                CONFIG['playlists'][C_ID].pop('playlist_id')
                CONFIG['playlists'][C_ID]['playlist_id'] = data_set
                __save()

        elif ret == 2:
            cname = CONFIG['playlists'][C_ID]['channel_name']
            cdir = CHANNELS + '\\' + C_ID
            __logger(cdir)
            #Are you sure to remove X...
            ret = xbmcgui.Dialog().yesno(
                AddonString(30035).format(cname),
                AddonString(30036).format(cname))
            if ret == True:
                local_index_file = CHANNELS + '\\' + C_ID + '\\index.json'
                __Remove_from_index(local_index_file)
                CONFIG['playlists'].pop(C_ID)
                __save()
                #Remove from library?
                ret = xbmcgui.Dialog().yesno(
                    AddonString(30035).format(cname),
                    AddonString(30037).format(cname))
                if ret:
                    success = recursive_delete_dir(cdir)
                    if success:
                        xbmc.executebuiltin("CleanLibrary(video)")
        else:
            pass
    except KeyError:
        pass
예제 #8
0
def __folders(*args):
    if 'search' in args:
        smode = args[1]
        #__print(smode)
        for items in SEARCH_QUERY:
            __logger(json.dumps(items))
            li = xbmcgui.ListItem(items['title'])
            info = {'plot': items['description']}
            li.setInfo('video', info)
            li.setArt({'thumb': items['thumbnail']})
            url = __build_url({'mode': 'AddItem_'+smode, 'foldername': items['id'] })
            xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)

    elif 'Manage' in args:
#TV-shows:
        thumb = addon_resources+'/media/buttons/TV_show.png'
        li = xbmcgui.ListItem(AddonString(30043)+':')
        li.setArt({'thumb': thumb})
        xbmcplugin.addDirectoryItem(handle=addon_handle, url='', listitem=li, isFolder=False)
        for items in CONFIG['channels']:
            plot = ""
            thumb = addon_resources+'/media/youtube_logo.jpg'
            if 'branding' in CONFIG['channels'][items]:
                thumb = CONFIG['channels'][items]['branding']['thumbnail']
                plot = CONFIG['channels'][items]['branding']['description']
                fanart = CONFIG['channels'][items]['branding']['fanart']
                banner = CONFIG['channels'][items]['branding']['banner']
            li = xbmcgui.ListItem(CONFIG['channels'][items]['channel_name'])
            info = {'plot': plot}
            li.setInfo('video', info)
            li.setArt({'thumb': thumb})
            #li.addContextMenuItems([('Rescan', ''),('Remove','')])
            url = __build_url({'mode': 'C_MENU', 'foldername': items })
            xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)


#TV PLAYLISTS
        thumb = addon_resources+'/media/buttons/TV_playlist.png'
        li = xbmcgui.ListItem(AddonString(30045)+':')
        li.setArt({'thumb': thumb})
        xbmcplugin.addDirectoryItem(handle=addon_handle, url='', listitem=li, isFolder=False)
        for items in CONFIG['playlists']:
            plot = ""
            thumb = addon_resources+'/media/youtube_logo.jpg'
            if 'branding' in CONFIG['playlists'][items]:
                thumb = CONFIG['playlists'][items]['branding']['thumbnail']
                plot = CONFIG['playlists'][items]['branding']['description']
                fanart = CONFIG['playlists'][items]['branding']['fanart']
                banner = CONFIG['playlists'][items]['branding']['banner']
            li = xbmcgui.ListItem(CONFIG['playlists'][items]['channel_name'])
            info = {'plot': plot}
            li.setInfo('video', info)
            li.setArt({'thumb': thumb})
            #li.addContextMenuItems([('Rescan', ''),('Remove','')])
            url = __build_url({'mode': 'PLAYLIST_MENU', 'foldername': items })
            xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)




#Music videos
        if len(CONFIG['music_videos']) > 0:
#SEPARATOR
            thumb = addon_resources+'/media/buttons/empty.png'
            li = xbmcgui.ListItem(' ')
            li.setArt({'thumb': thumb})
            li.setInfo('video', {'plot':'Oh hi there! :)'})
            xbmcplugin.addDirectoryItem(handle=addon_handle, url='plugin://'+addonID, listitem=li, isFolder=False)        


            thumb = addon_resources+'/media/buttons/Music_video.png'
            li = xbmcgui.ListItem(AddonString(30042)+':')
            li.setArt({'thumb': thumb})
            xbmcplugin.addDirectoryItem(handle=addon_handle, url='', listitem=li, isFolder=False)
            for items in CONFIG['music_videos']:
                plot = ""
                thumb = addon_resources+'/media/youtube_logo.jpg'
                if 'branding' in CONFIG['music_videos'][items]:
                    thumb = CONFIG['music_videos'][items]['branding']['thumbnail']
                    plot = CONFIG['music_videos'][items]['branding']['description']
                    fanart = CONFIG['music_videos'][items]['branding']['fanart']
                    banner = CONFIG['music_videos'][items]['branding']['banner']
                li = xbmcgui.ListItem(CONFIG['music_videos'][items]['channel_name'])
                info = {'plot': plot}
                li.setInfo('video', info)
                li.setArt({'thumb': thumb})
                #li.addContextMenuItems([('Rescan', ''),('Remove','')])
                url = __build_url({'mode': 'MUSIC_MENU', 'foldername': items })
                xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)



    elif 'menu' in args:

#ADD CHANNEL [as a tv show]       
        thumb = addon_resources+'/media/buttons/Add_TV_show.png'
        li = xbmcgui.ListItem(AddonString(30028) +' ['+AddonString(30040)+']')
        li.setArt({'thumb': thumb})
        url = __build_url({'mode': 'ManageItem', 'foldername': 'Add_Channel_tv' })
        xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)
#ADD CHANNEL PLAYLIST[as a tv show]       
        thumb = addon_resources+'/media/buttons/Add_TV_show.png'
        li = xbmcgui.ListItem(AddonString(30028) +' playlist ['+AddonString(30040)+']' )
        li.setArt({'thumb': thumb})
        url = __build_url({'mode': 'ManageItem', 'foldername': 'Add_Channel_tv_playlist' })
        xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)        
#ADD CHANNEL        
        thumb = addon_resources+'/media/buttons/Add_Music_video.png'
        li = xbmcgui.ListItem(AddonString(30028) +' ['+AddonString(30041)+']')
        li.setArt({'thumb': thumb})
        url = __build_url({'mode': 'ManageItem', 'foldername': 'Add_Channel_music' })
        xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)
#Manage        
        thumb = addon_resources+'/media/buttons/Manage.png'
        li = xbmcgui.ListItem(AddonString(30029))
        li.setArt({'thumb': thumb})
        url = __build_url({'mode': 'ManageItem', 'foldername': 'Manage' })
        xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)
#ADD CHANNEL        
        thumb = addon_resources+'/media/buttons/Refresh_All.png'
        li = xbmcgui.ListItem(AddonString(30030))
        li.setArt({'thumb': thumb})
        url = __build_url({'mode': 'ManageItem', 'foldername': 'Refresh_all' })
        xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)        
#SEPARATOR
        thumb = addon_resources+'/media/buttons/empty.png'
        li = xbmcgui.ListItem(' ')
        li.setArt({'thumb': thumb})
        xbmcplugin.addDirectoryItem(handle=addon_handle, url='plugin://'+addonID, listitem=li, isFolder=True)
#False
        thumb = addon_resources+'/media/buttons/empty.png'
        li = xbmcgui.ListItem(' ')
        li.setArt({'thumb': thumb})
        xbmcplugin.addDirectoryItem(handle=addon_handle, url='plugin://'+addonID, listitem=li, isFolder=False)        
#SEPARATOR
        thumb = addon_resources+'/media/buttons/empty.png'
        li = xbmcgui.ListItem(' ')
        li.setArt({'thumb': thumb})
        li.setInfo('video', {'plot':'Oh hi there! :)'})
        xbmcplugin.addDirectoryItem(handle=addon_handle, url='plugin://'+addonID, listitem=li, isFolder=False)        
#SEPARATOR
        thumb = addon_resources+'/media/buttons/empty.png'
        li = xbmcgui.ListItem(' ')
        li.setArt({'thumb': thumb})
        xbmcplugin.addDirectoryItem(handle=addon_handle, url='plugin://'+addonID, listitem=li, isFolder=False)                
#ADDON SETTINGS
        thumb = addon_resources+'/media/buttons/Settings.png'
        li = xbmcgui.ListItem('Addon Settings')
        li.setArt({'thumb': thumb})
        li.addContextMenuItems([('Rescan', ''),('Remove','')])
        url = __build_url({'mode': 'OpenSettings', 'foldername': ' ' })
        xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)
#ADDON INFO (Next update)
        if 'last_scan' in CONFIG:
            now = int(time.time())
            countdown=int(CONFIG['last_scan'] + int(xbmcaddon.Addon().getSetting('update_interval'))*3600)
            thumb = addon_resources+'/media/buttons/Update.png'
            li = xbmcgui.ListItem(AddonString(30033) + convert(countdown - now),'text')
            li.setArt({'thumb': thumb})
            li.setInfo('video', {'plot': AddonString(30034) + '\n' + convert(__get_token_reset(),'text') })
            li.addContextMenuItems([('Rescan', ''),('Remove','')])
            url = __build_url({'mode': 'OpenSettings', 'foldername': ' ' })
            xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=False)
            now = int(time.time())
    xbmcplugin.endOfDirectory(addon_handle)
예제 #9
0
def __parse_uploads(fullscan, playlist_id, page_token=None, update=False):

    __logger('Getting info for playlist: ' + playlist_id)
    url = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=50&playlistId=" + playlist_id + "&key=" + addon.getSetting(
        'API_key')
    reply = c_download(url)
    last_video_id = 'Nevergonnagiveyouup'
    while True:
        reply = c_download(url)
        vid = []
        totalResults = int(reply['pageInfo']['totalResults'])
        if addon.getSetting('toggle_import_limit') == 'true':
            totalResults = min(int(reply['pageInfo']['totalResults']),
                               int(addon.getSetting('import_limit')))
        if (PARSER['total_steps'] == 0):
            PARSER['total_steps'] = int(totalResults * 4)
        PARSER['total'] = totalResults

        # needed because of changes to folder structure as it now uses channel id for folder name
        # instead of stripped down channel name (no need to worry about non ASCII characters.)
        if not xbmcvfs.exists(CHANNELS + '\\' +
                              reply['items'][0]['snippet']['channelId'] +
                              '\\' + 'tvshow.nfo'):
            success = __add_channel(reply['items'][0]['snippet']['channelId'],
                                    'just_the_info')
            __logger('great success')
        if PARSER['steps'] < 1 and LOCAL_CONF['update'] == False:
            PDIALOG.create(AddonString(30016), AddonString(30025))
        try:
            if 'last_video' in CONFIG['channels'][reply['items'][0]['snippet']
                                                  ['channelId']]:
                last_video_id = CONFIG['channels'][reply['items'][0][
                    'snippet']['channelId']]['last_video']['video_id']
        except KeyError:
            __logger('no previous scan found')
        for item in reply['items']:
            if LOCAL_CONF['update'] == False and PDIALOG.iscanceled():
                return
            season = int(
                item['snippet']['publishedAt'].split('T')[0].split('-')[0])
            VIDEOS.append(item)
            PARSER['items'] += 1
            PARSER['steps'] += 1
            item_vid = item['snippet']['resourceId']['videoId']
            if item_vid == last_video_id:
                break
            if item_vid in INDEX:
                break
            vid.append(item['snippet']['resourceId']['videoId'])
            INDEX.append(item['snippet']['resourceId']['videoId'])
            if LOCAL_CONF['update'] == False:
                # There seems to be a problem with \n and progress dialog in leia
                # so let's not use it in leia....
                if PY_V >= 3:
                    # "Downloading channel info"
                    dialog_string = AddonString(30016) + str(
                        PARSER['items']) + '/' + str(
                            PARSER['total']) + '\n' + AddonString(30017) + str(
                                season)
                else:
                    dialog_string = AddonString(30016) + str(
                        PARSER['items']) + '/' + str(
                            PARSER['total']) + '     ' + AddonString(
                                30017) + str(season)
                PDIALOG.update(
                    int(100 * PARSER['steps'] / PARSER['total_steps']),
                    dialog_string)
        __get_video_details(vid)
        if 'nextPageToken' not in reply or not fullscan or PARSER[
                'items'] >= PARSER['total']:
            break
        page_token = reply['nextPageToken']
        url = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=50&playlistId=" + playlist_id + "&pageToken=" + page_token + "&key=" + addon.getSetting(
            'API_key')
    if len(VIDEOS) > 0:
        __render('tv')
예제 #10
0
def __parse_playlists(fullscan,
                      playlists,
                      channel_id,
                      page_token=None,
                      update=False):
    local_index_file = CHANNELS + '\\' + channel_id + '\\index.json'
    if xbmcvfs.exists(local_index_file):
        if PY_V >= 3:
            with xbmcvfs.File(local_index_file) as f:  # PYTHON 3 v19+
                LOCAL_INDEX = json.load(f)  #
        else:
            f = xbmcvfs.File(local_index_file)  # PYTHON 2 v18+
            LOCAL_INDEX = json.loads(f.read())
            f.close()
    else:
        LOCAL_INDEX = []

    __logger(playlists)
    for enum, playlist_id in enumerate(playlists):
        __logger('Getting info for playlist: ' + playlist_id)
        url = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=50&playlistId=" + playlist_id + "&key=" + addon.getSetting(
            'API_key')
        #reply = c_download(url)
        last_video_id = 'Nevergonnagiveyouup'
        while True:
            PARSER['items'] = 0
            reply = c_download(url)
            vid = []
            totalResults = int(reply['pageInfo']['totalResults'])
            if addon.getSetting('toggle_import_limit') == 'true':
                totalResults = min(int(reply['pageInfo']['totalResults']),
                                   int(addon.getSetting('import_limit')))
            if (PARSER['total_steps'] == 0):
                PARSER['total_steps'] = int(totalResults * 4)
            PARSER['total'] = totalResults
            if PARSER['steps'] < 1 and LOCAL_CONF['update'] == False:
                PDIALOG.create(AddonString(30016), AddonString(30025))

            for item in reply['items']:
                if LOCAL_CONF['update'] == False and PDIALOG.iscanceled():
                    return
                season = int(
                    item['snippet']['publishedAt'].split('T')[0].split('-')[0])
                item['snippet']['channelId'] = channel_id
                item['snippet']['channelId'] = channel_id
                PARSER['items'] += 1
                PARSER['steps'] += 1
                item_vid = item['snippet']['resourceId']['videoId']
                if item_vid in INDEX:
                    break
                VIDEOS.append(item)
                vid.append(item['snippet']['resourceId']['videoId'])
                INDEX.append(item['snippet']['resourceId']['videoId'])
                if LOCAL_CONF['update'] == False:
                    # There seems to be a problem with \n and progress dialog in leia
                    # so let's not use it in leia....
                    if PY_V >= 3:
                        # "Downloading channel info"
                        dialog_string = AddonString(30051) + str(
                            enum) + '/' + str(len(
                                playlists)) + '\n' + AddonString(30046) + str(
                                    PARSER['items']) + '/' + str(
                                        PARSER['total']) + '\n' + AddonString(
                                            30017) + str(season)
                    else:
                        dialog_string = AddonString(30051) + str(
                            enum
                        ) + '/' + str(
                            len(playlists)
                        ) + '                                                                           ' + AddonString(
                            30046) + str(PARSER['items']) + '/' + str(
                                PARSER['total']) + '     ' + AddonString(
                                    30017) + str(season)
                    PDIALOG.update(
                        int(100 * PARSER['steps'] / PARSER['total_steps']),
                        dialog_string)
                __get_video_details(vid)
            if 'nextPageToken' not in reply or not fullscan or PARSER[
                    'items'] >= PARSER['total']:
                break
            page_token = reply['nextPageToken']
            url = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=50&playlistId=" + playlist_id + "&pageToken=" + page_token + "&key=" + addon.getSetting(
                'API_key')
    if len(VIDEOS) > 0:
        __render('tv_playlist')
예제 #11
0
    elif foldername == 'Add_Channel_music':
        query = __ask('', AddonString(30038))
        if query:
            LOCAL_CONF['update'] = False
            __search(query, 'music')
    elif foldername == 'Manage':
        __folders('Manage')
    elif foldername == 'Refresh_all':
        LOCAL_CONF['update'] = False
        __refresh()
elif mode == 'C_MENU':
    __C_MENU(foldername)
elif mode == 'PLAYLIST_MENU':
    __PLAYLIST_MENU(foldername)
elif mode == 'MUSIC_MENU':
    __MUSIC_MENU(foldername)
elif mode == 'Refresh':
    __refresh()
elif mode == 'OpenSettings':
    xbmcaddon.Addon(addonID).openSettings()
elif 'SPLIT_EDITOR' in mode:
    params = dict(parse.parse_qsl(parse.urlsplit(sys.argv[2]).query))
    __logger('CUNT_SHIT ' + json.dumps(params))
    channel_id = params['playlist']
    action = params['action']
    __PLAYLIST_EDITOR(params)
else:
    __folders('menu')

__folders('menu')