Python源码示例:xbmcplugin.setContent()

示例1
def browse_subfolders(media, view_id, server_id=None):

    ''' Display submenus for emby views.
    '''
    from views import DYNNODES

    get_server(server_id)
    view = EMBY['api'].get_item(view_id)
    xbmcplugin.setPluginCategory(int(sys.argv[1]), view['Name'])
    nodes = DYNNODES[media]

    for node in nodes:

        params = {
            'id': view_id,
            'mode': "browse",
            'type': media,
            'folder': view_id if node[0] == 'all' else node[0],
            'server': server_id
        }
        path = "%s?%s" % ("plugin://plugin.video.emby/",  urllib.urlencode(params))
        directory(node[1] or view['Name'], path)

    xbmcplugin.setContent(int(sys.argv[1]), 'files')
    xbmcplugin.endOfDirectory(int(sys.argv[1])) 
示例2
def browse_letters(media, view_id, server_id=None):

    ''' Display letters as options.
    '''
    letters = "#ABCDEFGHIJKLMNOPQRSTUVWXYZ"

    get_server(server_id)
    view = EMBY['api'].get_item(view_id)
    xbmcplugin.setPluginCategory(int(sys.argv[1]), view['Name'])

    for node in letters:

        params = {
            'id': view_id,
            'mode': "browse",
            'type': media,
            'folder': 'firstletter-%s' % node,
            'server': server_id
        }
        path = "%s?%s" % ("plugin://plugin.video.emby/",  urllib.urlencode(params))
        directory(node, path)

    xbmcplugin.setContent(int(sys.argv[1]), 'files')
    xbmcplugin.endOfDirectory(int(sys.argv[1])) 
示例3
def Get_links(name,url): #10
    OPEN = client.request(url, headers=headers)
    Regex = client.parseDOM(OPEN, 'iframe', ret='src')
    for link in Regex[::-1]:
        if 'verestrenos' in link:
            idp = link.split('mula=')[1]
            post = 'mole=%s' % idp
            link = client.request('http://www.verestrenos.net/rm/ajax.php', post=post)

        vid_id = re.compile('http[s]?://(.+?)\.', re.DOTALL).findall(link)[0]
        if 'sebuscar' in vid_id:
            continue
        vid_id = vid_id.replace('hqq', 'netu.tv')

        addDir('[B][COLOR white]{0} [B]| [COLOR lime]{1}[/COLOR][/B]'.format(name, vid_id), '%s|%s' % (link, url), 100, iconimage, FANART, name)
    xbmcplugin.setContent(int(sys.argv[1]), 'movies') 
示例4
def watching():
    response = plugin.client("watching/serials").get(data={"subscribed": 1})
    xbmcplugin.setContent(plugin.handle, "tvshows")
    for item in response["items"]:
        title = u"{} : [COLOR FFFFF000]+{}[/COLOR]".format(item["title"], item["new"])
        li = plugin.list_item(
            title,
            str(item["new"]),
            poster=item["posters"]["big"],
            properties={"id": str(item["id"]), "in_watchlist": "1"},
            video_info={"mediatype": content_type_map[item["type"].lower()]},
            addContextMenuItems=True,
        )
        url = plugin.routing.build_url("seasons", item["id"])
        xbmcplugin.addDirectoryItem(plugin.handle, url, li, True)
    xbmcplugin.endOfDirectory(plugin.handle, cacheToDisc=False) 
示例5
def browse_topartists(self):
        xbmcplugin.setContent(self.addon_handle, "artists")
        result = self.sp.current_user_top_artists(limit=20, offset=0)
        cachestr = "spotify.topartists.%s" % self.userid
        checksum = self.cache_checksum(result["total"])
        items = self.cache.get(cachestr, checksum=checksum)
        if not items:
            count = len(result["items"])
            while result["total"] > count:
                result["items"] += self.sp.current_user_top_artists(limit=20, offset=count)["items"]
                count += 50
            items = self.prepare_artist_listitems(result["items"])
            self.cache.set(cachestr, items, checksum=checksum)
        self.add_artist_listitems(items)
        xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
        xbmcplugin.endOfDirectory(handle=self.addon_handle)
        if self.defaultview_artists:
            xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_artists) 
