Python xbmcplugin.setContent() Examples

The following are 30 code examples of xbmcplugin.setContent(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module xbmcplugin , or try the search function .
Example #1
Source File: default.py    From kodi with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #2
Source File: default.py    From bugatsinho.github.io with GNU General Public License v3.0 6 votes vote down vote up
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') 
Example #3
Source File: default.py    From plugin.video.emby with GNU General Public License v3.0 6 votes vote down vote up
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])) 
Example #4
Source File: main.py    From kodi.kino.pub with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
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) 
Example #5
Source File: plugin_content.py    From plugin.audio.spotify with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #6
Source File: plugin_content.py    From plugin.audio.spotify with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #7
Source File: plugin_content.py    From plugin.audio.spotify with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #8
Source File: plugin_content.py    From plugin.audio.spotify with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #9
Source File: plugin_content.py    From plugin.audio.spotify with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #10
Source File: default.py    From kodi with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #11
Source File: plugin.py    From kodi with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #12
Source File: default.py    From kodi with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #13
Source File: default.py    From kodi with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #14
Source File: default.py    From kodi with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #15
Source File: default.py    From kodi with GNU General Public License v3.0 6 votes vote down vote up
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") 
Example #16
Source File: plugin_content.py    From plugin.audio.spotify with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #17
Source File: default.py    From kodi with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #18
Source File: plugin_content.py    From plugin.audio.spotify with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #19
Source File: default.py    From kodi with GNU General Public License v3.0 5 votes vote down vote up
def listFavorites():
    string = Addon.getSetting('favorites')

    if len(string) == 0:
        item = xbmcgui.ListItem(language(3002))
        xbmcplugin.addDirectoryItem(pluginhandle, '', item, False)
    else:
        favorites = json.loads(string.replace('\x00', ''))
        for key in favorites:
            item = xbmcgui.ListItem(favorites[key])

            # TODO: show thumbnail (item = xbmcgui.ListItem(key, thumbnailImage=thumbnail))
            uri = sys.argv[0] + '?mode=SHOW&url=' + key + '&thumbnail='
            item.setInfo( type='Video', infoLabels={'title': favorites[key]})

            # TODO: move to "addFavorite" function
            script = "special://home/addons/plugin.video.filin.tv/contextmenuactions.py"
            params = "remove|%s" % key + "|%s" % favorites[key]
            runner = "XBMC.RunScript(" + str(script)+ ", " + params + ")"
            item.addContextMenuItems([(localize(language(3004)), runner)])
            xbmcplugin.addDirectoryItem(pluginhandle, uri, item, True)

        item = xbmcgui.ListItem("[COLOR=FFFF4000]%s[/COLOR]" % language(3006))
        uri = sys.argv[0] + '?mode=RESET'
        item.setProperty('IsPlayable', 'true')
        xbmcplugin.addDirectoryItem(pluginhandle, uri, item, True)

    xbmcplugin.setContent(pluginhandle, 'movies')
    xbmcplugin.endOfDirectory(pluginhandle, True) 
Example #20
Source File: default.py    From kodi with GNU General Public License v3.0 5 votes vote down vote up
def genres(self):
        response = common.fetchPage({"link": self.url})
        menus = common.parseDOM(response["content"], "div", attrs={"class": "menuuuuuu"})

        for menu in menus:
            titles = common.parseDOM(menu, "a")
            links = common.parseDOM(menu, "a", ret="href")

            for i, link in enumerate(links):
                uri = sys.argv[0] + '?mode=index&url=%s' % urllib.quote_plus(self.url+link)
                item = xbmcgui.ListItem(titles[i], iconImage=self.icon, thumbnailImage=self.icon)
                xbmcplugin.addDirectoryItem(self.handle, uri, item, True)

        xbmcplugin.setContent(self.handle, 'files')
        xbmcplugin.endOfDirectory(self.handle, True) 
