Python xbmcplugin 模块,SORT_METHOD_LABEL_IGNORE_THE 实例源码

我们从Python开源项目中,提取了以下16个代码示例,用于说明如何使用xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE

项目:nuodtayo.tv    作者:benaranguren    | 项目源码 | 文件源码
def showShows(category_url):
    """Display all shows under a sub category

    params:
        category_url: a sub category is a unique id
    """

    showListData = get_show_list(category_url)
    if showListData is None:
        xbmcplugin.endOfDirectory(thisPlugin)
        return

    for show_id, (title, thumbnail) in showListData.iteritems():
        addDir(title, str(show_id), Mode.SHOW_INFO, thumbnail)

    xbmcplugin.addSortMethod(thisPlugin, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
    xbmcplugin.endOfDirectory(thisPlugin)
项目:plugin.video.vrt.nu    作者:pietje666    | 项目源码 | 文件源码
def show_listing(self, list_items, sort=None):
        listing = []
        for title_item in list_items:
            list_item = xbmcgui.ListItem(label=title_item.title)
            url = self._url + '?' + urlencode(title_item.url_dictionary)
            list_item.setProperty('IsPlayable', str(title_item.is_playable))

            if title_item.thumbnail is not None:
                list_item.setArt({'thumb': title_item.thumbnail})

            list_item.setInfo('video', title_item.video_dictionary)

            listing.append((url, list_item, not title_item.is_playable))
        xbmcplugin.addDirectoryItems(self._handle, listing, len(listing))

        if sort is not None:
            kodi_sorts = {sortmethod.ALPHABET: xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE}
            kodi_sortmethod = kodi_sorts.get(sort)
            xbmcplugin.addSortMethod(self._handle, kodi_sortmethod)

        xbmcplugin.endOfDirectory(self._handle)
项目:plugin.video.ais_playbox_unofficial    作者:graffic    | 项目源码 | 文件源码
def router(paramstring):
    """Decides what to do based on script parameters"""
    check_settings()
    params = dict(parse_qsl(paramstring))
    # Nothing to do yet with those
    if not params:
        # Demo channel list
        channels = map_channels(filter_channels(get_tv_channels()))
        xbmcplugin.addDirectoryItems(plugin_handle, channels, len(channels))
        xbmcplugin.addSortMethod(
                plugin_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
        xbmcplugin.endOfDirectory(plugin_handle)
    elif params['action'] == 'play':
        play_channel(params['channel'])
    elif params['action'] == 'get_user_id':
        get_user_id()
项目:plugin.video.zhanqitv    作者:leeeboo    | 项目源码 | 文件源码
def list_categories():

    listing=[]
    list_item = xbmcgui.ListItem(label='??', thumbnailImage='')
    url='{0}?action=game_list'.format(_url)
    is_folder=True
    listing.append((url, list_item, is_folder))

    list_item = xbmcgui.ListItem(label='Lyingman', thumbnailImage='')
    url='{0}?action=lyingman'.format(_url)
    is_folder=True
    listing.append((url, list_item, is_folder))

    xbmcplugin.addDirectoryItems(_handle,listing,len(listing))
    #xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_handle)
项目:plugin.video.zhanqitv    作者:leeeboo    | 项目源码 | 文件源码
def game_list():

    f = urllib2.urlopen('http://www.zhanqi.tv/api/static/game.lists/100-1.json?rand={ts}'.format(ts=time.time()))

    obj = json.loads(f.read())

    listing=[]
    for game in obj['data']['games']:
        list_item = xbmcgui.ListItem(label=game['name'], thumbnailImage=game['bpic'])
        list_item.setProperty('fanart_image', game['bpic'])
        url='{0}?action=room_list&game_id={1}'.format(_url, game['id'])

        #xbmc.log(url, 1)

        is_folder=True
        listing.append((url, list_item, is_folder))

    xbmcplugin.addDirectoryItems(_handle,listing,len(listing))
    #xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_handle)
项目:plugin.video.zhanqitv    作者:leeeboo    | 项目源码 | 文件源码
def room_list(game_id):

    f = urllib2.urlopen('http://www.zhanqi.tv/api/static/game.lives/{game_id}/100-1.json?rand={ts}'.format(game_id=game_id, ts=time.time()))

    obj = json.loads(f.read())

    listing=[]
    for room in obj['data']['rooms']:
        list_item = xbmcgui.ListItem(label=room['title'], thumbnailImage=room['bpic'])
        list_item.setProperty('fanart_image', room['bpic'])
        url='{0}?action=play&room_id={1}'.format(_url, room['id'])
        is_folder=False
        listing.append((url, list_item, is_folder))
    xbmcplugin.addDirectoryItems(_handle, listing, len(listing))
    #xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_handle)
项目:crossplatform_iptvplayer    作者:j00zek    | 项目源码 | 文件源码
def SelectHost():
    for host in HostsList:
            if ADDON.getSetting(host[0]) == 'true':
                hostName = host[1].replace("https:",'').replace("http:",'').replace("/",'').replace("www.",'')
                hostImage = '%s/icons/%s.png' % (ADDON.getSetting("kodiIPTVpath"), host[0])
                list_item = xbmcgui.ListItem(label = hostName)
                list_item.setArt({'thumb': hostImage,})
                list_item.setInfo('video', {'title': hostName, 'genre': hostName})
                url = get_url(action='startHost', host=host[0])
                myLog(url)
                is_folder = True
                # Add our item to the Kodi virtual folder listing.
                xbmcplugin.addDirectoryItem(ADDON_handle, url, list_item, is_folder)
    # Add a sort method for the virtual folder items (alphabetically, ignore articles)
    xbmcplugin.addSortMethod(ADDON_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(ADDON_handle)
    return
项目:plugin.video.douyutv2    作者:yangqian    | 项目源码 | 文件源码
def list_categories(offset):
    #f=urllib2.urlopen('http://www.douyutv.com/directory')
    #rr=BeautifulSoup(f.read())
    rr=BeautifulSoup(requests.get('http://www.douyutv.com/directory',headers=headers).text)
    catel=rr.findAll('a',{'class':'thumb'},limit=offset+PAGE_LIMIT+1)
    rrr=[(x['href'], x.p.text,x.img['data-original']) for x in catel]
    offset=int(offset)
    if offset+PAGE_LIMIT<len(rrr):
      rrr=rrr[offset:offset+PAGE_LIMIT]
      nextpageflag=True
    else:
      rrr=rrr[offset:]
      nextpageflag=False
    listing=[]
    for classname,textinfo,img in rrr:
        list_item=xbmcgui.ListItem(label=textinfo,thumbnailImage=img)
        #list_item.setProperty('fanart_image',img)
        url=u'{0}?action=listing&category={1}&offset=0'.format(_url,classname)
        is_folder=True
        listing.append((url,list_item,is_folder))
    if nextpageflag==True:
        list_item=xbmcgui.ListItem(label=NEXT_PAGE)
        url=u'{0}?offset={1}'.format(_url,str(offset+PAGE_LIMIT))
        is_folder=True
        listing.append((url,list_item,is_folder))
    xbmcplugin.addDirectoryItems(_handle,listing,len(listing))
    #xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_handle)
项目:plugin.video.douyutv2    作者:yangqian    | 项目源码 | 文件源码
def list_videos(category,offset=0):
    #request=urllib2.Request('http://www.douyu.com'+category,headers=headers)
    #f=urllib2.urlopen(request)
    #f=urllib2.urlopen('http://www.douyu.com'+category)
    #r=f.read()
    #rr=BeautifulSoup(r)
    rr=BeautifulSoup(requests.get('http://www.douyu.com'+category,headers=headers).text)
    videol=rr.findAll('a',{'class':'list'},limit=offset+PAGE_LIMIT+1)
    listing=[]
    #with open('rooml.dat','w') as f:
    #  f.writelines([str(x) for x in videol])
    if offset+PAGE_LIMIT<len(videol):
      videol=videol[offset:offset+PAGE_LIMIT]
      nextpageflag=True
    else:
      videol=videol[offset:]
      nextpageflag=False
    for x in videol:
        roomid=x['href'][1:]
        img=x.img['data-original']
        title=x['title']
        nickname=x.find('span',{'class':'nnt'}).text
        view=x.find('span',{'class':'view'}).text
        liveinfo=u'{0}:{1}:{2}'.format(nickname,title,view)
        list_item=xbmcgui.ListItem(label=liveinfo,thumbnailImage=img)
        #list_item.setProperty('fanart_image',img)
        url='{0}?action=play&video={1}'.format(_url,roomid)
        is_folder=False
        listing.append((url,list_item,is_folder))
    if nextpageflag==True:
        list_item=xbmcgui.ListItem(label=NEXT_PAGE)
        url='{0}?action=listing&category={1}&offset={2}'.format(_url,category,offset+PAGE_LIMIT)
        is_folder=True
        listing.append((url,list_item,is_folder))
    xbmcplugin.addDirectoryItems(_handle,listing,len(listing))
    #xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_handle)
项目:plugin.video.areena    作者:hirsivaja    | 项目源码 | 文件源码
def list_categories(base_category):
    """
    Create the list of the categories in the Kodi interface.
    :param base_category: the parent category to require from all categories
    :return: None
    """
    listing = list_sub_categories(base_category)
    # Add our listing to Kodi.
    # Large lists and/or slower systems benefit from adding all items at once via addDirectoryItems
    # instead of adding one by ove via addDirectoryItem.
    xbmcplugin.addDirectoryItems(_handle, listing, len(listing))
    # Add a sort method for the virtual folder items (alphabetically, ignore articles)
    xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_handle)
项目:plugin.video.areena    作者:hirsivaja    | 项目源码 | 文件源码
def list_streams(listing, streams, offset_url, item_limit=25):
    """
    Create the list of playable streams in the Kodi interface.
    :param listing: list for the streams. Can include some fixed elements
    :param streams: json of streams to list
    :param offset_url: url that opens next page of streams
    :param item_limit: maximum number of items per page
    :return: None
    """
    # Iterate through the streams.
    for stream in streams:
        list_item = create_list_item_from_stream(stream)
        if list_item is None:
            continue
        # Create a URL for the plugin recursive callback.
        # Example: plugin://plugin.video.example/?action=play&video=http://www.vidsplay.com/vids/crab.mp4
        url = '{0}?action=play&stream={1}'.format(_url, stream['id'])
        # Add the list item to a virtual Kodi folder.
        # is_folder = False means that this item won't open any sub-list.
        is_folder = False
        # Add our item to the listing as a 3-element tuple.
        listing.append((url, list_item, is_folder))
    if len(listing) >= item_limit:
        list_item = xbmcgui.ListItem(label='[COLOR {0}]{1}[/COLOR]'.format(
            get_color('menuItemColor'), get_translation(32008)))
        listing.append((offset_url, list_item, True))
    # Add our listing to Kodi.
    # Large lists and/or slower systems benefit from adding all items at once via addDirectoryItems
    # instead of adding one by ove via addDirectoryItem.
    xbmcplugin.addDirectoryItems(_handle, listing, len(listing))
    # Add a sort method for the virtual folder items (alphabetically, ignore articles)
    # xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_handle)
    xbmcplugin.setContent(_handle, 'movies')
项目:crossplatform_iptvplayer    作者:j00zek    | 项目源码 | 文件源码
def prepareKODIurlsList(urlsList, videoName):
    exec(urlsList)
    for item in UrlsList:
        list_item = xbmcgui.ListItem(label = item['name'])
        #list_item.setArt({'thumb': VIDEOS[category][0]['thumb'],
        #          'icon': VIDEOS[category][0]['thumb'],
        #          'fanart': VIDEOS[category][0]['thumb']})
        # Set additional info for the list item.
        # Here we use a category name for both properties for for simplicity's sake.
        list_item.setInfo('video', {'title': videoName}) # http://mirrors.xbmc.org/docs/python-docs/15.x-isengard/xbmcgui.html#ListItem-setInfo
        list_item.setProperty('IsPlayable', 'true')
        myID = item['id']
        myUrl = item['url']
        myLevel = ADDON.getSetting("currenLevel")
        is_folder = False
        url = get_url(action = 'playUrl',
                      id = myID,
                      level = myLevel,
                      urlNeedsResolve=item['urlNeedsResolve'],
                      url=myUrl,
                      name=videoName) # Create a URL for a plugin recursive call.
        if ADDON.getSetting("PlayerMode") == "2":
            list_item.setArt({'thumb': xbmc.translatePath('special://home/addons/plugin.video.IPTVplayer/resources/icons/download.png')})
        xbmcplugin.addDirectoryItem(ADDON_handle, url, list_item, is_folder)
        myLog('action=playUrl id=%s level=%s' % (myID,myLevel))
        # Add a sort method for the virtual folder items (alphabetically, ignore articles)
        #xbmcplugin.addSortMethod(ADDON_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
        # Finish creating a virtual folder.

#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ### MAIN FUNCTION ###
项目:YoutubeTV    作者:dude56987    | 项目源码 | 文件源码
def list_videos(category):
    """
    Create the list of playable videos in the Kodi interface.

    :param category: str
    """
    # Get the list of videos in the category.
    videos = get_videos(category)
    # Create a list for our items.
    listing = []
    # create playlists button to link to youtube playlist functionality
    listing.append(createButton(action=('channelPlaylists&channel='+category),\
        title='Playlists',thumb=(_resdir+'/media/playlist.png'),icon='',fanart=''))
    # show related channels button
    listing.append(createButton(action=('relatedChannels&value='+category),\
        title='Related Channels',thumb=(_basedir+'/icon.png'),icon='',fanart=''))
    # Iterate through videos.
    for video in videos:
        # Create a list item with a text label and a thumbnail image.
        list_item = xbmcgui.ListItem(label=video['name'])
        # Set additional info for the list item.
        list_item.setInfo('video', {'title': video['name'], 'genre': video['genre']})
        # Set graphics (thumbnail, fanart, banner, poster, landscape etc.) for the list item.
        # Here we use the same image for all items for simplicity's sake.
        # In a real-life plugin you need to set each image accordingly.
        list_item.setArt({'thumb': video['thumb'], 'icon': video['thumb'], 'fanart': video['thumb']})
        # Set 'IsPlayable' property to 'true'.
        # This is mandatory for playable items!
        list_item.setProperty('IsPlayable', 'true')
        # Create a URL for the plugin recursive callback.
        # Example: plugin://plugin.video.example/?action=play&video=http://www.vidsplay.com/vids/crab.mp4
        url = '{0}?action=play&video={1}'.format(_url, video['video'])
        # Add the list item to a virtual Kodi folder.
        # is_folder = False means that this item won't open any sub-list.
        is_folder = False
        # Add our item to the listing as a 3-element tuple.
        listing.append((url, list_item, is_folder))
    # Add our listing to Kodi.
    # Large lists and/or slower systems benefit from adding all items at once via addDirectoryItems
    # instead of adding one by ove via addDirectoryItem.
    xbmcplugin.addDirectoryItems(_handle, listing, len(listing))
    # Add a sort method for the virtual folder items (alphabetically, ignore articles)
    #xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
    # change the default view to thumbnails
    xbmc.executebuiltin('Container.SetViewMode(%d)' % 500)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_handle)
项目:kodi-addons    作者:leonardoxiao    | 项目源码 | 文件源码
def list_categories():
    """
    Create the list of video categories in the Kodi interface.
    """
    # Get video categories
    categories = get_categories()
    # Create a list for our items.
    listing = []
    # Iterate through categories
    for category in categories:
        category_name = category['name']
        category_url = category['url']
        # Create a list item with a text label and a thumbnail image.
        list_item = xbmcgui.ListItem(label=category_name, thumbnailImage=THUMBNAIL)
        # Set graphics (thumbnail, fanart, banner, poster, landscape etc.) for the list item.
        # Here we use the same image for all items for simplicity's sake.
        # In a real-life plugin you need to set each image accordingly.
        list_item.setArt({'thumb': THUMBNAIL,
                          'icon': THUMBNAIL,
                          'fanart': THUMBNAIL})
        # Set additional info for the list item.
        # Here we use a category name for both properties for for simplicity's sake.
        # setInfo allows to set various information for an item.
        # For available properties see the following link:
        # http://mirrors.xbmc.org/docs/python-docs/15.x-isengard/xbmcgui.html#ListItem-setInfo
        list_item.setInfo('video', {'title': category_name, 'genre': category_name})
        # Create a URL for the plugin recursive callback.
        # Example: plugin://plugin.video.example/?action=listing&category=Animals
        url = '{0}?action=list&category_name={1}&category_url={2}'.format(_url, category_name, category_url)
        # is_folder = True means that this item opens a sub-list of lower level items.
        is_folder = True
        # Add our item to the listing as a 3-element tuple.
        listing.append((url, list_item, is_folder))

    # Add our listing to Kodi.
    # Large lists and/or slower systems benefit from adding all items at once via addDirectoryItems
    # instead of adding one by ove via addDirectoryItem.
    xbmcplugin.addDirectoryItems(_handle, listing, len(listing))
    # Add a sort method for the virtual folder items (alphabetically, ignore articles)
    #xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
    xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_NONE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_handle)
