当前位置: 首页>>代码示例>>Python>>正文


Python control.addItem函数代码示例

本文整理汇总了Python中resources.lib.modules.control.addItem函数的典型用法代码示例。如果您正苦于以下问题:Python addItem函数的具体用法?Python addItem怎么用?Python addItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了addItem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_last_visited

def add_last_visited(anime_id):
    try:
        c = cache.get(masterani.get_anime_details, 8, anime_id)
        
        lastEpisode = watched.Watched().watched(anime_id)
        
        plot = c['plot']
        premiered = c['premiered']
        genre = c['genre']
        
        type = c['type']

        sysaddon = sys.argv[0]
        addon_poster = addon_banner = control.addonInfo('icon')
        addon_fanart = control.addonInfo('fanart')

        item = control.item("Last Played: [I]%s[/I]" % (c['title']))

        poster = "http://cdn.masterani.me/poster/%s" % c['poster']
        fanart = "http://cdn.masterani.me/wallpaper/0/%s" % c['fanart'][0]
        item.setArt({'poster': poster})
        item.setProperty("Fanart_Image", fanart)
        item.setInfo(type='Video', infoLabels={
            'Plot': plot, 'Year': premiered, 'premiered': premiered,
            'genre': genre, 'mediatype': 'tvshow' 
        })

        url = '%s?action=get_episodes' % sysaddon
        try: url += '&anime_id=%s' % anime_id
        except: pass

        control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)
    except:
        pass
开发者ID:varunrai,项目名称:Masterani-Redux,代码行数:34,代码来源:root.py

示例2: addDirectoryItem

    def addDirectoryItem(self, name, query, thumb, icon, queue=False, isAction=True, isFolder=True, imgPath = None):

        self.logger = logging.getLogger('funimationnow');

        try: 

            name = control.lang(name).encode('utf-8') if isinstance(name, (int, long)) else name;

        except: 
            pass;

        url = '%s?action=%s' % (sysaddon, query) if isAction == True else query;

        artPath = control.artPath(imgPath);
        thumb = os.path.join(artPath, thumb) if not artPath == None else icon;

        cm = [];

        if queue == True: 
            cm.append((queueMenu, 'RunPlugin(%s?action=queueItem)' % sysaddon));

        item = control.item(label=name);

        item.addContextMenuItems(cm);
        item.setArt({'icon': thumb, 'thumb': thumb});

        if not addonFanart == None: 
            item.setProperty('Fanart_Image', addonFanart);

        control.addItem(handle=syshandle, url=url, listitem=item, isFolder=isFolder);
开发者ID:gedisony,项目名称:repo-plugins,代码行数:30,代码来源:navigator.py

示例3: addDirectory

    def addDirectory(self, items, queue=False):
        if items == None or len(items) == 0: return

        sysaddon = sys.argv[0]
        isPlayable = False if control.setting('autoplay') == 'false' and control.setting('hosts.mode') == '1' else True
        addonFanart, addonThumb, artPath = control.addonFanart(), control.addonThumb(), control.artPath()

        for i in items:
            try:
                try: name = control.lang(i['name']).encode('utf-8')
                except: name = i['name']

                if i['image'].startswith('http://'): thumb = i['image']
                elif not artPath == None: thumb = os.path.join(artPath, i['image'])
                else: thumb = addonThumb

                url = '%s?action=%s' % (sysaddon, i['action'])
                try: url += '&url=%s' % urllib.quote_plus(i['url'])
                except: pass

                cm = []

                if queue == True and isPlayable == True:
                    cm.append((control.lang(30202).encode('utf-8'), 'RunPlugin(%s?action=queueItem)' % sysaddon))

                item = control.item(label=name, iconImage=thumb, thumbnailImage=thumb)
                item.addContextMenuItems(cm, replaceItems=False)
                if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)
            except:
                pass

        control.directory(int(sys.argv[1]), cacheToDisc=True)
开发者ID:freeworldxbmc,项目名称:maximumTv,代码行数:33,代码来源:movies.py

