Python xbmcplugin 模块,addDirectoryItem() 实例源码

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

项目:plugin.audio.spotify    作者:marcelveldt    | 项目源码 | 文件源码
def add_next_button(self, listtotal):
        # adds a next button if needed
        params = self.params
        if listtotal > self.offset + self.limit:
            params["offset"] = self.offset + self.limit
            url = "plugin://plugin.audio.spotify/"
            for key, value in params.iteritems():
                if key == "action":
                    url += "?%s=%s" % (key, value[0])
                elif key == "offset":
                    url += "&%s=%s" % (key, value)
                else:
                    url += "&%s=%s" % (key, value[0])
            li = xbmcgui.ListItem(
                xbmc.getLocalizedString(33078),
                path=url,
                iconImage="DefaultMusicAlbums.png"
            )
            li.setProperty('do_not_analyze', 'true')
            li.setProperty('IsPlayable', 'false')
            xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=url, listitem=li, isFolder=True)
项目:Python-GoogleDrive-VideoStream    作者:ddurdle    | 项目源码 | 文件源码
def addOfflineMediaFile(self,offlinefile):
        listitem = xbmcgui.ListItem(offlinefile.title, iconImage=offlinefile.thumbnail,
                                thumbnailImage=offlinefile.thumbnail)

        if  offlinefile.resolution == 'original':
            infolabels = decode_dict({ 'title' : offlinefile.title})
        else:
            infolabels = decode_dict({ 'title' : offlinefile.title + ' - ' + offlinefile.resolution })
        listitem.setInfo('Video', infolabels)
        listitem.setProperty('IsPlayable', 'true')


        xbmcplugin.addDirectoryItem(self.plugin_handle, offlinefile.playbackpath, listitem,
                                isFolder=False, totalItems=0)
        return offlinefile.playbackpath



    ##
    # Calculate the number of accounts defined in settings
    #   parameters: the account type (usually plugin name)
    ##
项目:plugin.video.telekom-sport    作者:asciidisco    | 项目源码 | 文件源码
def show_sport_selection(self):
        """Creates the KODI list items for the static sport selection"""
        self.utils.log('Sport selection')
        sports = self.constants.get_sports_list()

        for sport in sports:
            url = self.utils.build_url({'for': sport})
            list_item = xbmcgui.ListItem(label=sports.get(sport).get('name'))
            list_item = self.item_helper.set_art(
                list_item=list_item,
                sport=sport)
            xbmcplugin.addDirectoryItem(
                handle=self.plugin_handle,
                url=url,
                listitem=list_item,
                isFolder=True)
            xbmcplugin.addSortMethod(
                handle=self.plugin_handle,
                sortMethod=xbmcplugin.SORT_METHOD_DATE)
        xbmcplugin.endOfDirectory(self.plugin_handle)
项目:plugin.video.telekom-sport    作者:asciidisco    | 项目源码 | 文件源码
def __add_video_item(self, video, list_item, url):
        """
        Adds a playable video item to Kodi

        :param video: Video details
        :type video: dict
        :param list_item: Kodi list item
        :type list_item: xbmcgui.ListItem
        :param url: Video url
        :type url: string
        """
        if video.get('islivestream', True) is True:
            xbmcplugin.addDirectoryItem(
                handle=self.plugin_handle,
                url=url,
                listitem=list_item,
                isFolder=False)
项目:context.youtube.download    作者:anxdpanic    | 项目源码 | 文件源码
def add_item(queries, list_item, fanart='', is_folder=None, is_playable=None, total_items=0, menu_items=None,
             replace_menu=False):
    if menu_items is None: menu_items = []
    if is_folder is None:
        is_folder = False if is_playable else True

    if is_playable is None:
        playable = 'false' if is_folder else 'true'
    else:
        playable = 'true' if is_playable else 'false'

    liz_url = get_plugin_url(queries)
    if fanart: list_item.setProperty('fanart_image', fanart)
    list_item.setInfo('video', {'title': list_item.getLabel()})
    list_item.setProperty('isPlayable', playable)
    list_item.addContextMenuItems(menu_items, replaceItems=replace_menu)
    xbmcplugin.addDirectoryItem(int(sys.argv[1]), liz_url, list_item, isFolder=is_folder, totalItems=total_items)
项目:forthelulz    作者:munchycool    | 项目源码 | 文件源码
def addMenuItem(caption, link, icon=None, thumbnail=None, folder=False):
    """
    Add a menu item to the xbmc GUI

    Parameters:
    caption: the caption for the menu item
    icon: the icon for the menu item, displayed if the thumbnail is not accessible
    thumbail: the thumbnail for the menu item
    link: the link for the menu item
    folder: True if the menu item is a folder, false if it is a terminal menu item

    Returns True if the item is successfully added, False otherwise
    """
    listItem = xbmcgui.ListItem(unicode(caption), iconImage=icon, thumbnailImage=thumbnail)
    listItem.setInfo(type="Video", infoLabels={ "Title": caption })
    return xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=link, listitem=listItem, isFolder=folder)
项目:forthelulz    作者:munchycool    | 项目源码 | 文件源码
def addMenuItem(caption, link, icon=None, thumbnail=None, folder=False):
    """
    Add a menu item to the xbmc GUI

    Parameters:
    caption: the caption for the menu item
    icon: the icon for the menu item, displayed if the thumbnail is not accessible
    thumbail: the thumbnail for the menu item
    link: the link for the menu item
    folder: True if the menu item is a folder, false if it is a terminal menu item

    Returns True if the item is successfully added, False otherwise
    """
    listItem = xbmcgui.ListItem(unicode(caption), iconImage=icon, thumbnailImage=thumbnail)
    listItem.setInfo(type="Video", infoLabels={ "Title": caption })
    return xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=link, listitem=listItem, isFolder=folder)
项目:forthelulz    作者:munchycool    | 项目源码 | 文件源码
def addMenuItem(caption, link, icon=None, thumbnail=None, folder=False):
    """
    Add a menu item to the xbmc GUI

    Parameters:
    caption: the caption for the menu item
    icon: the icon for the menu item, displayed if the thumbnail is not accessible
    thumbail: the thumbnail for the menu item
    link: the link for the menu item
    folder: True if the menu item is a folder, false if it is a terminal menu item

    Returns True if the item is successfully added, False otherwise
    """
    listItem = xbmcgui.ListItem(unicode(caption), iconImage=icon, thumbnailImage=thumbnail)
    listItem.setInfo(type="Video", infoLabels={ "Title": caption })
    return xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=str(link), listitem=listItem, isFolder=folder)
项目:catchup4kodi    作者:catchup4kodi    | 项目源码 | 文件源码
def addDir(name,url,mode,iconimage,plot='',isFolder=True):
        try:
            PID = iconimage.split('productionId=')[1]
        except:pass    
        u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)+"&iconimage="+urllib.quote_plus(iconimage)
        ok=True
        liz=xbmcgui.ListItem(name,iconImage="DefaultVideo.png", thumbnailImage=iconimage)
        liz.setInfo( type="Video", infoLabels={ "Title": name, "Plot": plot,'Premiered' : '2012-01-01','Episode' : '7-1' } )
        menu=[]
        if mode == 2:
            menu.append(('[COLOR yellow]Add To Favourites[/COLOR]','XBMC.RunPlugin(%s?mode=13&url=%s&name=%s&iconimage=%s)'% (sys.argv[0],url,name,PID)))
        if mode == 204:
            menu.append(('[COLOR yellow]Remove Favourite[/COLOR]','XBMC.RunPlugin(%s?mode=14&url=%s&name=%s&iconimage=%s)'% (sys.argv[0],url,name,iconimage)))
        liz.addContextMenuItems(items=menu, replaceItems=False)    
        if mode==3:
            xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_DATE)
        if isFolder==False:
            liz.setProperty("IsPlayable","true")
        ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=isFolder)
        return ok
