Python xbmcgui.ListItem() Examples

The following are 30 code examples of xbmcgui.ListItem(). 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 xbmcgui , or try the search function .
Example #1
Source File: main.py    From bugatsinho.github.io with GNU General Public License v3.0 6 votes vote down vote up
def addLinkItem(name, url, mode, params=1, iconimage='DefaultFolder.png', infoLabels=False, IsPlayable=True,
                fanart=FANART, itemcount=1, contextmenu=None):
    u = build_url({'mode': mode, 'foldername': name, 'ex_link': url, 'params': params})

    liz = xbmcgui.ListItem(name)

    art_keys = ['thumb', 'poster', 'banner', 'fanart', 'clearart', 'clearlogo', 'landscape', 'icon']
    art = dict(zip(art_keys, [iconimage for x in art_keys]))
    art['landscape'] = fanart if fanart else art['landscape']
    art['fanart'] = fanart if fanart else art['landscape']
    liz.setArt(art)

    if not infoLabels:
        infoLabels = {"title": name}
    liz.setInfo(type="video", infoLabels=infoLabels)
    if IsPlayable:
        liz.setProperty('IsPlayable', 'true')

    if contextmenu:
        contextMenuItems = contextmenu
        liz.addContextMenuItems(contextMenuItems, replaceItems=True)

    ok = xbmcplugin.addDirectoryItem(handle=addon_handle, url=u, listitem=liz, isFolder=False, totalItems=itemcount)
    xbmcplugin.addSortMethod(addon_handle, sortMethod=xbmcplugin.SORT_METHOD_NONE, label2Mask="%R, %Y, %P")
    return ok 
Example #2
Source File: default.py    From tdw with GNU General Public License v3.0 6 votes vote down vote up
def add_item (name, mode="", path = Pdir, ind="0", cover=None, funart=None):
	#print name
	#print path
	if   path.find("720p")>0: qual="[COLOR FFA900EF][ 720p ] [/COLOR]"
	elif path.find("480p")>0: qual="[COLOR FFFF0090][ 480p ] [/COLOR]"
	elif path.find("400p")>0: qual="[COLOR FF70F020][ 400p ] [/COLOR]"
	elif path.find("1080p")>0:qual="[COLOR FF50FF50][1080p] [/COLOR]"
	else: qual="[ ???? ] "
	if cover==None:	listitem = xbmcgui.ListItem(qual+"[B]"+name+"[/B]")
	else:			listitem = xbmcgui.ListItem(qual+"[B]"+name+"[/B]", iconImage=cover)
	listitem.setProperty('fanart_image', funart)
	uri = sys.argv[0] + '?mode='+mode
	uri += '&url='  + urllib.quote_plus(path.encode('utf-8'))
	uri += '&name='  + urllib.quote_plus(xt(name))
	uri += '&ind='  + urllib.quote_plus(ind)
	if cover!=None:uri += '&cover='  + urllib.quote_plus(cover)
	if funart!=None and funart!="":uri += '&funart='  + urllib.quote_plus(funart)
	
	if mode=="play": fld=False
	else: fld=True

	xbmcplugin.addDirectoryItem(handle, uri, listitem, fld) 
Example #3
Source File: directoryhandle.py    From program.plexus with GNU General Public License v2.0 6 votes vote down vote up
def addDir(name,url,mode,iconimage,total,pasta,fan_art="%s/fanart.jpg"%settings.getAddonInfo("path")):
    if "plugin://" in sys.argv[0]: u = sys.argv[0]; sysargv = sys.argv[0]
    else: u = 'plugin://program.plexus/'; sysargv = 'plugin://program.plexus/'
    u += "?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)+"&iconimage="+urllib.quote_plus(iconimage)
    contextmen = []
    liz=xbmcgui.ListItem(name,iconImage="DefaultFolder.png", thumbnailImage=iconimage)
    liz.setInfo( type="Video", infoLabels={ "Title": name} )
    liz.setProperty('fanart_image', fan_art)
    if mode == 1 or mode == 2:
        fic = hashlib.md5(name + '|' + url).hexdigest() + '.txt'
        if os.path.exists(os.path.join(mystrm_folder,fic)):
            contextmen.append((translate(30025), 'XBMC.RunPlugin(%s?mode=13&url=%s&name=%s&iconimage=%s)' % (sysargv, urllib.quote_plus(url),name,iconimage)))
        else:
            contextmen.append((translate(30026), 'XBMC.RunPlugin(%s?mode=12&url=%s&name=%s&iconimage=%s)' % (sysargv,urllib.quote_plus(url),name,iconimage)))
    liz.addContextMenuItems(contextmen,replaceItems=False)
    return xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=pasta,totalItems=total) 