示例6
def browse_toptracks(self):
        xbmcplugin.setContent(self.addon_handle, "songs")
        results = self.sp.current_user_top_tracks(limit=20, offset=0)
        cachestr = "spotify.toptracks.%s" % self.userid
        checksum = self.cache_checksum(results["total"])
        items = self.cache.get(cachestr, checksum=checksum)
        if not items:
            items = results["items"]
            while results["next"]:
                results = self.sp.next(results)
                items.extend(results["items"])
            items = self.prepare_track_listitems(tracks=items)
            self.cache.set(cachestr, items, checksum=checksum)
        self.add_track_listitems(items, True)
        xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
        xbmcplugin.endOfDirectory(handle=self.addon_handle)
        if self.defaultview_songs:
            xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_songs) 
示例7
def browse_album(self):
        xbmcplugin.setContent(self.addon_handle, "songs")
        album = self.sp.album(self.albumid, market=self.usercountry)
        xbmcplugin.setProperty(self.addon_handle, 'FolderName', album["name"])
        tracks = self.get_album_tracks(album)
        if album.get("album_type") == "compilation":
            self.add_track_listitems(tracks, True)
        else:
            self.add_track_listitems(tracks)
        xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
        xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_TRACKNUM)
        xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_TITLE)
        xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_VIDEO_YEAR)
        xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_SONG_RATING)
        xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_ARTIST)
        xbmcplugin.endOfDirectory(handle=self.addon_handle)
        if self.defaultview_songs:
            xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_songs) 
示例8
def search_artists(self):
        xbmcplugin.setContent(self.addon_handle, "artists")
        xbmcplugin.setProperty(self.addon_handle, 'FolderName', xbmc.getLocalizedString(133))
        result = self.sp.search(
            q="artist:%s" %
            self.artistid,
            type='artist',
            limit=self.limit,
            offset=self.offset,
            market=self.usercountry)
        artists = self.prepare_artist_listitems(result['artists']['items'])
        self.add_artist_listitems(artists)
        self.add_next_button(result['artists']['total'])
        xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
        xbmcplugin.endOfDirectory(handle=self.addon_handle)
        if self.defaultview_artists:
            xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_artists) 
示例9
def search_tracks(self):
        xbmcplugin.setContent(self.addon_handle, "songs")
        xbmcplugin.setProperty(self.addon_handle, 'FolderName', xbmc.getLocalizedString(134))
        result = self.sp.search(
            q="track:%s" %
            self.trackid,
            type='track',
            limit=self.limit,
            offset=self.offset,
            market=self.usercountry)
        tracks = self.prepare_track_listitems(tracks=result["tracks"]["items"])
        self.add_track_listitems(tracks, True)
        self.add_next_button(result['tracks']['total'])
        xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
        xbmcplugin.endOfDirectory(handle=self.addon_handle)
        if self.defaultview_songs:
            xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_songs) 
示例10
def search_albums(self):
        xbmcplugin.setContent(self.addon_handle, "albums")
        xbmcplugin.setProperty(self.addon_handle, 'FolderName', xbmc.getLocalizedString(132))
        result = self.sp.search(
            q="album:%s" %
            self.albumid,
            type='album',
            limit=self.limit,
            offset=self.offset,
            market=self.usercountry)
        albumids = []
        for album in result['albums']['items']:
            albumids.append(album["id"])
        albums = self.prepare_album_listitems(albumids)
        self.add_album_listitems(albums, True)
        self.add_next_button(result['albums']['total'])
        xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
        xbmcplugin.endOfDirectory(handle=self.addon_handle)
        if self.defaultview_albums:
            xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_albums) 
示例11
def search_playlists(self):
        xbmcplugin.setContent(self.addon_handle, "files")
        result = self.sp.search(
            q=self.playlistid,
            type='playlist',
            limit=self.limit,
            offset=self.offset,
            market=self.usercountry)
        log_msg(result)
        xbmcplugin.setProperty(self.addon_handle, 'FolderName', xbmc.getLocalizedString(136))
        playlists = self.prepare_playlist_listitems(result['playlists']['items'])
        self.add_playlist_listitems(playlists)
        self.add_next_button(result['playlists']['total'])
        xbmcplugin.endOfDirectory(handle=self.addon_handle)
        if self.defaultview_playlists:
            xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_playlists) 