项目:catchup4kodi    作者:catchup4kodi    | 项目源码 | 文件源码
def addDir(name,url,mode,iconimage,description):
        u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)+"&iconimage="+urllib.quote_plus(iconimage)+"&description="+urllib.quote_plus(description)
        ok=True
        name=replaceHTMLCodes(name)
        name=name.strip()
        liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=iconimage)
        liz.setInfo( type="Video", infoLabels={ "Title": name, "Plot": description} )
        menu = []
        if mode ==200 or mode ==201 or mode ==202 or mode ==203:
            if not 'feeds' in url:
                if not 'f4m' in url:
                    if 'm3u8' in url:
                        liz.setProperty('mimetype', 'application/x-mpegURL')
                        liz.setProperty('mimetype', 'video/MP2T')
                    liz.setProperty("IsPlayable","true")
            ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=False)          
        else:
            menu.append(('Play All Videos','XBMC.RunPlugin(%s?name=%s&mode=2001&iconimage=None&url=%s)'% (sys.argv[0],name,url)))
            liz.addContextMenuItems(items=menu, replaceItems=False)
            xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
        return ok
项目:kodi-vk.inpos.ru    作者:inpos    | 项目源码 | 文件源码
def _users(self):
        page = int(self.root.params['page'])
        users = media_entries('fave.getUsers', self.root.conn, _NO_OWNER, page = page)
        if page < users['pages']:
            params = {'do': _DO_FAVE_USERS, 'page': page + 1}
            self.root.add_folder(self.root.gui._string(400602), params)
        for u in users['items']:
            list_item = xbmcgui.ListItem(u'%s %s' % (u.info['last_name'], u.info['first_name']))
            #p_key = 'photo_%d' % (max(map(lambda x: int(x.split('_')[1]), filter(lambda x: x.startswith('photo_'), m.info.keys()))),)
            #list_item.setArt({'thumb': m.info[p_key], 'icon': m.info[p_key]})
            params = {'do': _DO_HOME, 'oid': u.id}
            url = self.root.url(**params)
            xbmcplugin.addDirectoryItem(_addon_id, url, list_item, isFolder = True)
        if page < users['pages']:
            params = {'do': _DO_FAVE_USERS, 'page': page + 1}
            self.root.add_folder(self.root.gui._string(400602), params)
        xbmcplugin.endOfDirectory(_addon_id)
项目:kodi-vk.inpos.ru    作者:inpos    | 项目源码 | 文件源码
def _groups(self):
        page = int(self.root.params['page'])
        links = media_entries('fave.getLinks', self.root.conn, _NO_OWNER, page = page)
        if page < links['pages']:
            params = {'do': _DO_FAVE_GROUPS, 'page': page + 1}
            self.root.add_folder(self.root.gui._string(400602), params)
        for l in links['items']:
            l_id = l.info['id'].split('_')
            if l_id[0] == '2':
                list_item = xbmcgui.ListItem(l.info['title'])
                p_key = 'photo_%d' % (max(map(lambda x: int(x.split('_')[1]), filter(lambda x: x.startswith('photo_'), l.info.keys()))),)
                list_item.setArt({'thumb': l.info[p_key], 'icon': l.info[p_key]})
                params = {'do': _DO_HOME, 'oid': -int(l_id[-1])}
                url = self.root.url(**params)
                xbmcplugin.addDirectoryItem(_addon_id, url, list_item, isFolder = True)
        if page < links['pages']:
            params = {'do': _DO_FAVE_GROUPS, 'page': page + 1}
            self.root.add_folder(self.root.gui._string(400602), params)
        xbmcplugin.endOfDirectory(_addon_id)
项目:kodi-vk.inpos.ru    作者:inpos    | 项目源码 | 文件源码
def _photo_albums(self):
        page = int(self.root.params['page'])
        oid = self.root.params['oid']
        kwargs = {'page': page, 'need_covers': 1, 'need_system': 1}
        albums = media_entries('photos.getAlbums', self.root.conn, oid, **kwargs)
        if page < albums['pages']:
            params = {'do': _DO_PHOTO_ALBUMS,'oid': oid,'page': page + 1}
            self.root.add_folder(self.root.gui._string(400602), params)
        for a in albums['items']:
            list_item = xbmcgui.ListItem(a.info['title'])
            list_item.setInfo('pictures', {'title': a.info['title']})
            list_item.setArt({'thumb': a.info['thumb_src'], 'icon': a.info['thumb_src']})
            params = {'do': _DO_PHOTO, 'oid': oid, 'album': a.id, 'page': 1}
            url = self.root.url(**params)
            xbmcplugin.addDirectoryItem(_addon_id, url, list_item, isFolder = True)
        if page < albums['pages']:
            params = {'do': _DO_PHOTO_ALBUMS,'oid': oid,'page': page + 1}
            self.root.add_folder(self.root.gui._string(400602), params)
        xbmcplugin.endOfDirectory(_addon_id)
        switch_view()
项目:kodi-vk.inpos.ru    作者:inpos    | 项目源码 | 文件源码
def _main_video_search(self):
        page = int(self.root.params['page'])
        self.root.add_folder(self.root.gui._string(400516), {'do': _DO_VIDEO_SEARCH, 'q':'none', 'page': 1})
        history = get_search_history(_FILE_VIDEO_SEARCH_HISTORY)
        count = len(history)
        pages = int(ceil(count / float(_SETTINGS_PAGE_ITEMS)))
        if page < pages:
            params = {'do': _DO_MAIN_VIDEO_SEARCH, 'page': page + 1}
            self.root.add_folder(self.root.gui._string(400602), params)
        h_start = _SETTINGS_PAGE_ITEMS * (page -1)
        h_end = h_start + _SETTINGS_PAGE_ITEMS
        history = history[h_start:h_end]
        for h in history:
            query_hex = binascii.hexlify(pickle.dumps(h, -1))
            list_item = xbmcgui.ListItem(h)
            params = {'do': _DO_VIDEO_SEARCH, 'q': query_hex, 'page': 1}
            url = self.root.url(**params)
            xbmcplugin.addDirectoryItem(_addon_id, url, list_item, isFolder = True)
        if page < pages:
            params = {'do': _DO_MAIN_VIDEO_SEARCH, 'page': page + 1}
            self.root.add_folder(self.root.gui._string(400602), params)
        xbmcplugin.endOfDirectory(_addon_id)