项目:kodi-addons    作者:leonardoxiao    | 项目源码 | 文件源码
def list_matches(videos):
    """
    Create the list of matches in the Kodi interface.
    """
    print("=====list_matches()")

    # Create a list for our items.
    listing = []
    # Iterate through videos.
    for video in videos:
        # Create a list item with a text label and a thumbnail image.
        list_item = xbmcgui.ListItem(label=video['name'])

        if video['video'] == None:
            # Non-video item: next page
            url = video['url']

            list_item.setProperty('IsPlayable', 'false')

            # Add the list item to a virtual Kodi folder.
            is_folder = True

        else:
            # Set additional info for the list item.
            list_item.setInfo('video', {'title': video['name'], 'genre': video['genre']})
            # Set graphics (thumbnail, fanart, banner, poster, landscape etc.) for the list item.
            # Here we use the same image for all items for simplicity's sake.
            # In a real-life plugin you need to set each image accordingly.
            list_item.setArt({'thumb': video['thumb'], 'icon': video['thumb'], 'fanart': video['thumb']})

            # Create a URL for the plugin recursive callback.
            url = u'{0}?action=view&match={1}'.format(_url, video['video'])

            # Set 'IsPlayable' property to 'true'.
            # This is mandatory for playable items!
            list_item.setProperty('IsPlayable', 'true')

            # Add the list item to a virtual Kodi folder.
            # is_folder = False means that this item won't open any sub-list.
            is_folder = False

        # Add our item to the listing as a 3-element tuple.
        listing.append((url, list_item, is_folder))

    # Add our listing to Kodi.
    # Large lists and/or slower systems benefit from adding all items at once via addDirectoryItems
    # instead of adding one by ove via addDirectoryItem.
    xbmcplugin.addDirectoryItems(_handle, listing, len(listing))
    # Add a sort method for the virtual folder items (alphabetically, ignore articles)
    #xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
    xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_NONE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_handle)