Example #4
Source File: default.py    From tdw with GNU General Public License v3.0 6 votes vote down vote up
def play(url, id=0):
	print url
	engine=__settings__.getSetting("Engine")
	if engine=="0":
		play_ace(url, id)
		
	if engine=="1":
		item = xbmcgui.ListItem()#path=url
		xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)
		tthp.play(url, handle, id, __settings__.getSetting("DownloadDirectory"))
		
	if engine=="2":
		purl ="plugin://plugin.video.yatp/?action=play&torrent="+ urllib.quote_plus(url)+"&file_index="+str(id)
		item = xbmcgui.ListItem()#path=purl
		xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)
		xbmc.Player().play(purl) 
Example #5
Source File: main.py    From plugin.video.auvio with GNU General Public License v3.0 6 votes vote down vote up
def play_radio(params):
    
    cid = int(params.get('channel_id',None))
    media_url = None
    
    common.plugin.log("play_radio #{0}".format(cid))

    channel = api.get_single_channel(cid)
    
    if channel:
        common.plugin.log(json.dumps(channel))
        stream_node = channel.get('streamurl',None)

        if stream_node:
            media_url = stream_node.get('mp3','').encode('utf-8').strip()
        
    if not media_url:
        common.plugin.log_error("unable to get the radio stream URL.")
        common.popup("Impossible de trouver le flux radio")
        
    #play
    liz = xbmcgui.ListItem(path=media_url)
    return xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=True, listitem=liz) 
Example #6
Source File: contextmenu.py    From plugin.video.ustvvod with GNU General Public License v2.0 6 votes vote down vote up
def queue():
	playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
	show_title, season, episode, thumb, displayname, qmode, url = args.url.split('<join>')
	name =  base64.b64decode(displayname)
	item = xbmcgui.ListItem(name, path = url)
	try:
		item.setThumbnailImage(thumb)
	except:
		pass
	try:
		item.setInfo('Video', {	'title' : name,
						'season' : season,
						'episode' : episode,
						'TVShowTitle' : show_title})
	except:
		pass
	playlist.add(url, item)
	xbmc.executebuiltin('XBMC.Notification(%s, %s, 5000, %s)' % ("Queued", name, thumb)) 
Example #7
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 #8
Source File: addon.py    From plugin.video.sparkle with GNU General Public License v3.0 6 votes vote down vote up
def resolve_url(self, stream_url):
        '''
        Tell XBMC that you have resolved a URL (or not!).
        
        This method should be called as follows:
        
        #. The user selects a list item that has previously had ``isPlayable``
           set (this is true for items added with :meth:`add_item`, 
           :meth:`add_music_item` or :meth:`add_music_item`)
        #. Your code resolves the item requested by the user to a media URL
        #. Your addon calls this method with the resolved URL
        
        Args:
            stream_url (str or ``False``): If a string, tell XBMC that the 
            media URL ha been successfully resolved to stream_url. If ``False`` 
            or an empty string tell XBMC the resolving failed and pop up an 
            error messsage.
        '''
        if stream_url:
            self.log_debug('resolved to: %s' % stream_url)
            xbmcplugin.setResolvedUrl(self.handle, True, 
                                      xbmcgui.ListItem(path=stream_url))
        else:
            self.show_error_dialog(['sorry, failed to resolve URL :('])
            xbmcplugin.setResolvedUrl(self.handle, False, xbmcgui.ListItem()) 