项目:kodi-vk.inpos.ru    作者:inpos    | 项目源码 | 文件源码
def _video_albums(self):
        page = int(self.root.params['page'])
        oid = self.root.params['oid']
        kwargs = {
                    'page': page,
                    'extended': 1
                    }
        albums = media_entries('video.getAlbums', self.root.conn, oid, **kwargs)
        if page < albums['pages']:
            params = {'do': _DO_VIDEO_ALBUMS,'oid': oid,'page': page + 1}
            self.root.add_folder(self.root.gui._string(400602), params)
        for a in albums['items']:
            list_item = xbmcgui.ListItem(a.info['title'])
            list_item.setInfo('video', {'title': a.info['title']})
            if 'photo_320' in a.info.keys():
                list_item.setArt({'thumb': a.info['photo_160'], 'icon': a.info['photo_160'], 'fanart': a.info['photo_320']})
            params = {'do': _DO_VIDEO, 'oid': oid, 'album': a.id, 'page': 1}
            url = self.root.url(**params)
            xbmcplugin.addDirectoryItem(_addon_id, url, list_item, isFolder = True)
        if page < albums['pages']:
            params = {'do': _DO_VIDEO_ALBUMS,'oid': oid,'page': page + 1}
            self.root.add_folder(self.root.gui._string(400602), params)
        xbmcplugin.endOfDirectory(_addon_id)
项目:kodi-vk.inpos.ru    作者:inpos    | 项目源码 | 文件源码
def _members(self):
        oid = self.root.params['oid']
        page = int(self.root.params['page'])
        group = Group(oid, self.root.conn)
        members = group.members(page = page)
        if page < members['pages']:
            params = {'do': _DO_MEMBERS, 'oid': oid, 'page': page + 1}
            self.root.add_folder(self.root.gui._string(400602), params)
        for m in members['items']:
            list_item = xbmcgui.ListItem(u'%s %s' % (m.info['last_name'], m.info['first_name']))
            p_key = 'photo_%d' % (max(map(lambda x: int(x.split('_')[1]), filter(lambda x: x.startswith('photo_'), m.info.keys()))),)
            list_item.setArt({'thumb': m.info[p_key], 'icon': m.info[p_key]})
            params = {'do': _DO_HOME, 'oid': m.id}
            url = self.root.url(**params)
            xbmcplugin.addDirectoryItem(_addon_id, url, list_item, isFolder = True)
        if page < members['pages']:
            params = {'do': _DO_MEMBERS, 'oid': oid, 'page': page + 1}
            self.root.add_folder(self.root.gui._string(400602), params)
        xbmcplugin.endOfDirectory(_addon_id)
项目:kodi-vk.inpos.ru    作者:inpos    | 项目源码 | 文件源码
def __create_user_group_search_page_(self, do_current, do_target, h_file):
        page = int(self.root.params['page'])
        self.root.add_folder(self.root.gui._string(400516), {'do': do_target, 'q':'none', 'page': 1})
        history = get_search_history(h_file)
        count = len(history)
        pages = int(ceil(count / float(_SETTINGS_PAGE_ITEMS)))
        if page < pages:
            params = {'do': do_current, 'page': page + 1}
            self.root.add_folder(self._string(400602), params)
        h_start = _SETTINGS_PAGE_ITEMS * (page -1)
        h_end = h_start + _SETTINGS_PAGE_ITEMS
        history = history[h_start:h_end]
        for h in history:
            query_hex = binascii.hexlify(pickle.dumps(h, -1))
            list_item = xbmcgui.ListItem(h)
            params = {'do': do_target, 'q': query_hex, 'page': 1}
            url = self.root.url(**params)
            xbmcplugin.addDirectoryItem(_addon_id, url, list_item, isFolder = True)
        if page < pages:
            params = {'do': do_current, 'page': page + 1}
            self.root.add_folder(self.root.gui._string(400602), params)
        xbmcplugin.endOfDirectory(_addon_id)
项目:kodi-plugin.video.ted-talks-chinese    作者:daineseh    | 项目源码 | 文件源码
def show_page(obj):
    for talk in obj.get_talks():
        url = build_url({'mode': 'play', 'folder_name': talk.url})
        li = xbmcgui.ListItem("%s - %s [COLOR=lime][%s][/COLOR][COLOR=cyan] Posted: %s[/COLOR]" % (talk.title, talk.speaker, talk.time, talk.posted))
        li.setArt({'thumb': talk.thumb, 'icon': talk.thumb, 'fanart': talk.thumb})
        xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)

    if obj.next_page:
        url = build_url({'mode': 'page', 'folder_name': obj.next_page})
        li = xbmcgui.ListItem("[COLOR=yellow]Next Page %s[/COLOR]" % obj.page_number(obj.next_page))
        xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)

    if obj.last_page:
        url = build_url({'mode': 'page', 'folder_name': obj.last_page})
        li = xbmcgui.ListItem("[COLOR=yellow]Last Page %s[/COLOR]" % obj.page_number(obj.last_page))
        xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)
    xbmcplugin.endOfDirectory(addon_handle)
项目:emulator.tools.retroarch    作者:JoKeRzBoX    | 项目源码 | 文件源码
def addMenuItem(caption, link, icon=None, thumbnail=None, folder=False, fanart=None):
    """
    Add a menu item to the xbmc GUI

    Parameters:
    caption: the caption for the menu item
    icon: the icon for the menu item, displayed if the thumbnail is not accessible
    thumbail: the thumbnail for the menu item
    link: the link for the menu item
    folder: True if the menu item is a folder, false if it is a terminal menu item

    Returns True if the item is successfully added, False otherwise
    """
    #listItem = xbmcgui.ListItem(unicode(caption), iconImage=icon, thumbnailImage=thumbnail)
    listItem = xbmcgui.ListItem(str(caption), iconImage=icon, thumbnailImage=thumbnail)
    listItem.setInfo(type="Game", infoLabels={ "Title": caption })
    listItem.setProperty('fanart_image', fanart)
    return xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=link, listitem=listItem, isFolder=folder)
项目:specto    作者:mrknow    | 项目源码 | 文件源码
def addMenuItem(self, name, iconImage=None, folder=True, menu=True, **kwargs):
        """Add one submenu item to the list. [internal]"""
        if not iconImage:
            iconImage = 'DefaultAddonsSearch.png'
        # general menu item
        # liz = xbmcgui.ListItem(title, iconImage="DefaultFolder.png", thumbnailImage=iconImage)
        # liz.setInfo(type="Video", infoLabels={"Title": title})
        url = self.buildPluginUrl(name=name, **kwargs)
        xbmc.log('SEARCH: create menu item %s, query:"%s", url:"%s"' % (name, kwargs.get('query'), url))
        li = xbmcgui.ListItem(kwargs.get('title', ''), iconImage="DefaultFolder.png", thumbnailImage=iconImage)
        li.addContextMenuItems([
            (_('Remove'), 'RunPlugin(%s)' % (url + '&action=remove')),
            (_('Rename'), 'RunPlugin(%s)' % (url + '&action=rename')),
            (_('Clean'),  'RunPlugin(%s)' % (url + '&action=clean')),
        ])
        xbmcplugin.addDirectoryItem(handle=self._addonHandle, url=url, listitem=li, isFolder=folder)