示例12
def show(self, link, image, name):
        response = common.fetchPage({"link": link})
        cid = link.split(self.url + "/")[-1].split("-")[0]
        playlist = self.getPlaylist(response['content'])
        if playlist:
            description = self.strip(response['content'].split("<!--dle_image_end-->")[1].split("<div")[0])
            currname = '' 
            duration = ''
            #description = common.parseDOM(response['content'], "meta", attrs={"name": "description"}, ret = "content")[0]
            if (self.use_epg == "true"):
                currname, duration, listItems = self.getEPG(cid = cid, cname=name, image=image)
            uri = sys.argv[0] + '?mode=play&url=%s&url2=%s' % (urllib.quote_plus(playlist), link)
            item = xbmcgui.ListItem("[COLOR=FF7B68EE]%s[/COLOR]" % self.language(1004),  iconImage=image, thumbnailImage=image)
            item.setInfo(type='Video', infoLabels={'title': currname if currname != '' else name, 'plot': description, 'duration': duration})
            item.setProperty('IsPlayable', 'true')
            xbmcplugin.addDirectoryItem(self.handle, uri, item, False)
    
            if (self.use_epg == "true"):
                xbmcplugin.addDirectoryItems(self.handle, listItems)
    
            xbmcplugin.setContent(self.handle, 'files')
            xbmcplugin.endOfDirectory(self.handle, True) 
示例13
def process(kp_id, media_title, image):
    if (not kp_id):
        kp_id, media_title, media_title, image = prepare("process", kp_id, media_title, media_title, image)
    if (not kp_id):
        return
    list_li = []
    list_li = search.process(kp_id)
    
    for li in list_li:
        engine = get_engine(li[1].getLabel())
        
        li[0] = li[0] + ("&media_title=%s&image=%s&engine=%s" % ((urllib.quote_plus(encode_("utf-8", media_title))) if (media_title != "") else "", image, engine))
        li[1].setIconImage(image)
        li[1].setThumbnailImage(image)
        if ("*T*" in li[1].getLabel()):
            title = li[1].getLabel().replace("*T*", media_title)
            li[1].setLabel(title)
            li[0] = li[0] + ("&title=%s" % (urllib.quote_plus(title)))
                
        li[1].setInfo(type='Video', infoLabels={'title': li[1].getLabel(), 'label': media_title, 'plot': media_title})
        xbmcplugin.addDirectoryItem(HANDLE, li[0], li[1], li[2])
    xbmcplugin.setContent(HANDLE, 'movies')
    xbmcplugin.endOfDirectory(HANDLE, True) 
示例14
def getSubItems2(self, url):
        response = common.fetchPage({"link": url})
        if response["status"] == 200:
            content = common.parseDOM(response["content"], "table", attrs={"class": "items"})
            items = common.parseDOM(content, "tr")
            photo_tds = common.parseDOM(items, "td", attrs={"class": "photo"})            
            photos = common.parseDOM(photo_tds, "img", ret="src")
            tds = common.parseDOM(items, "td", attrs={"class": "artist_name"}) 
            labels = common.parseDOM(tds, "a")
            links = common.parseDOM(tds, "a", ret="href")

            for i, item in enumerate(labels):
                uri = sys.argv[0] + '?mode=items2&url=%s' % ("https:" + links[i])
                try:
                    photo = ("https:" + photos[i]).replace("33x33", "250")
                except:
                    photo = self.icon
                sub = tds[i]
                numbers = common.parseDOM(items[i], "td", attrs={"class": "number"})
                item_ = xbmcgui.ListItem(self.strip("[COLOR=lightgreen]%s[/COLOR]%s [COLOR=lightblue][%s][/COLOR]" % (labels[i], " - [I]" + sub.split("<br>")[-1] + "[/I]" if "<br>" in sub else "", numbers[0])), iconImage=photo, thumbnailImage=photo)
                xbmcplugin.addDirectoryItem(self.handle, uri, item_, True)

        xbmcplugin.setContent(self.handle, 'files')
        xbmcplugin.endOfDirectory(self.handle, True) 