项目:plugin.video.zhanqitv    作者:leeeboo    | 项目源码 | 文件源码
def lyingman():

    f = urllib2.urlopen('http://www.zhanqi.tv/topic/lyingman')
    html = f.read()

    html = html.replace("\n", '')

    review = re.compile('<div class="review-area">.*').findall(html)
    review = review[0];

    li_list = review.split('<li class="js-carousel-item">')

    listing=[]

    for li in li_list:
        title = re.compile('<span class="name">([^"]*)</span>').findall(li)
        if len(title) > 0:

            title = title[0]

            img = re.compile('<img src="([^"]*)"[^>]*>').findall(li)

            if len(img) > 0:
                img = img[0]
            else:
                img = ''

            link = re.compile('<a href="/videos/([^"]*)"[^>]*>').findall(li)

            if len(link) > 0:
                link = link[0]
                link = link.split('/')
                link = link[len(link) - 1]
                link = link.split('.')
                link = link[0]

                during = re.compile('<p><i class="dv iconClock png"></i><span class="dv">([^"]*)</span></p>').findall(li)

                if len(during) > 0:
                    during = during[0]
                else:
                    during = 'unknow'


                list_item = xbmcgui.ListItem(label=title + '[' + during + ']', thumbnailImage=img)
                list_item.setProperty('fanart_image', img)

                url='{0}?action=playvod&video_id={1}'.format(_url, link)
                is_folder=False
                listing.append((url, list_item, is_folder))

    xbmcplugin.addDirectoryItems(_handle, listing, len(listing))
    #xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_handle)