Python xbmcplugin.endOfDirectory() Examples

The following are 30 code examples of xbmcplugin.endOfDirectory(). 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: 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 #2
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 #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: channelselector.py    From tvalacarta with GNU General Public License v3.0 6 votes vote down vote up
def listchannels(params,url,category):
    logger.info("channelselector.listchannels")

    lista = filterchannels(category)
    for channel in lista:
        if config.is_xbmc() and (channel.type=="xbmc" or channel.type=="generic"):
            addfolder(channel.title , channel.channel , "mainlist" , channel.channel)

        elif config.get_platform()=="boxee" and channel.extra!="rtmp":
            addfolder(channel.title , channel.channel , "mainlist" , channel.channel)

    if config.get_platform()=="kodi-krypton" or config.get_platform()=="kodi-leia":
        import plugintools
        plugintools.set_view( plugintools.TV_SHOWS )

    # Label (top-right)...
    import xbmcplugin
    xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category )
    xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
    xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )

    if config.get_setting("forceview")=="true":
        # Confluence - Thumbnail
        import xbmc
        xbmc.executebuiltin("Container.SetViewMode(500)") 
Example #5
Source File: default.py    From tdw with GNU General Public License v3.0 6 votes vote down vote up
def play_url(params):
	torr_link=params['file']
	img=urllib.unquote_plus(params["img"])
	#showMessage('heading', torr_link, 10000)
	TSplayer=tsengine()
	out=TSplayer.load_torrent(torr_link,'TORRENT',port=aceport)
	if out=='Ok':
		for k,v in TSplayer.files.iteritems():
			li = xbmcgui.ListItem(urllib.unquote(k))
			uri = construct_request({
				'torr_url': torr_link,
				'title': k,
				'ind':v,
				'img':img,
				'mode': 'play_url2'
			})
			xbmcplugin.addDirectoryItem(handle, uri, li, False)
	xbmcplugin.addSortMethod(handle, xbmcplugin.SORT_METHOD_LABEL)
	xbmcplugin.endOfDirectory(handle)
	TSplayer.end() 
Example #6
Source File: directory_search.py    From plugin.video.netflix with MIT License 6 votes vote down vote up
def route_search_nav(pathitems, perpetual_range_start, dir_update_listing, params):
    path = pathitems[2] if len(pathitems) > 2 else 'list'
    common.debug('Routing "search" navigation to: {}', path)
    ret = True
    if path == 'list':
        search_list()
    elif path == 'add':
        ret = search_add()
    elif path == 'edit':
        search_edit(params['row_id'])
    elif path == 'remove':
        search_remove(params['row_id'])
    elif path == 'clear':
        ret = search_clear()
    else:
        ret = search_query(path, perpetual_range_start, dir_update_listing)
    if not ret:
        xbmcplugin.endOfDirectory(g.PLUGIN_HANDLE, succeeded=False) 
Example #7
Source File: channelselector.py    From tvalacarta with GNU General Public License v3.0 6 votes vote down vote up
def channeltypes(params,url,category):
    logger.info("channelselector.channeltypes")

    lista = getchanneltypes()
    for item in lista:
        addfolder(item.title,item.channel,item.action,category=item.category,thumbnailname=item.thumbnail)

    if config.get_platform()=="kodi-krypton" or config.get_platform()=="kodi-leia":
        import plugintools
        plugintools.set_view( plugintools.TV_SHOWS )

    # Label (top-right)...
    import xbmcplugin
    xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category="" )
    xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
    xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )

    if config.get_setting("forceview")=="true":
        # Confluence - Thumbnail
        import xbmc
        xbmc.executebuiltin("Container.SetViewMode(500)") 
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_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 #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_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 #10
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 #11
Source File: main.py    From kodi.kino.pub with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def bookmarks():
    img = plugin.routing.build_icon_path("create_bookmarks_folder")
    li = plugin.list_item("Создать папку", iconImage=img, thumbnailImage=img)
    url = plugin.routing.build_url("create_bookmarks_folder")
    xbmcplugin.addDirectoryItem(plugin.handle, url, li, False)
    response = plugin.client("bookmarks").get()
    for folder in response["items"]:
        img = plugin.routing.build_icon_path("bookmark")
        li = plugin.list_item(
            folder["title"],
            iconImage=img,
            thumbnailImage=img,
            properties={"folder-id": str(folder["id"]), "views": str(folder["views"])},
        )
        url = plugin.routing.build_url("remove_bookmarks_folder", folder["id"])
        li.addContextMenuItems([("Удалить", "Container.Update({})".format(url))])
        url = plugin.routing.build_url("bookmarks", folder["id"])
        xbmcplugin.addDirectoryItem(plugin.handle, url, li, True)
    xbmcplugin.endOfDirectory(plugin.handle) 