示例15
def getItems2(self, url):
        response =  common.fetchPage({"link": url})
        if response["status"] == 200:
            photo_div = common.parseDOM(response["content"], "div", attrs={"class": "artist-profile__photo debug1"})[0]
            photo = "https:" + common.parseDOM(photo_div, "img", ret="src")[0]
            content = common.parseDOM(response["content"], "table", attrs={"id": "tablesort"})
            items = common.parseDOM(content, "tr")
            labels = common.parseDOM(items, "a")
            links = common.parseDOM(items, "a", ret="href")
 
            for i, item in enumerate(items):
                uri = sys.argv[0] + '?mode=show&url=%s' % ("https:" + links[i])
                item_ = xbmcgui.ListItem(self.strip("%s" % labels[i]), iconImage=photo, thumbnailImage=photo)
                xbmcplugin.addDirectoryItem(self.handle, uri, item_, True)
                    
        xbmcplugin.setContent(self.handle, 'files')
        xbmcplugin.endOfDirectory(self.handle, True) 
示例16
def show(self, url, tone = 0):
        uri = sys.argv[0] + "?mode=text&tone=%s&url=%s"  % (str(tone), url)
        item = xbmcgui.ListItem("%s" % "[COLOR=lightgreen]" + self.language(3000) + "[/COLOR]", thumbnailImage=self.icon)
        xbmcplugin.addDirectoryItem(self.handle, uri, item, True)
        uri = sys.argv[0] + "?mode=video&url=%s"  % (url)
        item = xbmcgui.ListItem("%s" % self.language(3001), thumbnailImage=self.icon)
        item.setInfo(type='Video', infoLabels={})
        item.setProperty('IsPlayable', 'true')
        xbmcplugin.addDirectoryItem(self.handle, uri, item, False)
        uri = sys.argv[0] + "?mode=akkords&url=%s&tone=%s"  % (url, str(tone))
        item = xbmcgui.ListItem("%s" % self.language(3002), thumbnailImage=self.icon)
        xbmcplugin.addDirectoryItem(self.handle, uri, item, True)
        uri = sys.argv[0] + "?mode=tone&url=%s&tone=%s"  % (url, str(tone))
        item = xbmcgui.ListItem("%s - [COLOR=lightblue]%s[/COLOR]" % (self.language(3003), tone), thumbnailImage=self.icon)
        xbmcplugin.addDirectoryItem(self.handle, uri, item, True)

        xbmcplugin.setContent(self.handle, 'files')
        xbmcplugin.endOfDirectory(self.handle, True) 
示例17
def akkords(self, url, tone=0):
        data = self.getToneData(url, tone)
        jdata = json.loads(data)
        chords = jdata["song_chords"]
        text = jdata["song_text"]
        for chord in chords:
            try:
                chord_ = chords[chord]
            except:
                chord_ = chord    
            image = self.url + "/images/chords/" + chord_.replace('+', 'p').replace('-', 'z').replace('#', 'w').replace('/', 's') + "_0.gif"
            uri = sys.argv[0] + "?mode=empty"
            item = xbmcgui.ListItem(chord_, thumbnailImage=image)
            xbmcplugin.addDirectoryItem(self.handle, uri, item, False)

        xbmcplugin.setContent(self.handle, 'movies')
        xbmcplugin.endOfDirectory(self.handle, True)
        xbmc.executebuiltin("Container.SetViewMode(0)")
	for i in range(1, 2):
            xbmc.executebuiltin("Container.NextViewMode") 