示例4: listBollywood

    def listBollywood(self, url, page):
        try: html = client.request(url + 'page/' + str(page))
        except: pass

        syshandle = int(sys.argv[1])

        result = client.parseDOM(html, 'article', attrs={'id': 'posts'})
        result = [(client.parseDOM(i, 'a', ret='href'), client.parseDOM(i, 'img', ret='src'), client.parseDOM(i, 'a')) for i in result]
        result = [(i[0][0], i[1][0], i[2][1]) for i in result if len(i[0]) > 0 and len(i[1]) > 0 and len(i[2][1]) > 0]

        for movie in result:
            uri = movie[0]
            image = movie[1]
            name = movie[2]
            action = 'resolveBollywoodUrl'
            query = '%s?action=%s&name=%s&url=%s&image=%s' % (sysaddon, action, name, uri, image)
            item = control.item(name, iconImage=image, thumbnailImage=image)
            item.setInfo(type="Video", infoLabels={"Title": name, "OriginalTitle": name})
            control.addItem(handle=int(sys.argv[1]), url=query, listitem=item, isFolder=True)

        pageNum = int(page)+1
        query = '%s?action=%s&url=%s&page=%s' % (sysaddon, 'listBollywood', url, pageNum)

        item = control.item('Next page', iconImage='', thumbnailImage='')
        item.setInfo(type="Video", infoLabels={"Title": 'Page ' + str(page), "OriginalTitle": 'Page ' + str(page)})
        control.addItem(handle=syshandle, url=query, listitem=item, isFolder=True)

        control.content(syshandle, 'movies')
        control.directory(syshandle, cacheToDisc=True)
        views.setView('movies', {'skin.estuary': 500, 'skin.confluence': 500})
开发者ID:mpie,项目名称:repo,代码行数:30,代码来源:bollywood.py

示例5: addPlaylistItem

    def addPlaylistItem(self, name, playlist_id, icon, fanart):
        work_url = "plugin://plugin.video.youtube/playlist/"+playlist_id+"/"
        liz=control.item(name)
        liz.setInfo( type="Video", infoLabels={ "Title": name })
        liz.setArt({ 'thumb': icon, 'banner' : 'DefaultVideo.png', 'fanart': fanart })
#        liz.setPath(work_url)
        control.addItem(handle=syshandle,url=work_url,listitem=liz,isFolder=True)
开发者ID:varunrai,项目名称:repository.magicality,代码行数:7,代码来源:youtube_menu.py

示例6: addCategoryItem

def addCategoryItem(name, action, image, isFolder=True):
    u = '%s?action=%s' % (sys.argv[0], str(action))
    image = control.addonInfo('path') + '/resources/media/LwSLive/' + image
    item = control.item(name, iconImage=image, thumbnailImage=image)
    item.addContextMenuItems([], replaceItems=False)
    item.setProperty('Fanart_Image', control.addonInfo('fanart'))
    control.addItem(handle=int(sys.argv[1]),url=u,listitem=item,isFolder=isFolder)
开发者ID:azumimuo,项目名称:family-xbmc-addon,代码行数:7,代码来源:LwSLive.py

示例7: addDirectory

    def addDirectory(self, items):
        if items == None or len(items) == 0: return

        sysaddon = sys.argv[0]
        addonFanart, addonThumb, artPath = control.addonFanart(), control.addonThumb(), control.artPath()

        for i in items:
            try:
                try: name = control.lang(i['name']).encode('utf-8')
                except: name = i['name']

                if i['image'].startswith('http://'): thumb = i['image']
                elif not artPath == None: thumb = os.path.join(artPath, i['image'])
                else: thumb = addonThumb

                url = '%s?action=%s' % (sysaddon, i['action'])
                try: url += '&url=%s' % urllib.quote_plus(i['url'])
                except: pass

                cm = []

                item = control.item(label=name, iconImage=thumb, thumbnailImage=thumb)
                item.addContextMenuItems(cm, replaceItems=False)
                if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)
            except:
                pass

        control.directory(int(sys.argv[1]), cacheToDisc=True)
开发者ID:mitnits,项目名称:exodus,代码行数:29,代码来源:tvshows.py

示例8: views

    def views(self):
        try:
            control.idle()

            items = [ (control.lang(32001).encode('utf-8'), 'movies'), (control.lang(32002).encode('utf-8'), 'tvshows'), (control.lang(32054).encode('utf-8'), 'seasons'), (control.lang(32038).encode('utf-8'), 'episodes') ]

            select = control.selectDialog([i[0] for i in items], control.lang(32049).encode('utf-8'))

            if select == -1: return

            content = items[select][1]

            title = control.lang(32059).encode('utf-8')
            url = '%s?action=addView&content=%s' % (sys.argv[0], content)

            poster, banner, fanart = control.addonPoster(), control.addonBanner(), control.addonFanart()

            item = control.item(label=title)
            item.setInfo(type='Video', infoLabels = {'title': title})
            item.setArt({'icon': poster, 'thumb': poster, 'poster': poster, 'banner': banner})
            item.setProperty('Fanart_Image', fanart)

            control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=False)
            control.content(int(sys.argv[1]), content)
            control.directory(int(sys.argv[1]), cacheToDisc=True)

            from resources.lib.modules import cache
            views.setView(content, {})
        except:
            return
开发者ID:azumimuo,项目名称:family-xbmc-addon,代码行数:30,代码来源:navigator.py

示例9: addDirectoryItem