Example #9
Source File: addon.py    From Kodi with GNU Lesser General Public License v3.0 6 votes vote down vote up
def get_play(self, all_episodes, season, epnum, eid):
        ep_data, img = all_episodes.get_episode(season, epnum, eid)
        data = self._get_video(**ep_data)
        li = xbmcgui.ListItem(data['title'], iconImage=img, thumbnailImage=img)

        sv = SoapVideo(
            ep_data['eid'],
            data['stream'],
            data['start_from'] or 0,
            li,
            lambda : self.mark_watched('episode', {'sid': ep_data['sid'], 'season': season, 'episode': epnum}),
            lambda pos: self.save_position(ep_data['eid'], pos)
        )
        sv.play()

        return True 
Example #10
Source File: directory_utils.py    From plugin.video.netflix with MIT License 6 votes vote down vote up
def _convert_dict_to_listitem(dict_item):
    list_item = xbmcgui.ListItem(label=dict_item['label'], offscreen=True)
    list_item.setContentLookup(False)
    properties = dict_item.get('properties', {})  # 'properties' key allow to set custom properties to xbmcgui.Listitem
    properties['isFolder'] = str(dict_item['is_folder'])

    if not dict_item['is_folder'] and dict_item['media_type'] in [common.VideoId.EPISODE,
                                                                  common.VideoId.MOVIE,
                                                                  common.VideoId.SUPPLEMENTAL]:
        properties.update({
            'IsPlayable': 'true',
            'TotalTime': dict_item.get('TotalTime', ''),
            'ResumeTime': dict_item.get('ResumeTime', '')
        })
    for stream_type, quality_info in iteritems(dict_item.get('quality_info', {})):
        list_item.addStreamInfo(stream_type, quality_info)
    list_item.setProperties(properties)
    list_item.setInfo('video', dict_item.get('info', {}))
    list_item.setArt(dict_item.get('art', {}))
    list_item.addContextMenuItems(dict_item.get('menu_items', []))
    if dict_item.get('is_selected'):
        list_item.select(True)
    return list_item 
Example #11
Source File: spike.py    From plugin.video.ustvvod with GNU General Public License v2.0 6 votes vote down vote up
def play_video(video_uri = common.args.url):
	# Handle the poewrnation specific video loading
	if 'powernation' in video_uri:
		video_data = connection.getURL(video_uri)
		video_json = json.loads(video_data)
		video_url = video_json['HLSURL']
		
		item = xbmcgui.ListItem(path = video_url)
		try:
			item.setThumbnailImage(common.args.thumb)
		except:
			pass
		try:
			item.setInfo('Video', {	'title' : common.args.name,
									'season' : common.args.season_number,
									'episode' : common.args.episode_number,
									'TVShowTitle' : common.args.show_title})
		except:
			pass
		xbmcplugin.setResolvedUrl(pluginHandle, True, item)
	else:
		video_data = connection.getURL(video_uri)
		video_url = BeautifulSoup(video_data, 'html5lib').find('div', class_ = 'video_player')['data-mgid']
		main_viacom.play_video(BASE, video_url) 
Example #12
Source File: amc.py    From plugin.video.ustvvod with GNU General Public License v2.0 6 votes vote down vote up
def play_video(episode_url = common.args.url):
	episode_data = connection.getURL(APIBASE + 'episode-details?episode_id=' + episode_url)
	episode_json = json.loads(episode_data)
	video_url = VIDEOURL % episode_json['data']['Episode']['FullEpisode']['PID']
	print video_url
	video_data = connection.getURL(video_url)
	video_tree = BeautifulSoup(video_data)
	finalurl = video_tree.video['src']
	item = xbmcgui.ListItem(path = finalurl)
	try:
		item.setThumbnailImage(common.args.thumb)
	except:
		pass
	try:
		item.setInfo('Video', {	'title' : common.args.name,
								'season' : common.args.season_number,
								'episode' : common.args.episode_number,
								'TVShowTitle' : common.args.show_title})
	except:
		pass
	xbmcplugin.setResolvedUrl(pluginHandle, True, item) 