示例18
def index(self, url, page, kind = 0):
        if (kind == 0) and (page == 1):
            uri = sys.argv[0] + '?mode=%s&url=%s' % ("search", url)
            item = xbmcgui.ListItem("[COLOR=FF00FF00][%s][/COLOR]" % self.language(1000), iconImage=self.icon, thumbnailImage=self.icon)
            xbmcplugin.addDirectoryItem(self.handle, uri, item, True)

            uri = sys.argv[0] + '?mode=%s&url=%s' % ("parts", url)
            item = xbmcgui.ListItem("[COLOR=orange]%s[/COLOR]" % self.language(1006), iconImage=self.icon, thumbnailImage=self.icon)
            xbmcplugin.addDirectoryItem(self.handle, uri, item, True)

        page_url = "%s%s" % (url, "" if (page == 0) else '?page' + str(page))

        response = common.fetchPage({"link": page_url})
        content = response["content"]

        count = self.index_(content)

        if (page > 0):
            if (self.checkNextPage(content, page) == True):
                uri = sys.argv[0] + '?mode=%s&url=%s&page=%s' % ("index", url, str(int(page) + 1))
                item = xbmcgui.ListItem("[COLOR=FF00FFF0]%s[/COLOR]" % self.language(1005), iconImage=self.inext)
                xbmcplugin.addDirectoryItem(self.handle, uri, item, True)

            xbmcplugin.setContent(self.handle, "movies")
            xbmcplugin.endOfDirectory(self.handle, True) 
示例19
def mainMenu(self):
        #self.addon.setSetting('cookie', '')
        self.login()
        self.cookie=self.addon.getSetting('cookie') if self.addon.getSetting('cookie') else None 
        if self.cookie and (self.cookie > ''):
            self.authcookie = "svid1=" + self.cookie
            self.vip = True

        uri = sys.argv[0] + '?mode=%s&url=%s' % ("search", self.url)
        item = xbmcgui.ListItem("[COLOR=FF00FF00]%s[/COLOR]" % self.language(2000), thumbnailImage=self.icon)
        xbmcplugin.addDirectoryItem(self.handle, uri, item, True)
        uri = sys.argv[0] + '?mode=%s' % ("filter")
        item = xbmcgui.ListItem("[COLOR=FF7B68EE]%s[/COLOR]" % self.language(3000), thumbnailImage=self.icon)
        xbmcplugin.addDirectoryItem(self.handle, uri, item, True)

        self.getItems()

        xbmcplugin.setContent(self.handle, 'tvshows')
        xbmcplugin.endOfDirectory(self.handle, True) 
示例20
def manage_libraries():

    directory(_(33098), "plugin://plugin.video.emby/?mode=refreshboxsets", False)
    directory(_(33154), "plugin://plugin.video.emby/?mode=addlibs", False)
    directory(_(33139), "plugin://plugin.video.emby/?mode=updatelibs", False)
    directory(_(33140), "plugin://plugin.video.emby/?mode=repairlibs", False)
    directory(_(33184), "plugin://plugin.video.emby/?mode=removelibs", False)
    directory(_(33060), "plugin://plugin.video.emby/?mode=thememedia", False)

    if kodi_version() >= 18:
        directory(_(33202), "plugin://plugin.video.emby/?mode=patchmusic", False)

    xbmcplugin.setContent(int(sys.argv[1]), 'files')
    xbmcplugin.endOfDirectory(int(sys.argv[1])) 
示例21
def set_view(type = 'root'):
	confluence_views = [500,501,50,503,504,508,51]
	if type == 'root':
		xbmcplugin.setContent(pluginHandle, 'movies')
	elif type == 'seasons':
		xbmcplugin.setContent(pluginHandle, 'movies')
	else:
		if type == 'tvshows':
			xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_LABEL)
		xbmcplugin.setContent(pluginHandle, type)
	if addon.getSetting('viewenable') == 'true':
		view = int(addon.getSetting(type + 'view'))
		xbmc.executebuiltin('Container.SetViewMode(' + str(confluence_views[view]) + ')') 
示例22
def setView(content, viewType):
    if content:
        xbmcplugin.setContent(int(sys.argv[1]), content) 