项目:service.subtitles.brokensubs    作者:iamninja    | 项目源码 | 文件源码
def append_subtitle(subname, lang_name, language, params, sync=False, h_impaired=False):
    """Add the subtitle to the list of subtitles to show"""
    listitem = xbmcgui.ListItem(
        # Languange name to display under the lang logo (for example english)
        label=lang_name,
        # Subtitle name (for example 'Lost 1x01 720p')
        label2=subname,
        # Languange 2 letter name (for example en)
        thumbnailImage=xbmc.convertLanguage(language, xbmc.ISO_639_1))

    # Subtitles synced with the video
    listitem.setProperty("sync", 'true' if sync else 'false')
    # Hearing impaired subs
    listitem.setProperty("hearing_imp", 'true' if h_impaired else 'false')

    # Create the url to the plugin that will handle the subtitle download
    url = "plugin://{url}/?{params}".format(
        url=SCRIPT_ID, params=urllib.urlencode(params))
    # Add the subtitle to the list
    xbmcplugin.addDirectoryItem(
        handle=HANDLE, url=url, listitem=listitem, isFolder=False)
项目:plugin.video.skystreaming    作者:Ideneal    | 项目源码 | 文件源码
def list_channels():
    """show channels on the kodi list."""
    playlist = utility.read_list(playlists_file)

    if not playlist:
        ok(ADDON.getLocalizedString(11005), ADDON.getLocalizedString(11006))
        return None

    for channel in playlist:
        url = channel['url'].encode('utf-8')
        name = channel['display_name'].encode('utf-8')
        action_url = build_url({'mode': 'play', 'url': url, 'name': name})
        item = xbmcgui.ListItem(name, iconImage='DefaultVideo.png')
        item.setInfo(type='Video', infoLabels={'Title': name})
        xbmcplugin.addDirectoryItem(handle=HANDLE, url=action_url, listitem=item)

    xbmcplugin.endOfDirectory(HANDLE, cacheToDisc=False)
项目:USTVNOWSHARPE    作者:mathsgrinds    | 项目源码 | 文件源码
def router(paramstring):
    params = dict(parse_qsl(paramstring[1:]))
    if params:
        if params['mode'] == 'play':
            play_item = xbmcgui.ListItem(path=params['link'])
            xbmcplugin.setResolvedUrl(__handle__, True, listitem=play_item)
    else:
        for stream in streams():
            list_item = xbmcgui.ListItem(label=stream['name'], thumbnailImage=stream['thumb'])
            list_item.setProperty('fanart_image', stream['thumb'])
            list_item.setProperty('IsPlayable', 'true')
            url = '{0}?mode=play&link={1}'.format(__url__, stream['link'])
            xbmcplugin.addDirectoryItem(__handle__, url, list_item, isFolder=False)
        xbmcplugin.endOfDirectory(__handle__)
# --------------------------------------------------------------------------------
# Main
# --------------------------------------------------------------------------------
项目:plugin.video.amazon65    作者:phil65    | 项目源码 | 文件源码
def addDir(name, mode, sitemode, url='', thumb='', fanart='', infoLabels=False, totalItems=0, cm=False, page=1, options=''):
    u = '%s?url=<%s>&mode=<%s>&sitemode=<%s>&name=<%s>&page=<%s>&opt=<%s>' % (sys.argv[0], urllib.quote_plus(url), mode, sitemode, urllib.quote_plus(name), urllib.quote_plus(str(page)), options)
    if not fanart or fanart == na:
        fanart = def_fanart
    else:
        u += '&fanart=<%s>' % urllib.quote_plus(fanart)
    if not thumb:
        thumb = def_fanart
    else:
        u += '&thumb=<%s>' % urllib.quote_plus(thumb)
    item = xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=thumb)
    item.setArt({'fanart': fanart,
                 'poster': thumb})
    item.setProperty('IsPlayable', 'false')
    try:
        item.setProperty('TotalSeasons', str(infoLabels['TotalSeasons']))
    except Exception:
        pass
    if infoLabels:
        item.setInfo(type='Video', infoLabels=infoLabels)
    if cm:
        item.addContextMenuItems(cm, replaceItems=False)
    xbmcplugin.addDirectoryItem(handle=pluginhandle, url=u, listitem=item, isFolder=True, totalItems=totalItems)
项目:plugin.program.indigo    作者:tvaddonsco    | 项目源码 | 文件源码
def addHELPDir(name, url, mode, iconimage, fanart, description, filetype, repourl, version, author, contextmenuitems=[],
               contextreplace=False):
    u = sys.argv[0] + "?url=" + urllib.quote_plus(url) + "&mode=" + str(mode) + "&name=" + urllib.quote_plus(
        name) + "&iconimage=" + urllib.quote_plus(iconimage) + "&fanart=" + urllib.quote_plus(
        fanart) + "&description=" + urllib.quote_plus(description) + "&filetype=" + urllib.quote_plus(
        filetype) + "&repourl=" + urllib.quote_plus(repourl) + "&author=" + urllib.quote_plus(
        author) + "&version=" + urllib.quote_plus(version)
    ok = True
    liz = xbmcgui.ListItem(name, iconImage=iconart, thumbnailImage=iconimage)  # "DefaultFolder.png"
    # if len(contextmenuitems) > 0:
    liz.addContextMenuItems(contextmenuitems, replaceItems=contextreplace)
    liz.setInfo(type="Video", infoLabels={"title": name, "plot": description})
    liz.setProperty("fanart_image", fanart)
    liz.setProperty("Addon.Description", description)
    liz.setProperty("Addon.Creator", author)
    liz.setProperty("Addon.Version", version)
    # properties={'Addon.Description':meta["plot"]}
    ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz, isFolder=False)
    return ok
项目:plugin.program.indigo    作者:tvaddonsco    | 项目源码 | 文件源码
def add_item(queries, list_item, fanart='', is_folder=None, is_playable=None, total_items=0, menu_items=None,
             replace_menu=False):
    if menu_items is None: menu_items = []
    if is_folder is None:
        is_folder = False if is_playable else True

    if is_playable is None:
        playable = 'false' if is_folder else 'true'
    else:
        playable = 'true' if is_playable else 'false'

    liz_url = get_plugin_url(queries)
    if fanart: list_item.setProperty('fanart_image', fanart)
    list_item.setInfo('video', {'title': list_item.getLabel()})
    list_item.setProperty('isPlayable', playable)
    list_item.addContextMenuItems(menu_items, replaceItems=replace_menu)
    xbmcplugin.addDirectoryItem(int(sys.argv[1]), liz_url, list_item, isFolder=is_folder, totalItems=total_items)
项目:plugin.video.youtube    作者:jdf76    | 项目源码 | 文件源码
def _add_directory(self, context, directory_item, item_count=0):
        item = xbmcgui.ListItem(label=directory_item.get_name(),
                                iconImage=u'DefaultFolder.png',
                                thumbnailImage=directory_item.get_image())

        # only set fanart is enabled

        if directory_item.get_fanart() and self.settings.show_fanart():
            item.setProperty(u'fanart_image', directory_item.get_fanart())
        if directory_item.get_context_menu() is not None:
            item.addContextMenuItems(directory_item.get_context_menu(),
                                     replaceItems=directory_item.replace_context_menu())

        item.setInfo(type=u'video', infoLabels=info_labels.create_from_item(context, directory_item))

        xbmcplugin.addDirectoryItem(handle=self.handle,
                                    url=directory_item.get_uri(),
                                    listitem=item,
                                    isFolder=True,
                                    totalItems=item_count)