def addDirectoryItem(name, action, thumb, image, fanart, url='0'):
    if thumb == '0': thumb = image
    u = '%s?action=%s&url=%s&image=%s&fanart=%s' % (sys.argv[0], str(action), urllib.quote_plus(url), urllib.quote_plus(thumb), urllib.quote_plus(fanart))
    item = control.item(name, iconImage=thumb, thumbnailImage=thumb)
    item.addContextMenuItems([], replaceItems=False)
    item.setProperty('Fanart_Image', fanart)
    control.addItem(handle=int(sys.argv[1]),url=u,listitem=item,isFolder=True)
开发者ID:azumimuo,项目名称:family-xbmc-addon,代码行数:7,代码来源:phtoons.py

示例10: channelDirectory

    def channelDirectory(self, items):
        if items == None or len(items) == 0: return

        playbackMenu = control.lang(30292).encode('utf-8') if control.setting('autoplay') == 'true' else control.lang(30291).encode('utf-8')

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()
        addonFanart = control.addonFanart()
        sysaddon = sys.argv[0]


        for i in items:
            try:
                label = '[B]%s[/B] : %s (%s)' % (i['channel'].upper(), i['title'], i['year'])
                sysname = urllib.quote_plus('%s (%s)' % (i['title'], i['year']))
                systitle = urllib.quote_plus(i['title'])
                imdb, year = i['imdb'], i['year']

                poster, banner = i['poster'], i['poster']
                if poster == '0': poster = addonPoster
                if banner == '0' and poster == '0': banner = addonBanner
                elif banner == '0': banner = poster

                meta = dict((k,v) for k, v in i.iteritems() if not v == '0')
                meta.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, sysname)})
                if i['duration'] == '0': meta.update({'duration': '120'})
                try: meta.update({'duration': str(int(meta['duration']) * 60)})
                except: pass
                sysmeta = urllib.quote_plus(json.dumps(meta))

                url = '%s?action=play&title=%s&year=%s&imdb=%s&meta=%s&t=%s' % (sysaddon, systitle, year, imdb, sysmeta, self.systime)
                sysurl = urllib.quote_plus(url)

                cm = []
                cm.append((playbackMenu, 'RunPlugin(%s?action=alterSources&url=%s&meta=%s)' % (sysaddon, sysurl, sysmeta)))
                cm.append((control.lang(30297).encode('utf-8'), 'RunPlugin(%s?action=trailer&name=%s)' % (sysaddon, sysname)))
                cm.append((control.lang(30293).encode('utf-8'), 'Action(Info)'))
                cm.append((control.lang(30294).encode('utf-8'), 'RunPlugin(%s?action=refresh)' % (sysaddon)))
                cm.append((control.lang(30295).encode('utf-8'), 'RunPlugin(%s?action=openSettings)' % (sysaddon)))
                cm.append((control.lang(30296).encode('utf-8'), 'RunPlugin(%s?action=openPlaylist)' % (sysaddon)))

                item = control.item(label=label, iconImage=poster, thumbnailImage=poster)

                try: item.setArt({'poster': poster, 'banner': banner})
                except: pass

                if not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                item.setInfo(type='Video', infoLabels = meta)
                item.setProperty('Video', 'true')
                #item.setProperty('IsPlayable', 'true')
                item.addContextMenuItems(cm, replaceItems=True)
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=False)
            except:
                pass

        control.content(int(sys.argv[1]), 'movies')
        #control.do_block_check(False)
        control.directory(int(sys.argv[1]), cacheToDisc=True)
开发者ID:hieuhienvn,项目名称:hieuhien.vn,代码行数:59,代码来源:channels.py

示例11: addCategoryItem

def addCategoryItem(name, action, image, fanart, url='0'):
    u = '%s?action=%s&url=%s&image=%s&fanart=%s' % (sys.argv[0], str(action), urllib.quote_plus(url), urllib.quote_plus(image), urllib.quote_plus(fanart))
    item = control.item(name, iconImage=image, thumbnailImage=image)
    try: item.setArt({'icon': image})
    except: pass
    item.addContextMenuItems([], replaceItems=False)
    item.setProperty('Fanart_Image', fanart)
    control.addItem(handle=int(sys.argv[1]),url=u,listitem=item,isFolder=True)
开发者ID:rofunds,项目名称:maximumTv,代码行数:8,代码来源:phradios.py

示例12: addVideoItem

    def addVideoItem(self, name, video_id, icon, fanart):
        work_url = "plugin://plugin.video.youtube/play/?video_id="+video_id
        liz=control.item(name)
        liz.setInfo( type="Video", infoLabels={ "Title": name })
        liz.setArt({ 'thumb': icon, 'banner' : 'DefaultVideo.png', 'fanart': fanart })
#        liz.setPath(work_url)
        liz.setProperty('IsPlayable', 'true')
        control.addItem(handle=syshandle,url=work_url,listitem=liz,isFolder=True)