示例23
def Main_menu():
    addDir('[B][COLOR white]Últimos capítulos agregados[/COLOR][/B]', BASEURL, 5, ICON, FANART, '')
    addDir('[B][COLOR white]Telenovelas en Emisión[/COLOR][/B]', BASEURL+'page/telenovelas-en-emision/', 5, ICON, FANART, '')
    addDir('[B][COLOR white]Lista de Telenovelas[/COLOR][/B]', BASEURL, 3, ICON, FANART, '')
    addDir('[B][COLOR white]Navegar por letras[/COLOR][/B]', BASEURL, 9, ICON, FANART, '')
    addDir('[B][COLOR gold]Versión: [COLOR lime]%s[/COLOR][/B]' % vers, '', 'BUG', ICON, FANART, '')
    xbmcplugin.setContent(int(sys.argv[1]), 'movies') 
示例24
def Get_lista(url): #3
    r = client.request(url, headers=headers)
    r = client.parseDOM(r, 'ul', attrs={'id': 'telenovelas'})[0]
    r = client.parseDOM(r, 'li')
    for item in r:
        name = client.parseDOM(item, 'a')[0]
        name = client.replaceHTMLCodes(name)
        name = name.encode('utf-8')

        url = client.parseDOM(item, 'a', ret='href')[0]
        url = client.replaceHTMLCodes(url)
        url = url.encode('utf-8')
        addDir('[B][COLOR white]%s[/COLOR][/B]' % name, url, 8, ICON, FANART, '')
    xbmcplugin.setContent(int(sys.argv[1]), 'movies') 
示例25
def Get_content(url): #5
    r = client.request(url, headers=headers)
    data = client.parseDOM(r, 'div', attrs={'class': 'imagen'})
    data = zip(client.parseDOM(data, 'a', ret='href'),
               client.parseDOM(data, 'a', ret='title'),
               client.parseDOM(data, 'img', ret='src'))
    for item in data:
        link, name, icon = item[0], item[1], item[2]
        link = client.replaceHTMLCodes(link)
        link = link.encode('utf-8')

        name = client.replaceHTMLCodes(name)
        name = name.encode('utf-8')
        if 'capitulo' in link:
            addDir('[B][COLOR white]%s[/COLOR][/B]' % name, link, 10, icon, FANART, '')
        else:
            addDir('[B][COLOR white]%s[/COLOR][/B]' % name, link, 8, icon, FANART, '')
    try:
        np = client.parseDOM(r, 'li')
        np = [i for i in np if 'iguiente' in i][0]
        np = client.parseDOM(np, 'a', ret='href')[0]

        page = re.search('(\d+)', np, re.DOTALL)
        page = '[COLORlime]%s[/COLOR]' % page.groups()[0]

        url = urlparse.urljoin(url, np)
        url = client.replaceHTMLCodes(url)

        addDir('[B][COLORgold]Siguiente(%s)>>>[/COLOR][/B]' % page, url, 5, ICON, FANART, '')
    except: pass
    xbmcplugin.setContent(int(sys.argv[1]), 'movies') 
示例26
def Episodes(url): #8
    r = client.request(url, headers=headers)
    data = client.parseDOM(r, 'ul', attrs={'id': 'listado'})[0]
    data = client.parseDOM(data, 'li')
    data = zip(client.parseDOM(data, 'a', ret='href'),
               client.parseDOM(data, 'a'))
    get_icon = client.parseDOM(r, 'img', ret='src', attrs={'class': 'transparent'})[0]

    for item in data[::-1]:
        url, title = client.replaceHTMLCodes(item[0]), client.replaceHTMLCodes(item[1])
        url = url.encode('utf-8')
        title = title.encode('utf-8')

        addDir(title, url, 10, get_icon, FANART, '')
    xbmcplugin.setContent(int(sys.argv[1]), 'movies') 
示例27
def finalize_directory(items, content_type=g.CONTENT_FOLDER, sort_type='sort_nothing', title=None):
    """Finalize a directory listing. Add items, set available sort methods and content type"""
    if title:
        xbmcplugin.setPluginCategory(g.PLUGIN_HANDLE, title)
    xbmcplugin.setContent(g.PLUGIN_HANDLE, content_type)
    add_sort_methods(sort_type)
    xbmcplugin.addDirectoryItems(g.PLUGIN_HANDLE, items) 