Example #13
Source File: directoryhandle.py    From program.plexus with GNU General Public License v2.0 6 votes vote down vote up
def addDir(name,url,mode,iconimage,total,pasta,fan_art="%s/fanart.jpg"%settings.getAddonInfo("path"),parser=None,parserfunction=None):
    if "plugin://" in sys.argv[0]: u = sys.argv[0]; sysargv = sys.argv[0]
    else: u = 'plugin://plugin.video.p2p-streams/'; sysargv = 'plugin://plugin.video.p2p-streams/'
    u += "?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)+"&iconimage="+urllib.quote_plus(iconimage)
    try: u += "&parser="+urllib.quote_plus(parser)
    except: pass
    try: u += "&parserfunction="+urllib.quote_plus(parserfunction)
    except: pass
    contextmen = []
    liz=xbmcgui.ListItem(name,iconImage="DefaultFolder.png", thumbnailImage=iconimage)
    liz.setInfo( type="Video", infoLabels={ "Title": name} )
    liz.setProperty('fanart_image', fan_art)
    if mode == 1 or mode == 2:
        fic = hashlib.md5(name + '|' + url).hexdigest() + '.txt'
        if os.path.exists(os.path.join(mystrm_folder,fic)):
            contextmen.append((translate(30025), 'XBMC.RunPlugin(%s?mode=13&url=%s&name=%s&iconimage=%s)' % (sysargv, urllib.quote_plus(url),name,iconimage)))
        else:
            contextmen.append((translate(30026), 'XBMC.RunPlugin(%s?mode=12&url=%s&name=%s&iconimage=%s)' % (sysargv,urllib.quote_plus(url),name,iconimage)))
    liz.addContextMenuItems(contextmen,replaceItems=False)
    return xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=pasta,totalItems=total) 
Example #14
Source File: gui.py    From romcollectionbrowser with GNU General Public License v2.0 6 votes vote down vote up
def filter_id_values(self, filter_items, header_text, control_id, current_value, show_entry_all_items):
        # Sort the consoles by name
        filter_items = sorted(filter_items, key=lambda filter_item: filter_item[1])

        if show_entry_all_items:
            filter_items = [('0', util.localize(32120))] + filter_items
        items = []
        for filter_item in filter_items:
            item = xbmcgui.ListItem(filter_item[1])
            item.setProperty('id', str(filter_item[0]))
            items.append(item)
        index = xbmcgui.Dialog().select(header_text, items)
        if index < 0:
            return current_value, False
        item = items[index]
        button = self.getControlById(control_id)
        button.setLabel(item.getLabel())
        return int(item.getProperty('id')), True 
Example #15
Source File: default.py    From bugatsinho.github.io with GNU General Public License v3.0 6 votes vote down vote up
def resolve(name, url, iconimage, description):
    host = url
    if host.split('|')[0].endswith('.mp4') and 'clou' in host:
        stream_url = host + '|User-Agent=%s&Referer=%s' % (urllib.quote_plus(client.agent(), ':/'), GAMATO)
        name = name
    elif 'tenies-online' in host:
        stream_url = client.request(host)
        stream_url = client.parseDOM(stream_url, 'a', {'id': 'link'}, ret='href')[0]
        stream_url = evaluate(stream_url)
    else:
        stream_url = evaluate(host)
        name = name.split(' [B]|')[0]
    try:
        liz = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
        liz.setInfo(type="Video", infoLabels={"Title": name, "Plot": description})
        liz.setProperty("IsPlayable", "true")
        liz.setPath(str(stream_url))
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
    except BaseException:
        control.infoDialog(Lang(32012), NAME) 
Example #16
Source File: default.py    From bugatsinho.github.io with GNU General Public License v3.0 6 votes vote down vote up
def resolve(name, url, iconimage, description):
    stream_url = evaluate(url)
    name = name.split(' [B]|')[0]
    if stream_url is None:
        control.infoDialog('Prueba otro enlace', NAME, ICON, 4000)
    elif '.mpd|' in stream_url:
        stream_url, headers = stream_url.split('|')
        listitem = xbmcgui.ListItem(path=stream_url)
        listitem.setProperty('inputstreamaddon', 'inputstream.adaptive')
        listitem.setProperty('inputstream.adaptive.manifest_type', 'mpd')
        listitem.setMimeType('application/dash+xml')
        listitem.setProperty('inputstream.adaptive.stream_headers', headers)
        listitem.setContentLookup(False)
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listitem)
    else:
        try:
            liz = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
            liz.setInfo(type="Video", infoLabels={ "Title": name, "Plot": description })
            liz.setProperty("IsPlayable", "true")
            liz.setPath(str(stream_url))
            xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
        except:
            control.infoDialog('Prueba otro enlace', NAME, ICON, 4000) 