Example #12
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 #13
Source File: main.py    From kodi.kino.pub with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def collections():
    img = plugin.routing.build_icon_path("fresh")
    li = plugin.list_item("Последние", iconImage=img, thumbnailImage=img)
    url = plugin.routing.build_url("collections", "created")
    xbmcplugin.addDirectoryItem(plugin.handle, url, li, True)

    img = plugin.routing.build_icon_path("hot")
    li = plugin.list_item("Просматриваемые", iconImage=img, thumbnailImage=img)
    url = plugin.routing.build_url("collections", "watchers")
    xbmcplugin.addDirectoryItem(plugin.handle, url, li, True)

    img = plugin.routing.build_icon_path("popular")
    li = plugin.list_item("Популярные", iconImage=img, thumbnailImage=img)
    url = plugin.routing.build_url("collections", "views")
    xbmcplugin.addDirectoryItem(plugin.handle, url, li, True)

    xbmcplugin.endOfDirectory(plugin.handle) 
Example #14
Source File: plugin_content.py    From plugin.audio.spotify with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self):
        try:
            self.addon = xbmcaddon.Addon(id=ADDON_ID)
            self.win = xbmcgui.Window(10000)
            self.cache = SimpleCache()
            auth_token = self.get_authkey()
            if auth_token:
                self.parse_params()
                self.sp = spotipy.Spotify(auth=auth_token)
                self.userid = self.win.getProperty("spotify-username").decode("utf-8")
                self.usercountry = self.win.getProperty("spotify-country").decode("utf-8")
                self.local_playback, self.playername, self.connect_id = self.active_playback_device()
                if self.action:
                    action = "self." + self.action
                    eval(action)()
                else:
                    self.browse_main()
                    self.precache_library()
            else:
                xbmcplugin.endOfDirectory(handle=self.addon_handle)
        except Exception as exc:
            log_exception(__name__, exc)
            xbmcplugin.endOfDirectory(handle=self.addon_handle) 
Example #15
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 #16
Source File: plugin_content.py    From plugin.audio.spotify with GNU General Public License v3.0 5 votes vote down vote up
def save_album(self):
        result = self.sp.current_user_saved_albums_add([self.albumid])
        xbmcplugin.endOfDirectory(handle=self.addon_handle)
        self.refresh_listing() 
Example #17
Source File: plugin_content.py    From plugin.audio.spotify with GNU General Public License v3.0 5 votes vote down vote up
def unfollow_artist(self):
        self.sp.unfollow("artist", self.artistid)
        xbmcplugin.endOfDirectory(handle=self.addon_handle)
        self.refresh_listing() 
Example #18
Source File: plugin_content.py    From plugin.audio.spotify with GNU General Public License v3.0 5 votes vote down vote up
def follow_artist(self):
        result = self.sp.follow("artist", self.artistid)
        xbmcplugin.endOfDirectory(handle=self.addon_handle)
        self.refresh_listing() 
Example #19
Source File: plugin_content.py    From plugin.audio.spotify with GNU General Public License v3.0 5 votes vote down vote up
def unfollow_playlist(self):
        self.sp.unfollow_playlist(self.ownerid, self.playlistid)
        xbmcplugin.endOfDirectory(handle=self.addon_handle)
        self.refresh_listing() 
Example #20
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 #21
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 #22
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 #23
Source File: plugin_content.py    From plugin.audio.spotify with GNU General Public License v3.0 5 votes vote down vote up
def follow_playlist(self):
        result = self.sp.follow_playlist(self.ownerid, self.playlistid)
        xbmcplugin.endOfDirectory(handle=self.addon_handle)
        self.refresh_listing() 