Example #21
Source File: simpleplugin.py    From plugin.video.auvio with GNU General Public License v3.0 5 votes vote down vote up
def _add_directory_items(self, context):
        """
        Create a virtual folder listing

        :param context: context object
        :type context: ListContext
        :raises SimplePluginError: if sort_methods parameter is not int, tuple or list
        """
        self.log_debug('Creating listing from {0}'.format(str(context)))
        if context.category is not None:
            xbmcplugin.setPluginCategory(self._handle, context.category)
        if context.content is not None:
            xbmcplugin.setContent(self._handle, context.content)  # This must be at the beginning
        for item in context.listing:
            is_folder = item.get('is_folder', True)
            if item.get('list_item') is not None:
                list_item = item['list_item']
            else:
                list_item = self.create_list_item(item)
                if item.get('is_playable'):
                    list_item.setProperty('IsPlayable', 'true')
                    is_folder = False
            xbmcplugin.addDirectoryItem(self._handle, item['url'], list_item, is_folder)
        if context.sort_methods is not None:
            if isinstance(context.sort_methods, int):
                xbmcplugin.addSortMethod(self._handle, context.sort_methods)
            elif isinstance(context.sort_methods, (tuple, list)):
                for method in context.sort_methods:
                    xbmcplugin.addSortMethod(self._handle, method)
            else:
                raise TypeError(
                    'sort_methods parameter must be of int, tuple or list type!')
        xbmcplugin.endOfDirectory(self._handle,
                                  context.succeeded,
                                  context.update_listing,
                                  context.cache_to_disk)
        if context.view_mode is not None:
            xbmc.executebuiltin('Container.SetViewMode({0})'.format(context.view_mode)) 
Example #22
Source File: default.py    From bugatsinho.github.io with GNU General Public License v3.0 5 votes vote down vote up
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') 
Example #23
Source File: default.py    From kodi with GNU General Public License v3.0 5 votes vote down vote up
def menu():
    addons, limits = get_addons() 
    for i, addon in enumerate(addons):
        addon_object = xbmcaddon.Addon(addon['addonid'])
        setting, domain, protocol, protocol_value = find_domain_setting(addon_object)
        if setting:
            uri = sys.argv[0] + '?mode=%s&addon=%s' % ("edit", addon['addonid'])
            title = "{0} [COLOR=orange][{1}][/COLOR]".format(addon.get("name").encode("utf8"), addon.get("addonid"))
            item = xbmcgui.ListItem(title, iconImage=ICON, thumbnailImage=ICON)
            item.setInfo(type='Video', infoLabels={'title': title, 'genre': domain, 'plot': domain})
            xbmcplugin.addDirectoryItem(HANDLE, uri, item, False)
    xbmcplugin.setContent(HANDLE, 'addon')
    xbmcplugin.endOfDirectory(HANDLE, True) 
Example #24
Source File: plugin.py    From kodi with GNU General Public License v3.0 5 votes vote down vote up
def main_(mode, kp_id, orig_title, media_title, image):
    kp_id, orig_title, media_title, image = prepare(mode, kp_id, orig_title, media_title, image)
    if (not kp_id):
        return
    #if mode == "search":
    #    process(kp_id, media_title, image)
    #else:    
    film_title = " %s" % (orig_title)
    uri = sys.argv[0] + '?mode=process&kp_id=%s&media_title=%s&image=%s' % (kp_id, urllib.quote_plus(media_title), urllib.quote_plus(image))
    item = xbmcgui.ListItem(film_title, iconImage=image, thumbnailImage=image)
    item.setInfo(type='Video', infoLabels={'title': film_title, 'label': film_title, 'plot': film_title})
    xbmcplugin.addDirectoryItem(HANDLE, uri, item, True)
    xbmcplugin.setContent(HANDLE, 'movies')
    xbmcplugin.endOfDirectory(HANDLE, True) 
Example #25
Source File: default.py    From bugatsinho.github.io with GNU General Public License v3.0 5 votes vote down vote up
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') 
Example #26
Source File: default.py    From kodi with GNU General Public License v3.0 5 votes vote down vote up
def menu(self):
        uri = sys.argv[0] + "?mode=search" 
        item = xbmcgui.ListItem("[COLOR=lightgreen]%s[/COLOR]" % self.language(1000), thumbnailImage=self.icon)
        xbmcplugin.addDirectoryItem(self.handle, uri, item, True)
    
        self.getMainItems()
    
        uri = sys.argv[0] + "?mode=alphabet" 
        item = xbmcgui.ListItem("[COLOR=orange]%s[/COLOR]" % self.language(1001), thumbnailImage=self.icon)
        xbmcplugin.addDirectoryItem(self.handle, uri, item, True)

        xbmcplugin.setContent(self.handle, 'files')
        xbmcplugin.endOfDirectory(self.handle, True) 