项目:plugin.video.youtube    作者:jdf76    | 项目源码 | 文件源码
def _add_image(self, context, image_item, item_count):
        item = xbmcgui.ListItem(label=image_item.get_name(),
                                iconImage=u'DefaultPicture.png',
                                thumbnailImage=image_item.get_image())

        # only set fanart is enabled
        if image_item.get_fanart() and self.settings.show_fanart():
            item.setProperty(u'fanart_image', image_item.get_fanart())
        if image_item.get_context_menu() is not None:
            item.addContextMenuItems(image_item.get_context_menu(), replaceItems=image_item.replace_context_menu())

        item.setInfo(type=u'picture', infoLabels=info_labels.create_from_item(context, image_item))

        xbmcplugin.addDirectoryItem(handle=self.handle,
                                    url=image_item.get_uri(),
                                    listitem=item,
                                    totalItems=item_count)
项目:plugin.video.eyny    作者:lydian    | 项目源码 | 文件源码
def main(self):
        filters = self.eyny.list_filters()
        xbmcplugin.addDirectoryItem(
                handle=self.addon_handle,
                url=self._build_url('search'),
                listitem=xbmcgui.ListItem('Search'),
                isFolder=True)

        for category in filters['categories']:
            li = xbmcgui.ListItem(category['name'])
            xbmcplugin.addDirectoryItem(
                handle=self.addon_handle,
                url=self._build_url('list', cid=category['cid']),
                listitem=li,
                isFolder=True)
        for orderby in filters['mod']:
            li = xbmcgui.ListItem(orderby['name'])
            xbmcplugin.addDirectoryItem(
                handle=self.addon_handle,
                url=self._build_url('list', orderby=orderby['orderby']),
                listitem=li,
                isFolder=True)
        xbmcplugin.endOfDirectory(addon_handle)
项目:plugin.video.eyny    作者:lydian    | 项目源码 | 文件源码
def _add_video_items(self, videos, current_url):
        for video in videos:
            li = xbmcgui.ListItem(label=video['title'])
            li.setProperty('IsPlayable', 'true')
            image_url = self.build_request_url(
                video['image'], current_url)
            li.setArt({
                'fanart': image_url,
                'icon': image_url,
                'thumb': image_url
            })
            li.addStreamInfo('video', {
                'width': video['quality'],
                'aspect': 1.78,
                'duration': video['duration']
            })
            li.setInfo('video', {'size': video['quality']})
            li.setProperty('VideoResolution', str(video['quality']))
            xbmcplugin.addDirectoryItem(
                handle=self.addon_handle,
                url=self._build_url('video', vid=video['vid']),
                listitem=li,
                isFolder=False)
项目:plugin.video.psvue    作者:eracknaphobia    | 项目源码 | 文件源码
def addShow(name, mode, icon, fanart, info, show_info):
    u = sys.argv[0] + "?mode=" + str(mode)
    u += '&program_id=' + show_info['program_id']

    liz = xbmcgui.ListItem(name)
    if fanart == None: fanart = FANART
    liz.setArt({'icon': icon, 'thumb': icon, 'fanart': fanart})
    liz.setInfo(type="Video", infoLabels=info)
    show_values =''
    for key, value in show_info.iteritems():
        show_values += '&' + key + '=' + value

    context_items = [('Add To My Shows', 'RunPlugin(plugin://plugin.video.psvue/?mode=1001'+show_values+')'),
                     ('Remove From My Shows', 'RunPlugin(plugin://plugin.video.psvue/?mode=1002'+show_values+')')]
    liz.addContextMenuItems(context_items)
    ok = xbmcplugin.addDirectoryItem(handle=addon_handle, url=u, listitem=liz, isFolder=True)
    xbmcplugin.setContent(addon_handle, 'tvshows')
项目:plugin.video.psvue    作者:eracknaphobia    | 项目源码 | 文件源码
def addStream(name, link_url, title, icon, fanart, info=None, properties=None, show_info=None):
    u = sys.argv[0] + "?url=" + urllib.quote_plus(link_url) + "&mode=" + str(900)
    #xbmc.log(str(info))
    liz = xbmcgui.ListItem(name)
    liz.setArt({'icon': icon, 'thumb': icon, 'fanart': fanart})
    if info != None: liz.setInfo(type="Video", infoLabels=info)
    if properties != None:
        for key, value in properties.iteritems():
            liz.setProperty(key,value)
    xbmc.log(str(show_info))
    if show_info != None:
        show_values =''
        for key, value in show_info.iteritems():
            show_values += '&' + key + '=' + value
        u += show_values
        if len(show_info) == 1:
            #Only add this option for channels not episodes
            context_items = [('Add To Favorites Channels', 'RunPlugin(plugin://plugin.video.psvue/?mode=1001'+show_values+')'),
                             ('Remove From Favorites Channels', 'RunPlugin(plugin://plugin.video.psvue/?mode=1002'+show_values+')')]
            liz.addContextMenuItems(context_items)
    ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz, isFolder=False)
    xbmcplugin.setContent(addon_handle, 'tvshows')
    return ok
项目:plugin.video.youtube    作者:Kolifanes    | 项目源码 | 文件源码
def _add_directory(self, context, directory_item, item_count=0):
        item = xbmcgui.ListItem(label=directory_item.get_name(),
                                iconImage=u'DefaultFolder.png',
                                thumbnailImage=directory_item.get_image())

        # only set fanart is enabled
        settings = context.get_settings()
        if directory_item.get_fanart() and settings.show_fanart():
            item.setProperty(u'fanart_image', directory_item.get_fanart())
            pass
        if directory_item.get_context_menu() is not None:
            item.addContextMenuItems(directory_item.get_context_menu(),
                                     replaceItems=directory_item.replace_context_menu())
            pass

        xbmcplugin.addDirectoryItem(handle=context.get_handle(),
                                    url=directory_item.get_uri(),
                                    listitem=item,
                                    isFolder=True,
                                    totalItems=item_count)
        pass
项目:plugin.video.youtube    作者:Kolifanes    | 项目源码 | 文件源码
def _add_image(self, context, image_item, item_count):
        item = xbmcgui.ListItem(label=image_item.get_name(),
                                iconImage=u'DefaultPicture.png',
                                thumbnailImage=image_item.get_image())

        # only set fanart is enabled
        settings = context.get_settings()
        if image_item.get_fanart() and settings.show_fanart():
            item.setProperty(u'fanart_image', image_item.get_fanart())
            pass
        if image_item.get_context_menu() is not None:
            item.addContextMenuItems(image_item.get_context_menu(), replaceItems=image_item.replace_context_menu())
            pass

        item.setInfo(type=u'picture', infoLabels=info_labels.create_from_item(context, image_item))

        xbmcplugin.addDirectoryItem(handle=context.get_handle(),
                                    url=image_item.get_uri(),
                                    listitem=item,
                                    totalItems=item_count)
        pass