示例28
def kodi_draw_list(parts, rows):
    for row in rows:
        xbmcplugin.addDirectoryItem(*row.item(parts))

    xbmcplugin.addSortMethod(h, xbmcplugin.SORT_METHOD_UNSORTED)
    xbmcplugin.addSortMethod(h, xbmcplugin.SORT_METHOD_LABEL)
    xbmcplugin.addSortMethod(h, xbmcplugin.SORT_METHOD_VIDEO_RATING)
    xbmcplugin.addSortMethod(h, xbmcplugin.SORT_METHOD_VIDEO_YEAR)
    xbmcplugin.addSortMethod(h, xbmcplugin.SORT_METHOD_DATE)
    xbmcplugin.setContent(h, 'files')
    xbmcplugin.endOfDirectory(h) 
示例29
def get_next_page(self, mode, url, pattern, site='', parse=None, pictures=False):
 
        try:
            dirlst = []
            icon = xbmc.translatePath(os.path.join('special://home/addons/script.xxxodus.artwork', 'resources/art/main/next.png'))
            fanart = xbmc.translatePath(os.path.join('special://home/addons/script.xxxodus.artwork', 'resources/art/%s/fanart.jpg' % site))
            if '|GOT_URL' in url: 
                url = url.split('|GOT_URL')[0]
                dirlst.append({'name': kodi.giveColor('Next Page -->','white'), 'url': url, 'mode': mode, 'icon': icon, 'fanart': fanart, 'description': 'Load More......', 'folder': True})
            else: 
                r = client.request(url)
                url = re.findall(r'%s' % pattern,r)[0]
                if parse: url = urlparse.urljoin(parse,url)
                if '&amp;' in url: url = url.replace('&amp;','&')
                dirlst.append({'name': kodi.giveColor('Next Page -->','white'), 'url': url, 'mode': mode, 'icon': icon, 'fanart': fanart, 'description': 'Load More......', 'folder': True})
            if 'chaturbate' in url:
                if dirlst: buildDirectory(dirlst, isVideo=True, chaturbate=True)
            elif pictures:
                if dirlst: buildDirectory(dirlst, pictures=True)
            else:
                if dirlst: buildDirectory(dirlst, isVideo=True)
        except Exception as e:
            log_utils.log('Error getting next page for %s :: Error: %s' % (site.title(),str(e)), log_utils.LOGERROR)
            xbmcplugin.setContent(kodi.syshandle, 'movies')
            if 'chaturbate' in url: utils.setView('chaturbate')
            elif pictures: utils.setView('pictures')
            else: utils.setView('thumbs')
            xbmcplugin.endOfDirectory(kodi.syshandle, cacheToDisc=True) 
示例30
def create_listing(listing, succeeded=True, update_listing=False, cache_to_disk=False, sort_methods=None,
                       view_mode=None, content=None, category=None):
        """
        Create and return a context dict for a virtual folder listing

        :param listing: the list of the plugin virtual folder items
        :type listing: list or types.GeneratorType
        :param succeeded: if ``False`` Kodi won't open a new listing and stays on the current level.
        :type succeeded: bool
        :param update_listing: if ``True``, Kodi won't open a sub-listing but refresh the current one.
        :type update_listing: bool
        :param cache_to_disk: cache this view to disk.
        :type cache_to_disk: bool
        :param sort_methods: the list of integer constants representing virtual folder sort methods.
        :type sort_methods: tuple
        :param view_mode: a numeric code for a skin view mode.
            View mode codes are different in different skins except for ``50`` (basic listing).
        :type view_mode: int
        :param content: string - current plugin content, e.g. 'movies' or 'episodes'.
            See :func:`xbmcplugin.setContent` for more info.
        :type content: str
        :param category: str - plugin sub-category, e.g. 'Comedy'.
            See :func:`xbmcplugin.setPluginCategory` for more info.
        :type category: str
        :return: context object containing necessary parameters
            to create virtual folder listing in Kodi UI.
        :rtype: ListContext
        """
        return ListContext(listing, succeeded, update_listing, cache_to_disk,
                           sort_methods, view_mode, content, category)