python类addDirectoryItem()的实例源码

ps_vue.py 文件源码 项目:plugin.video.psvue 作者: eracknaphobia 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
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')
ps_vue.py 文件源码 项目:plugin.video.psvue 作者: eracknaphobia 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
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
xbmc_runner.py 文件源码 项目:plugin.video.youtube 作者: Kolifanes 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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
xbmc_runner.py 文件源码 项目:plugin.video.youtube 作者: Kolifanes 项目源码 文件源码 阅读 15 收藏 0 点赞 0 评论 0
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
xbmcvkui.py 文件源码 项目:vkkodi 作者: VkKodi 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
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)
xvaudio.py 文件源码 项目:vkkodi 作者: VkKodi 项目源码 文件源码 阅读 15 收藏 0 点赞 0 评论 0
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)
xvimage.py 文件源码 项目:vkkodi 作者: VkKodi 项目源码 文件源码 阅读 41 收藏 0 点赞 0 评论 0
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)
xvvideo.py 文件源码 项目:vkkodi 作者: VkKodi 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
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)
navigation.py 文件源码 项目:plugin.video.skygo 作者: trummerjo 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
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)
default.py 文件源码 项目:plugin.video.prime_instant 作者: liberty-developer 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
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
default.py 文件源码 项目:plugin.video.prime_instant 作者: liberty-developer 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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
default.py 文件源码 项目:plugin.video.prime_instant 作者: liberty-developer 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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
addon.py 文件源码 项目:crossplatform_iptvplayer 作者: j00zek 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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
addon.py 文件源码 项目:crossplatform_iptvplayer 作者: j00zek 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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
addon.py 文件源码 项目:crossplatform_iptvplayer 作者: j00zek 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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
plugintools.py 文件源码 项目:kan-for-kodi 作者: dvircohen 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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)
default.py 文件源码 项目:nuodtayo.tv 作者: benaranguren 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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)
default.py 文件源码 项目:cmik.xbmc 作者: cmik 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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)
default.py 文件源码 项目:plugin.audio.euskarazko-irratiak 作者: aldatsa 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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.py 文件源码 项目:service.subtitles.tusubtitulo 作者: josecurioso2 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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)


问题


面经


文章

微信
公众号

扫码关注公众号