项目:vkkodi    作者:VkKodi    | 项目源码 | 文件源码
def Do_FRIENDS(self):
        type = self.params["type"]

        #we have 'music', 'video', 'image'
        call_params={"fields": 'uid,first_name,last_name,photo_big,nickname', "order": 'hints', "v": "5.7"}
        if type == 'music':
            call_params["fields"] += ",can_see_audio"
        resp = self.api.call('friends.get', **call_params)

        friends = resp['items']
        for friend in friends:
            if 'deactivated' in friend:
                continue
            if type == 'music' and not friend.get('can_see_audio'):
                continue
            name = "%s %s" % (friend.get('last_name'), friend.get('first_name'))
            if friend.get('nickname'):
                name += " " + friend.get('nickname')
            listItem = xbmcgui.ListItem(name, "", friend['photo_big'])
            xbmcplugin.addDirectoryItem(self.handle, self.GetURL(mode=FRIEND_ENTRY, uid=friend['id'], thumb=friend['photo_big']), listItem, True)
项目:vkkodi    作者:VkKodi    | 项目源码 | 文件源码
def AddAudioEntry(self, a):
        title = a.get("artist")
        if title:
            title += u" : "
        title += a.get("title")
        d = unicode(datetime.timedelta(seconds=int(a["duration"])))
        listTitle = d + u" - " + title
        listitem = xbmcgui.ListItem(PrepareString(listTitle))
        xbmc.log(str(a),xbmc.LOGDEBUG)
        listitem.setInfo(type='Music', infoLabels={'title': a.get("title") or "",
                                                   'artist': a.get("artist") or "",
                                                   'album': a.get("artist") or "",
                                                   'duration': a.get('duration') or 0})
        listitem.setProperty('mimetype', 'audio/mpeg')

        xbmcplugin.addDirectoryItem(self.handle, a["url"], listitem, False)
项目:vkkodi    作者:VkKodi    | 项目源码 | 文件源码
def Do_ALBUM(self):
        album = self.api.call("photos.get", uid = self.params["user"], aid = self.params["album"])
        photos = []
        for cameo in album:
            title = None
            if cameo["text"]:
                title = cameo["text"] + u" (" + unicode(str(datetime.fromtimestamp(int(cameo["created"])))) + u")"
            else:
                title =  unicode(str(datetime.fromtimestamp(int(cameo["created"]))))
            title = PrepareString(title)
            e = ( title,
                  cameo.get("src_xxbig") or cameo.get("src_xbig") or cameo.get("src_big") or cameo["src"],
                  cameo["src"] )
            photos.append(e)
        for title, url, thumb in photos:
            listItem = xbmcgui.ListItem(title, "", thumb, thumb, ) #search history
            xbmcplugin.addDirectoryItem(self.handle, url , listItem, False)
项目:vkkodi    作者:VkKodi    | 项目源码 | 文件源码
def Do_SEARCH_RESULT(self):
        vf = GetVideoFilesAPI(self.params["v"])
        if vf:
            for a in vf:
                n = a[a.rfind("/")+1:]
                if a.startswith("http"):
                    n = __language__(30039) + " " + n
                else:
                    n = "YouTube: " + n
                listitem = xbmcgui.ListItem(n, "", self.params.get("thumb"), self.params.get("thumb"), path=a)
                listitem.setProperty('IsPlayable', 'true')
                listitem.setInfo(type = "video", infoLabels = {'title': self.params.get("title")})                
                xbmcplugin.addDirectoryItem(self.handle, a, listitem)
        if vf and __settings__.getSetting("ShowDownload") == "true":        
            for a in vf:
                if a.startswith("http"):
                    listitem = xbmcgui.ListItem(__language__(30035) + " " + a[a.rfind("/")+1:], "", self.params.get("thumb"), self.params.get("thumb"))
                    xbmcplugin.addDirectoryItem(self.handle, self.GetURL(mode=VIDEO_DOWNLOAD, thumb=self.params.get("thumb"), v=base64.encodestring(a).strip()), listitem, False)
项目:plugin.video.skygo    作者:trummerjo    | 项目源码 | 文件源码
def listSeasonsFromSeries(series_id):
    url = skygo.baseUrl + '/sg/multiplatform/web/json/details/series/' + str(series_id) + '_global.json'
    r = requests.get(url)
    data = r.json()['serieRecap']['serie']
    xbmcplugin.setContent(addon_handle, 'seasons')
    for season in data['seasons']['season']:
        url = common.build_url({'action': 'listSeason', 'id': season['id'], 'series_id': data['id']})
        label = '%s - Staffel %02d' % (data['title'], season['nr'])
        li = xbmcgui.ListItem(label=label)
        li.setProperty('IsPlayable', 'false')
        li.setArt({'poster': skygo.baseUrl + season['path'], 
                   'fanart': getHeroImage(data)})
        li.setInfo('video', {'plot': data['synopsis'].replace('\n', '').strip()})
        xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
                                        listitem=li, isFolder=True)

    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_NONE)
    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_TITLE)
    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_LABEL)
    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_VIDEO_YEAR)   
    xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=True)
项目:plugin.video.prime_instant    作者:liberty-developer    | 项目源码 | 文件源码
def addShowDir(name, url, mode, iconimage, videoType="", desc="", duration="", year="", mpaa="", director="", genre="", rating="", showAll = False):
    filename = (''.join(c for c in url if c not in '/\\:?"*|<>')).strip()+".jpg"
    coverFile = os.path.join(cacheFolderCoversTMDB, filename)
    fanartFile = os.path.join(cacheFolderFanartTMDB, filename)
    if os.path.exists(coverFile):
        iconimage = coverFile
    sAll = ""
    if (showAll):
        sAll = "&showAll=true"
    u = sys.argv[0]+"?url="+urllib.quote_plus(url.encode("utf8"))+"&mode="+str(mode)+"&thumb="+urllib.quote_plus(iconimage.encode("utf8"))+"&name="+urllib.quote_plus(name.encode("utf8"))+sAll
    ok = True
    liz = xbmcgui.ListItem(name, iconImage="DefaultTVShows.png", thumbnailImage=iconimage)
    liz.setInfo(type="video", infoLabels={"title": name, "plot": desc, "duration": duration, "year": year, "mpaa": mpaa, "director": director, "genre": genre, "rating": rating})
    liz.setArt({"fanart": fanartFile, "poster": iconimage})
    entries = []
    entries.append((translation(30051), 'RunPlugin(plugin://'+addonID+'/?mode=playTrailer&url='+urllib.quote_plus(url.encode("utf8"))+')',))
    entries.append((translation(30052), 'RunPlugin(plugin://'+addonID+'/?mode=addToQueue&url='+urllib.quote_plus(url.encode("utf8"))+'&videoType='+urllib.quote_plus(videoType.encode("utf8"))+')',))
    entries.append((translation(30057), 'Container.Update(plugin://'+addonID+'/?mode=listSimilarMovies&url='+urllib.quote_plus(url.encode("utf8"))+')',))
    entries.append((translation(30058), 'Container.Update(plugin://'+addonID+'/?mode=listSimilarShows&url='+urllib.quote_plus(url.encode("utf8"))+')',))
    liz.addContextMenuItems(entries)
    ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz, isFolder=True)
    return ok