Example #27
Source File: default.py    From kodi with GNU General Public License v3.0 5 votes vote down vote up
def alphabet(self):
        response = common.fetchPage({"link": self.url})
        if response["status"] == 200:
            content = common.parseDOM(response["content"], "div", attrs={"class": "alphabet g-margin"})[0]
            items = common.parseDOM(content, "li")
            labels = common.parseDOM(items, "a")
            links = common.parseDOM(items, "a", ret="href")

            for i, item in enumerate(labels):
                uri = sys.argv[0] + "?mode=subitems2&url=%s" % (self.url + links[i])
                item_ = xbmcgui.ListItem(self.strip(item), iconImage=self.icon, thumbnailImage=self.icon)
                xbmcplugin.addDirectoryItem(self.handle, uri, item_, True)

        xbmcplugin.setContent(self.handle, 'files')
        xbmcplugin.endOfDirectory(self.handle, True) 
Example #28
Source File: default.py    From kodi with GNU General Public License v3.0 5 votes vote down vote up
def getSubItems1(self, url):
        response = common.fetchPage({"link": url})
        if response["status"] == 200:
            content = common.parseDOM(response["content"], "ul", attrs={"class": "h1__tabs"})[0]
            items = common.parseDOM(content, "li")
            for i, item in enumerate(items):
                label = common.parseDOM(item, "a")[0] if common.parseDOM(item, "a") else common.parseDOM(item, "span")[0]
                link = self.url + common.parseDOM(item, "a", ret="href")[0] if common.parseDOM(item, "a") else self.url + "/akkordi/popular/"
                uri = sys.argv[0] + "?mode=items&url=%s" % (link)
                item_ = xbmcgui.ListItem(self.strip(label), iconImage=self.icon, thumbnailImage=self.icon)
                xbmcplugin.addDirectoryItem(self.handle, uri, item_, True)
        xbmcplugin.setContent(self.handle, 'files')
        xbmcplugin.endOfDirectory(self.handle, True) 
Example #29
Source File: default.py    From kodi with GNU General Public License v3.0 5 votes vote down vote up
def getEPG(self, cid = None, cname = None, image = ''):
        currname = ''
        duration = 0 
        listItems = [] 
        try:
            if cname: 
                if cid:
                    epgbody = self.epg[cid]['epg']
                    currname, duration, listItems = self.addEPGItems(epgbody, image)
            elif cid: 
                epgbody = self.epg[cid]['epg']
                currname, duration, listItems = self.addEPGItems(epgbody, image)
                xbmcplugin.addDirectoryItems(self.handle, listItems)
            else:
                for channelid in self.epg:
                    channelbody = self.epg[channelid]
                    uri = sys.argv[0] + '?mode=epg&cid=%s&image=%s' % (channelid, channelbody['image_url'])
                    item = xbmcgui.ListItem("%s" % channelbody['title'],  iconImage=channelbody['image_url'], thumbnailImage=channelbody['image_url'])
                    item.setInfo(type='Video', infoLabels={'title': channelbody['title']})
    
                    commands = []
                    uricmd = sys.argv[0] + '?mode=show&url=%s&name=%s&image=%s' % (self.url + "/" + channelid + "-" + channelbody['alt_name'] + ".html", channelbody['title'], channelbody['image_url'])
                    commands.append(('[COLOR=FF00FF00]' + self.language(1006) + '[/COLOR]', "Container.Update(%s)" % (uricmd), ))
                    item.addContextMenuItems(commands)

                    xbmcplugin.addDirectoryItem(self.handle, uri, item, True)

                xbmcplugin.addSortMethod(self.handle, xbmcplugin.SORT_METHOD_TITLE)
        except:
            pass
        if cname == None:
            xbmcplugin.setContent(self.handle, 'files')
            xbmcplugin.endOfDirectory(self.handle, True)
        return currname, duration, listItems 
Example #30
Source File: default.py    From bugatsinho.github.io with GNU General Public License v3.0 5 votes vote down vote up
def setView(content, viewType):
    if content:
        xbmcplugin.setContent(int(sys.argv[1]), content)