Example #17
Source File: dialogdeleteromcollection.py    From romcollectionbrowser with GNU General Public License v2.0 6 votes vote down vote up
def addItemsToList(self, controlId, options, properties=None):
        Logutil.log('addItemsToList', util.LOG_LEVEL_INFO)

        control = self.getControlById(controlId)
        control.setVisible(1)
        control.reset()

        items = []
        for i in range(0, len(options)):
            option = options[i]
            p = ''
            if properties:
                p = properties[i]
            items.append(xbmcgui.ListItem(option, p))

        control.addItems(items) 
Example #18
Source File: default.py    From bugatsinho.github.io with GNU General Public License v3.0 6 votes vote down vote up
def search_songs(query):
    playlist = []
    url = 'https://musicmp3.ru/search.html?text=%s&all=songs' % urllib.quote_plus(query.replace(' - ', ' ').replace('-', ' ').replace(' FT ', ' ').replace(' FEATURING ', ' ').replace(' ', '+'))
    link = GET_url(url)
    link = link.replace('<td class="song__artist song__artist--search">Various Artist</td>', '<td class="song__artist song__artist--search"><a class="song__link" href="/artist_various-artist.html">Various Artist</a></td>')
    match = re.compile('<tr class="song"><td class="song__play_button"><a class="player__play_btn js_play_btn" href="#" rel="(.+?)" title="Play track"/></td><td class="song__name song__name--search"><a class="song__link" href="(.+?)">(.+?)</a></td><td class="song__artist song__artist--search"><a class="song__link" href="(.+?)">(.+?)</a></td><td class="song__album song__album--search"><a class="song__link" href="(.+?)">(.+?)</a>').findall(link)
    for id,songurl,song,artisturl,artist,albumurl,album in match:
        iconimage = ""
        url = 'https://listen.musicmp3.ru/' + id # 'http://files.musicmp3.ru/lofi/' + id
        #url = 'http://listen.musicmp3.ru/2f99f4bf4ce7b171/' + id
        title = "%s - %s - %s" % (artist.replace('&amp;','and'), song.replace('&amp;','&'), album.replace('&amp;','&'))
        addDirAudio(title,url,10,iconimage,song,artist,album,'','')
        liz=xbmcgui.ListItem(song, iconImage=iconimage, thumbnailImage=iconimage)
        liz.setInfo('music', {'Title':song, 'Artist':artist, 'Album':album})
        liz.setProperty('mimetype', 'audio/mpeg')
        liz.setThumbnailImage(iconimage)
        liz.setProperty('fanart_image', audio_fanart)
        playlist.append((url, liz))
    setView('music', 'song') 
Example #19
Source File: xbmc.py    From romcollectionbrowser with GNU General Public License v2.0 6 votes vote down vote up
def add(self, url, listitem=None, index=-1):
        """Adds a new file to the playlist.

        :param url: string or unicode - filename or url to add.
        :param listitem: listitem - used with setInfo() to set different infolabels.
        :param index: integer - position to add playlist item.

        Example::

            playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
            video = 'F:\\movies\\Ironman.mov'
            listitem = xbmcgui.ListItem('Ironman', thumbnailImage='F:\\movies\\Ironman.tbn')
            listitem.setInfo('video', {'Title': 'Ironman', 'Genre': 'Science Fiction'})
            playlist.add(url=video, listitem=listitem, index=7)
        """
        pass 
Example #20
Source File: xbmc.py    From romcollectionbrowser with GNU General Public License v2.0 6 votes vote down vote up
def play(self, item=None, listitem=None, windowed=False, statrpos=-1):
        """
        Play this item.

        :param item: [opt] string - filename, url or playlist.
        :param listitem: [opt] listitem - used with setInfo() to set different infolabels.
        :param windowed: [opt] bool - true=play video windowed, false=play users preference.(default)
        :param startpos: [opt] int - starting position when playing a playlist. Default = -1

        .. note:: If item is not given then the Player will try to play the current item
            in the current playlist.

        You can use the above as keywords for arguments and skip certain optional arguments.
        Once you use a keyword, all following arguments require the keyword.

        example::

            listitem = xbmcgui.ListItem('Ironman')
            listitem.setInfo('video', {'Title': 'Ironman', 'Genre': 'Science Fiction'})
            xbmc.Player().play(url, listitem, windowed)
            xbmc.Player().play(playlist, listitem, windowed, startpos)
        """
        pass 