Example #24
Source File: plugin_content.py    From plugin.audio.spotify with GNU General Public License v3.0 5 votes vote down vote up
def browse_playlist(self):
        xbmcplugin.setContent(self.addon_handle, "songs")
        playlistdetails = self.get_playlist_details(self.ownerid, self.playlistid)
        xbmcplugin.setProperty(self.addon_handle, 'FolderName', playlistdetails["name"])
        self.add_track_listitems(playlistdetails["tracks"]["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 #25
Source File: default.py    From kodi with GNU General Public License v3.0 5 votes vote down vote up
def getCategoryItems(url, categorie, page):
    print "*** getCategoryItems"
    path = url + "?onlyjanr=" + categorie
    page = int(page)

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

    if response["status"] == 200:
        links = common.parseDOM(content, "a", ret="href")
        titles = common.parseDOM(content, "a")

        if page == 1:
            min=0
            max = {True: page*20, False: len(links)}[len(links) > (page*20)]
        else:
            min=(page-1)*20
            max= {True: page*20, False: len(links)}[len(links) > (page*20)]

        for i in range(min, max):
          uri = sys.argv[0] + '?mode=SHOW&url=' + links[i] + "&thumbnail="

          if titles[i] == '': titles[i] = "[Unknown]" #TODO: investigate title issue
          item = xbmcgui.ListItem(titles[i])

          # TODO: move to "addFavorite" function
          script = "special://home/addons/plugin.video.filin.tv/contextmenuactions.py"
          params = "add|%s"%links[i] + "|%s"%titles[i]
          runner = "XBMC.RunScript(" + str(script)+ ", " + params + ")"


          item.addContextMenuItems([(localize(language(3001)), runner)])
          xbmcplugin.addDirectoryItem(pluginhandle, uri, item, True)

        if max >= 20 and max < len(links):
            uri = sys.argv[0] + '?mode=CNEXT&url=' + url + '&page=' + str(page+1) + '&categorie=' + categorie
            item = xbmcgui.ListItem("[COLOR=orange]" + localize(language(3000)) + "[/COLOR]")
            xbmcplugin.addDirectoryItem(pluginhandle, uri, item, True)

        xbmcplugin.setContent(pluginhandle, 'movies')
        xbmcplugin.endOfDirectory(pluginhandle, True) 
Example #26
Source File: plugin_content.py    From plugin.audio.spotify with GNU General Public License v3.0 5 votes vote down vote up
def related_artists(self):
        xbmcplugin.setContent(self.addon_handle, "artists")
        xbmcplugin.setProperty(self.addon_handle, 'FolderName', self.addon.getLocalizedString(11012))
        cachestr = "spotify.relatedartists.%s" % self.artistid
        checksum = self.cache_checksum()
        artists = self.cache.get(cachestr, checksum=checksum)
        if not artists:
            artists = self.sp.artist_related_artists(self.artistid)
            artists = self.prepare_artist_listitems(artists['artists'])
            self.cache.set(cachestr, artists, checksum=checksum)
        self.add_artist_listitems(artists)
        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 #27
Source File: plugin_content.py    From plugin.audio.spotify with GNU General Public License v3.0 5 votes vote down vote up
def artist_toptracks(self):
        xbmcplugin.setContent(self.addon_handle, "songs")
        xbmcplugin.setProperty(self.addon_handle, 'FolderName', self.addon.getLocalizedString(11011))
        tracks = self.sp.artist_top_tracks(self.artistid, country=self.usercountry)
        tracks = self.prepare_track_listitems(tracks=tracks["tracks"])
        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.endOfDirectory(handle=self.addon_handle)
        if self.defaultview_songs:
            xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_songs) 
Example #28
Source File: default.py    From kodi with GNU General Public License v3.0 5 votes vote down vote up
def listGenres():
    genres = [
                 BASE_URL + '/otechestvennue/',
                 BASE_URL + '/detectiv/',
                 BASE_URL + '/romance/',
                 BASE_URL + '/action/',
                 BASE_URL + '/fantastika/',
                 BASE_URL + '/kriminal/',
                 BASE_URL + '/comedi/',
                 BASE_URL + '/teleshou/',
                 BASE_URL + '/multfilms/',
                 BASE_URL + '/adventure/',
                 BASE_URL + '/fantasy/',
                 BASE_URL + '/horror/',
                 BASE_URL + '/drama/',
                 BASE_URL + '/history/',
                 BASE_URL + '/triller/',
                 BASE_URL + '/mystery/',
                 BASE_URL + '/sport/',
                 BASE_URL + '/musical/',
                 BASE_URL + '/dokumentalnii/',
                 BASE_URL + '/war/'
    ]


    for i in range(0, len(genres)):
        uri = sys.argv[0] + '?&url=' + genres[i] + '/'
        item = xbmcgui.ListItem(localize(language(1000+i)))
        xbmcplugin.addDirectoryItem(pluginhandle, uri, item, True)

    xbmcplugin.setContent(pluginhandle, 'files')
    xbmcplugin.endOfDirectory(pluginhandle, True) 
Example #29
Source File: default.py    From tdw with GNU General Public License v3.0 5 votes vote down vote up
def root():
	rss=get_rss()
	L=pars_rss(rss)
	for i in L:
		name  = i['title']
		url   = i['url']
		cover = i['cover']
		if url.find("400p")<0 or __settings__.getSetting("Qual")=="1":
			add_item (name, 'play', url, str(0),cover)
	xbmcplugin.endOfDirectory(handle) 
Example #30
Source File: plugin_content.py    From plugin.audio.spotify with GNU General Public License v3.0 5 votes vote down vote up
def remove_track(self):
        result = self.sp.current_user_saved_tracks_delete([self.trackid])
        xbmcplugin.endOfDirectory(handle=self.addon_handle)
        self.refresh_listing()