项目:plugin.video.prime_instant    作者:liberty-developer    | 项目源码 | 文件源码
def addShowDirR(name, url, mode, iconimage, videoType="", desc="", duration="", year="", mpaa="", director="", genre="", rating="", showAll=False):
    filename = (''.join(c for c in url if c not in '/\\:?"*|<>')).strip()+".jpg"
    coverFile = os.path.join(cacheFolderCoversTMDB, filename)
    fanartFile = os.path.join(cacheFolderFanartTMDB, filename)
    if os.path.exists(coverFile):
        iconimage = coverFile
    sAll = ""
    if showAll:
        sAll = "&showAll=true"
    u = sys.argv[0]+"?url="+urllib.quote_plus(url.encode("utf8"))+"&mode="+str(mode)+"&thumb="+urllib.quote_plus(iconimage.encode("utf8"))+"&name="+urllib.quote_plus(name.encode("utf8"))+sAll
    ok = True
    liz = xbmcgui.ListItem(name, iconImage="DefaultTVShows.png", thumbnailImage=iconimage)
    liz.setInfo(type="video", infoLabels={"mediatype": "tvshow", "title": name, "plot": desc, "duration": duration, "year": year, "mpaa": mpaa, "director": director, "genre": genre, "rating": rating})
    liz.setArt({"fanart": fanartFile, "poster": iconimage})
    entries = []
    entries.append((translation(30051), 'RunPlugin(plugin://'+addonID+'/?mode=playTrailer&url='+urllib.quote_plus(url.encode("utf8"))+')',))
    entries.append((translation(30053), 'RunPlugin(plugin://'+addonID+'/?mode=removeFromQueue&url='+urllib.quote_plus(url.encode("utf8"))+'&videoType='+urllib.quote_plus(videoType.encode("utf8"))+')',))
    entries.append((translation(30057), 'Container.Update(plugin://'+addonID+'/?mode=listSimilarMovies&url='+urllib.quote_plus(url.encode("utf8"))+')',))
    entries.append((translation(30058), 'Container.Update(plugin://'+addonID+'/?mode=listSimilarShows&url='+urllib.quote_plus(url.encode("utf8"))+')',))
    liz.addContextMenuItems(entries)
    ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz, isFolder=True)
    return ok
项目:plugin.video.prime_instant    作者:liberty-developer    | 项目源码 | 文件源码
def addLinkR(name, url, mode, iconimage, videoType="", desc="", duration="", year="", mpaa="", director="", genre="", rating=""):
    filename = (''.join(c for c in url if c not in '/\\:?"*|<>')).strip()+".jpg"
    fanartFile = os.path.join(cacheFolderFanartTMDB, filename)
    u = sys.argv[0]+"?url="+urllib.quote_plus(url.encode("utf8"))+"&mode="+str(mode)+"&name="+urllib.quote_plus(name.encode("utf8"))+"&thumb="+urllib.quote_plus(iconimage.encode("utf8"))
    ok = True
    liz = xbmcgui.ListItem(name, iconImage="DefaultTVShows.png", thumbnailImage=iconimage)
    liz.setInfo(type="video", infoLabels={"mediatype": videoType, "title": name, "plot": desc, "duration": duration, "year": year, "mpaa": mpaa, "director": director, "genre": genre, "rating": rating})
    liz.setArt({"fanart": fanartFile, "poster": iconimage})
    entries = []
    entries.append((translation(30054), 'RunPlugin(plugin://'+addonID+'/?mode=playVideo&url='+urllib.quote_plus(url.encode("utf8"))+'&selectQuality=true)',))
    entries.append((translation(30060), 'Container.Update(plugin://'+addonID+'/?mode=showInfo&url='+urllib.quote_plus(url.encode("utf8"))+')',))
    entries.append((translation(30051), 'RunPlugin(plugin://'+addonID+'/?mode=playTrailer&url='+urllib.quote_plus(url.encode("utf8"))+')',))
    entries.append((translation(30053), 'RunPlugin(plugin://'+addonID+'/?mode=removeFromQueue&url='+urllib.quote_plus(url.encode("utf8"))+'&videoType='+urllib.quote_plus(videoType.encode("utf8"))+')',))
    if videoType == "movie":
        titleTemp = name.strip()
        if year:
            titleTemp += ' ('+year+')'
        entries.append((translation(30055), 'RunPlugin(plugin://'+addonID+'/?mode=addMovieToLibrary&url='+urllib.quote_plus(url.encode("utf8"))+'&name='+urllib.quote_plus(titleTemp.encode("utf8"))+')',))
    entries.append((translation(30057), 'Container.Update(plugin://'+addonID+'/?mode=listSimilarMovies&url='+urllib.quote_plus(url.encode("utf8"))+')',))
    entries.append((translation(30058), 'Container.Update(plugin://'+addonID+'/?mode=listSimilarShows&url='+urllib.quote_plus(url.encode("utf8"))+')',))
    liz.addContextMenuItems(entries)
    liz.setProperty('IsPlayable', 'true')
    ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz)
    return ok
项目:crossplatform_iptvplayer    作者:j00zek    | 项目源码 | 文件源码
def showTopOptions():
    #EXIT
    if ADDON.getSetting("showExitOption") == "true":
        list_item = xbmcgui.ListItem(label = _(30425))
        url = get_url(action='exitPlugin')
        is_folder = False
        list_item.setArt({'thumb': xbmc.translatePath('special://home/addons/plugin.video.IPTVplayer/resources/icons/exit.png')})
        xbmcplugin.addDirectoryItem(ADDON_handle, url, list_item, is_folder)
    #HOSTS LIST
    if ADDON.getSetting("showHostListOption") == "true":
        list_item = xbmcgui.ListItem(label = _(30426))
        url = get_url(action='reloadHostsList')
        is_folder = False
        list_item.setArt({'thumb': xbmc.translatePath('special://home/addons/plugin.video.IPTVplayer/resources/icons/home.png')})
        xbmcplugin.addDirectoryItem(ADDON_handle, url, list_item, is_folder)
    #INITIAL LIST
    if ADDON.getSetting("showInitialListOption") == "true":
        list_item = xbmcgui.ListItem(label = _(30427))
        url = get_url(action='InitialList')
        is_folder = False
        list_item.setArt({'thumb': xbmc.translatePath('special://home/addons/plugin.video.IPTVplayer/resources/icons/initlist.png')})
        xbmcplugin.addDirectoryItem(ADDON_handle, url, list_item, is_folder)
    return
项目:crossplatform_iptvplayer    作者:j00zek    | 项目源码 | 文件源码
def getDownloaderStatus():
    for filename in os.listdir(ADDON.getSetting("config.plugins.iptvplayer.NaszaSciezka")):
        if filename.endswith('.wget'):
            myLog('Found: [%s]' % filename)
            list_item = xbmcgui.ListItem(label = filename[:-5])
            url = get_url(action='wgetRead', fileName=filename)
            is_folder = False
            last_Lines = ''
            with open(os.path.join(ADDON.getSetting("config.plugins.iptvplayer.NaszaSciezka") , filename)) as f:
                last_Lines = f.readlines()[-5:]
                f.close()
            if ''.join(last_Lines).find('100%') > 0:
                list_item.setArt({'thumb': xbmc.translatePath('special://home/addons/plugin.video.IPTVplayer/resources/icons/done.png')})
            else:
                list_item.setArt({'thumb': xbmc.translatePath('special://home/addons/plugin.video.IPTVplayer/resources/icons/progress.png')})
            xbmcplugin.addDirectoryItem(ADDON_handle, url, list_item, is_folder)
    #last but not least delete all status files        
    list_item = xbmcgui.ListItem(label = _(30434))
    url = get_url(action='wgetDelete')
    is_folder = False
    list_item.setArt({'thumb': xbmc.translatePath('special://home/addons/plugin.video.IPTVplayer/resources/icons/delete.png')})
    xbmcplugin.addDirectoryItem(ADDON_handle, url, list_item, is_folder)
    #closing directory
    xbmcplugin.endOfDirectory(ADDON_handle)
    return