Example #21
Source File: dialogbase.py    From romcollectionbrowser with GNU General Public License v2.0 5 votes vote down vote up
def addItemsToList(self, controlId, options):
        Logutil.log('addItemsToList: ID = ' + str(controlId) + ', values = ' + str(options), util.LOG_LEVEL_INFO)

        control = self.getControlById(controlId)
        control.setVisible(1)
        control.reset()

        items = []
        for option in options:
            items.append(xbmcgui.ListItem(option))

        control.addItems(items) 
Example #22
Source File: xbmc.py    From romcollectionbrowser with GNU General Public License v2.0 5 votes vote down vote up
def __getitem__(self, item):
        """x.__getitem__(y) <==> x[y]"""
        return _xbmcgui.ListItem() 
Example #23
Source File: default.py    From ownCloud-for-KODI with GNU General Public License v2.0 5 votes vote down vote up
def addMenu(url,title):
    listitem = xbmcgui.ListItem(decode(title), iconImage='', thumbnailImage='')
    fanart = addon.getAddonInfo('path') + '/fanart.jpg'

    listitem.setProperty('fanart_image', fanart)
    xbmcplugin.addDirectoryItem(plugin_handle, url, listitem,
                                isFolder=True, totalItems=0)


#http://stackoverflow.com/questions/1208916/decoding-html-entities-with-python/1208931#1208931 
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_main(self):
        # main listing
        xbmcplugin.setContent(self.addon_handle, "files")
        items = []
        items.append(
            (self.addon.getLocalizedString(11013),
             "plugin://plugin.audio.spotify/?action=browse_main_library",
             "DefaultMusicCompilations.png", True))
        items.append(
            (self.addon.getLocalizedString(11014),
             "plugin://plugin.audio.spotify/?action=browse_main_explore",
             "DefaultMusicGenres.png", True))
        items.append(
            (xbmc.getLocalizedString(137),
             "plugin://plugin.audio.spotify/?action=search",
             "DefaultMusicSearch.png", True))
        items.append(
            ("%s: %s" % (self.addon.getLocalizedString(11039), self.playername),
             "plugin://plugin.audio.spotify/?action=browse_playback_devices",
             "DefaultMusicPlugins.png", True))
        cur_user_label = self.sp.me()["display_name"]
        if not cur_user_label:
            cur_user_label = self.sp.me()["id"]
        label = "%s: %s" % (self.addon.getLocalizedString(11047), cur_user_label)
        items.append(
            (label,
             "plugin://plugin.audio.spotify/?action=switch_user",
             "DefaultActor.png", False))
        for item in items:
            li = xbmcgui.ListItem(
                item[0],
                path=item[1],
                iconImage=item[2]
            )
            li.setProperty('IsPlayable', 'false')
            li.setArt({"fanart": "special://home/addons/plugin.audio.spotify/fanart.jpg"})
            li.addContextMenuItems([], True)
            xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=item[1], listitem=li, isFolder=item[3])
        xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
        xbmcplugin.endOfDirectory(handle=self.addon_handle)
        self.refresh_connected_device() 
Example #25
Source File: default.py    From ownCloud-for-KODI with GNU General Public License v2.0 5 votes vote down vote up
def addDirectory(service, folder):
    listitem = xbmcgui.ListItem(decode(folder.title), iconImage='', thumbnailImage='')
    fanart = addon.getAddonInfo('path') + '/fanart.jpg'

    if folder.id != '':
        cm=[]
#        cm.append(( addon.getLocalizedString(30042), 'XBMC.RunPlugin('+PLUGIN_URL+'?mode=buildstrm&title='+folder.title+'&instanceName='+str(service.instanceName)+'&folderID='+str(folder.id)+')', ))
        listitem.addContextMenuItems(cm, False)
    listitem.setProperty('fanart_image', fanart)
    xbmcplugin.addDirectoryItem(plugin_handle, service.getDirectoryCall(folder), listitem,
                                isFolder=True, totalItems=0) 