开发者ID:varunrai,项目名称:repository.magicality,代码行数:8,代码来源:youtube_menu.py

示例13: addCategoryItem

def addCategoryItem(name, action, image, isFolder=True):
    u = '%s?action=%s' % (sys.argv[0], str(action))
    item = control.item(name, iconImage=image, thumbnailImage=image)
    try: item.setArt({'icon': image})
    except: pass
    item.addContextMenuItems([], replaceItems=False)
    item.setProperty('Fanart_Image', control.addonInfo('fanart'))
    control.addItem(handle=int(sys.argv[1]),url=u,listitem=item,isFolder=isFolder)
开发者ID:c0ns0le,项目名称:YCBuilds,代码行数:8,代码来源:phstreams.py

示例14: addDir

    def addDir(self, name, info, u, action, image, isFolder=True):
        url = (sysaddon + "?url=" + urllib.quote_plus(u) + "&name=" + urllib.quote_plus(name.encode('utf-8')) + "&action=" + action + "&image=" + image)

        item = control.item(label=name.encode('utf-8'))
        item.setArt({'icon': image, 'thumb': image})
        item.setInfo(type="Video", infoLabels={"Title": name.encode('utf-8'), "OriginalTitle": name.encode('utf-8'), "Plot": info})

        control.addItem(handle=syshandle, url=url, listitem=item, isFolder=isFolder)
开发者ID:mpie,项目名称:repo,代码行数:8,代码来源:dutchtv.py

示例15: addDirectoryItem

def addDirectoryItem(name, url, action, image, image2, fanart, content, data, tvshow='0', totalItems=0, isFolder=True):
    if not str(image).lower().startswith('http'): image = control.addonInfo('icon')

    if not str(image2).lower().startswith('http'): image2 = control.addonInfo('icon')

    if not str(fanart).lower().startswith('http'): fanart = control.addonInfo('fanart')

    if content in ['movies', 'episodes']: playable = 'true'
    else: playable = 'false'

    sysaddon = sys.argv[0]

    if url.startswith('$base64'):
        import base64 ; url = base64.b64decode(re.compile('\$base64\[(.+?)\]$').findall(url)[0])
    u = '%s?name=%s&url=%s&tvdb=&imdb=&source=GVideo&provider=Mpie&content=%s&action=playItem' % (sysaddon, urllib.quote_plus(name), urllib.quote_plus(url), str(content))

    cm = []

    if content == 'movies':
        cm.append((control.lang(30708).encode('utf-8'), 'XBMC.Action(Info)'))
    elif content in ['tvshows', 'seasons']:
        cm.append((control.lang(30709).encode('utf-8'), 'XBMC.Action(Info)'))
    elif content == 'episodes':
        cm.append((control.lang(30710).encode('utf-8'), 'XBMC.Action(Info)'))


    if content == 'movies' and not isFolder == True:
        downloadFile = name
        try: downloadFile = '%s (%s)' % (data['title'], data['year'])
        except: pass
        cm.append((control.lang(30722).encode('utf-8'), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(downloadFile), urllib.quote_plus(url), urllib.quote_plus(image))))

    elif content == 'episodes' and not isFolder == True:
        downloadFile = name
        try: downloadFile = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode']))
        except: pass
        cm.append((control.lang(30722).encode('utf-8'), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(downloadFile), urllib.quote_plus(url), urllib.quote_plus(image))))


    if content == 'movies':
        cm.append((control.lang(30711).encode('utf-8'), 'RunPlugin(%s?action=addView&content=movies)' % sysaddon))
    elif content == 'tvshows':
        cm.append((control.lang(30712).encode('utf-8'), 'RunPlugin(%s?action=addView&content=tvshows)' % sysaddon))
    elif content == 'seasons':
        cm.append((control.lang(30713).encode('utf-8'), 'RunPlugin(%s?action=addView&content=seasons)' % sysaddon))
    elif content == 'episodes':
        cm.append((control.lang(30714).encode('utf-8'), 'RunPlugin(%s?action=addView&content=episodes)' % sysaddon))


    item = control.item(name, iconImage='DefaultFolder.png', thumbnailImage=image)
    try: item.setArt({'poster': image2, 'tvshow.poster': image2, 'season.poster': image2, 'banner': image, 'tvshow.banner': image, 'season.banner': image})
    except: pass
    item.addContextMenuItems(cm, replaceItems=False)
    item.setProperty('Fanart_Image', fanart)
    if playable == 'true': item.setProperty('IsPlayable', 'true')
    item.setInfo(type='Video', infoLabels=data)

    control.addItem(handle=int(sys.argv[1]),url=u,listitem=item,totalItems=totalItems,isFolder=isFolder)
开发者ID:mpie,项目名称:repo,代码行数:58,代码来源:phstreams.py


注:本文中的resources.lib.modules.control.addItem函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。