项目: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
项目:kan-for-kodi    作者:dvircohen    | 项目源码 | 文件源码
def add_item( action="" , title="" , plot="" , url="" , thumbnail="" , fanart="" , show="" , episode="" , extra="", page="", info_labels = None, isPlayable = False , folder=True ):
    _log("add_item action=["+action+"] title=["+title+"] url=["+url+"] thumbnail=["+thumbnail+"] fanart=["+fanart+"] show=["+show+"] episode=["+episode+"] extra=["+extra+"] page=["+page+"] isPlayable=["+str(isPlayable)+"] folder=["+str(folder)+"]")

    listitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", thumbnailImage=thumbnail )
    if info_labels is None:
        info_labels = { "Title" : title, "FileName" : title, "Plot" : plot }
    listitem.setInfo( "video", info_labels )

    if fanart!="":
        listitem.setProperty('fanart_image',fanart)
        xbmcplugin.setPluginFanart(int(sys.argv[1]), fanart)

    if url.startswith("plugin://"):
        itemurl = url
        listitem.setProperty('IsPlayable', 'true')
        xbmcplugin.addDirectoryItem( handle=int(sys.argv[1]), url=itemurl, listitem=listitem, isFolder=folder)
    elif isPlayable:
        listitem.setProperty("Video", "true")
        listitem.setProperty('IsPlayable', 'true')
        itemurl = '%s?action=%s&title=%s&url=%s&thumbnail=%s&plot=%s&extra=%s&page=%s' % ( sys.argv[ 0 ] , action , urllib.quote_plus( title ) , urllib.quote_plus(url) , urllib.quote_plus( thumbnail ) , urllib.quote_plus( plot ) , urllib.quote_plus( extra ) , urllib.quote_plus( page ))
        xbmcplugin.addDirectoryItem( handle=int(sys.argv[1]), url=itemurl, listitem=listitem, isFolder=folder)
    else:
        itemurl = '%s?action=%s&title=%s&url=%s&thumbnail=%s&plot=%s&extra=%s&page=%s' % ( sys.argv[ 0 ] , action , urllib.quote_plus( title ) , urllib.quote_plus(url) , urllib.quote_plus( thumbnail ) , urllib.quote_plus( plot ) , urllib.quote_plus( extra ) , urllib.quote_plus( page ))
        xbmcplugin.addDirectoryItem( handle=int(sys.argv[1]), url=itemurl, listitem=listitem, isFolder=folder)
项目:nuodtayo.tv    作者:benaranguren    | 项目源码 | 文件源码
def addDir(name, url, mode, thumbnail, page=0, isFolder=True,
           data_id=0, page_item=0, **kwargs):
    u = ('%s?url=%s&mode=%s&name=%s&page=%s' \
         '&thumbnail=%s&data_id=%s&page_item=%s' % (
            sys.argv[0],
            urllib.quote_plus(url),
            str(mode),
            urllib.quote_plus(name),
            str(page),
            urllib.quote_plus(thumbnail),
            str(data_id),
            str(page_item)
        ))
    liz = xbmcgui.ListItem(name, iconImage="DefaultFolder.png",
                           thumbnailImage=thumbnail)
    liz.setInfo( type="Video", infoLabels={ "Title": name } )
    for k, v in kwargs.iteritems():
        if k == 'listProperties':
            for listPropertyKey, listPropertyValue in v.iteritems():
                liz.setProperty(listPropertyKey, listPropertyValue)
        if k == 'listInfos':
            for listInfoKey, listInfoValue in v.iteritems():
                liz.setInfo(listInfoKey, listInfoValue)

    return xbmcplugin.addDirectoryItem(handle=thisPlugin,
                                       url=u,
                                       listitem=liz,
                                       isFolder=isFolder)
项目:cmik.xbmc    作者:cmik    | 项目源码 | 文件源码
def addDir(name, url, mode, thumbnail, page = 0, isFolder = True, **kwargs):
    u = sys.argv[0] + "?url=" + urllib.quote_plus(url) + "&mode=" + str(mode) + "&name=" + urllib.quote_plus(name) + "&page=" + str(page) + "&thumbnail=" + urllib.quote_plus(thumbnail)
    liz = xbmcgui.ListItem(name, iconImage = "DefaultFolder.png", thumbnailImage = thumbnail)
    liz.setInfo( type = "Video", infoLabels = { "Title": name } )
    for k, v in kwargs.iteritems():
        if k == 'listProperties':
            for listPropertyKey, listPropertyValue in v.iteritems():
                liz.setProperty(listPropertyKey, listPropertyValue)
        if k == 'listInfos':
            for listInfoKey, listInfoValue in v.iteritems():
                liz.setInfo(listInfoKey, listInfoValue)
        if k == 'listArts':
            for listArtKey, listArtValue in v.iteritems():
                liz.setArt(v)
    return xbmcplugin.addDirectoryItem(handle = thisPlugin, url = u,listitem = liz, isFolder = isFolder)
项目:plugin.audio.euskarazko-irratiak    作者:aldatsa    | 项目源码 | 文件源码
def show_main_menu():
    # Create menu directory for the live radios
    url = build_url({'mode': 'streams', 'foldername': ADDON.getLocalizedString(30001)})
    li = xbmcgui.ListItem(ADDON.getLocalizedString(30001), iconImage='DefaultFolder.png')
    xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
                                listitem=li, isFolder=True)

    # Create menu directory for the podcasts
    url = build_url({'mode': 'podcasts-radios', 'foldername': ADDON.getLocalizedString(30002)})
    li = xbmcgui.ListItem(ADDON.getLocalizedString(30002), iconImage='DefaultFolder.png')
    xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
                                listitem=li, isFolder=True)

    xbmcplugin.endOfDirectory(addon_handle)
项目:service.subtitles.tusubtitulo    作者:josecurioso2    | 项目源码 | 文件源码
def append_subtitle(item):
    listitem = xbmcgui.ListItem(label=item['language_name'],  label2=item['filename'], iconImage=item['rating'], thumbnailImage=item['lang'])

    listitem.setProperty("sync",  'true' if item["sync"] else 'false')
    listitem.setProperty("hearing_imp", 'true' if item["hearing_imp"] else 'false')

    ## below arguments are optional, it can be used to pass any info needed in download function
    ## anything after "action=download&" will be sent to addon once user clicks listed subtitle to downlaod
    url = "plugin://%s/?action=download&link=%s&filename=%s" % (__scriptid__, item['link'], item['filename'])

    ## add it to list, this can be done as many times as needed for all subtitles found
    xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=False)