Example #26
Source File: service.py    From plugin.video.sendtokodi with MIT License 5 votes vote down vote up
def createListItemFromVideo(video):
    debug(video)
    url = video['url']
    thumbnail = video.get('thumbnail')
    title = video['title']
    list_item = xbmcgui.ListItem(title, path=url)
    list_item.setInfo(type='Video', infoLabels={'Title': title})

    if thumbnail is not None:
        list_item.setArt({'thumb': thumbnail})

    return list_item 
Example #27
Source File: default.py    From tdw with GNU General Public License v3.0 5 votes vote down vote up
def stft(text):
	RL=tft.Search(text, 4)
	#if len(RL)>0:
	#	Title = "[COLOR F050F050]"+"[-------  Мультимедийный портал «KrasFS.ru»  ---------]"+"[/COLOR]"
	#	row_url = Title
	#	listitem = xbmcgui.ListItem(Title)
	#	listitem.setInfo(type = "Video", infoLabels = {"Title": Title} )
	#	purl = sys.argv[0] + '?mode=Search'\
	#		+ '&url=' + urllib.quote_plus(row_url)\
	#		+ '&title=' + urllib.quote_plus(Title)\
	#		+ '&text=' + urllib.quote_plus('0')
	#	xbmcplugin.addDirectoryItem(handle, purl, listitem, True)

	for itm in RL:
		n=0
		for i in ["PDF","pdf","FLAC","flac","FB2","fb2","MP3","mp3","PNG","png","ISO","iso","JPG","jpg","DJVU","djvu",".APE",".ape",".RTF",".rtf",".TXT",".txt",".DOC",".doc",".AC3",".ac3",".ZIP",".zip",".RAR",".rar",".EXE",".exe"]:
			filtr=itm[2].find(i)
			if filtr>0:n+=1
		if n==0:
				Title = itm[0]+"|"+itm[1]+"|  "+itm[2]
				row_url = itm[3]
				cover=""
				dict={}
				listitem = xbmcgui.ListItem(Title, thumbnailImage=cover, iconImage=cover)
				listitem.setProperty('fanart_image', cover)
				purl = sys.argv[0] + '?mode=play_url'\
					+ '&url=' + urllib.quote_plus(row_url)\
					+ '&title=' + urllib.quote_plus(Title)
				xbmcplugin.addDirectoryItem(handle, purl, listitem, True)


#---------tsengine----by-nuismons----- 
Example #28
Source File: player_monitor.py    From plugin.audio.spotify with GNU General Public License v3.0 5 votes vote down vote up
def update_playlist(self):
        '''Update the playlist: add fake item at the end which allows us to skip'''
        if self.connect_local:
            url = "http://localhost:%s/nexttrack" % PROXY_PORT
        else:
            url = "plugin://plugin.audio.spotify/?action=next_track"
        
        li = xbmcgui.ListItem('...', path=url)
        self.__playlist.add(url, li)
        self.__playlist.add(url, li) 
Example #29
Source File: simpleplugin.py    From plugin.video.auvio with GNU General Public License v3.0 5 votes vote down vote up
def _set_resolved_url(self, context):
        """
        Resolve a playable URL

        :param context: context object
        :type context: PlayContext
        """
        self.log_debug('Resolving URL from {0}'.format(str(context)))
        if context.play_item is None:
            list_item = xbmcgui.ListItem(path=context.path)
        else:
            list_item = self.create_list_item(context.play_item)
        xbmcplugin.setResolvedUrl(self._handle, context.succeeded, list_item) 
Example #30
Source File: kodi.py    From script.module.urlresolver with GNU General Public License v2.0 5 votes vote down vote up
def create_item(queries, label, thumb='', fanart='', is_folder=None, is_playable=None, total_items=0, menu_items=None, replace_menu=False):
    list_item = xbmcgui.ListItem(label, iconImage=thumb, thumbnailImage=thumb)
    add_item(queries, list_item, fanart, is_folder, is_playable, total_items, menu_items, replace_menu)