Solved Setting art in playlist item
#1
Music 
Hi,

note: the solution as mentioned does not set the art. It probably works but I did not need it actually set. Just the url transfered.

I need to modify the information in my music-playlist when I add items to the list.
Using my humble attempt below, I can add/play the playlist, but the values I want to change are not changed at all. Instead the values I do see in the skin using $Info[mediaplayer....] originates from somewhere else!? And definily not added by me! F.ex. I have set the "Album" tag to show the ID, but it gets changed back to show an Album name - even though I never added that - wooooot!?! Actually it appears the url passed is being processed by another process that overrides my decisions.

Please help!

Code:
playlist =xbmc.PlayList(xbmc.PLAYLIST_MUSIC)

listitem = xbmcgui.ListItem(songID, thumbnailImage=thumb)
listitem.setInfo('music', {'Title': title, 'Album': albumID})
listitem.setArt({'thumbnailImage': thumb})

playlist.add(url=url, listitem=listitem, index=-1)
xbmc.Player().play()

The "title" seems to be "reset" to the song title, and so it goes for the other values also.
If the "listitem" is passed together with "player.play", the information is showing nicely - so I assumed it would "just work" when the listitem was added to the playlist.

I found some info and inspiration here:
http://mirrors.xbmc.org/docs/python-docs...ayList-add
http://mirrors.kodi.tv/docs/python-docs/...l#ListItem

Kodi (16.0-BETA2 Git:20151115-07f691e)
Reply
#2
You need to set to a mode that shows that information

addon_handle = int(sys.argv[1])
~
xbmcplugin.setContent(addon_handle, 'movies')
Reply
#3
I will try that. Do note that I am not filling a list - well I guess I am but not a standard container -but adding items to the musicplayer playlist.
I have not had any problems filling lists without setting"setcontent".probably because i handle the onclick myself.

So I tried the below, and the result is the same.. The mediplayer infolabels still does not show the information I passed in the listitem:
Code:
xbmcplugin.setContent(addon_handle, 'songs')
playlist =xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
listitem = xbmcgui.ListItem(songID, thumbnailImage=thumb)
listitem.setInfo('music', {'Title': title, 'Album': albumID})
listitem.setArt({'thumbnailImage': thumb})
listitem.setContentLookup(False)
# Add this as a new item in the playlist:
#playlist.add(url=url, listitem=listitem, index=-1)
playlist.add(url, listitem)

#xbmc.Player().play()
xbmc.Player().play(playlist, listitem,True,9000)

The song is added to the playlist (queue of the mediaplayer) and begins to play but the info is not showing.

Still not solved.
Reply
#4
I would very much appreciate if someone "in command" would at least verify that it is supposed to be possible to add details to items in a playlist (in Jarvis)
(As I would really like to focus on something else but this is sort of essential)
Reply
#5
This works.. but I have no clue why:
Code:
PL=xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
LI=xbmcgui.ListItem()
LI.setInfo('music', {'title': TITL, 'album': albumID})
LI.setArt({'thumbnailImage': thumb})
LI.setContentLookup(False)
PL.add(url='', listitem=LI, index=-1)
xbmc.Player().play(FILEPATH,LI,True,-1)
xbmc.Player().play(PL, LI, True,9000) <-- Probably no work if playlist length is OVER 9000!

Well it almost works anyways. The thumb is not displayed unless the file path is local. Those found by the scraper with http://... urls are not displayed. Not important for me as I just need the data stored for retrieval and can porbably use another infolabel.

.... bleh!?!
Reply
#6
This is still a mess.

The two last lines in the code above makes the player begin playing TWO times. If a kind sould could provide the proper solution. I might actually get the dishes done.. lel
Reply
#7
(2015-11-19, 22:01)Torben Wrote: This works.. but I have no clue why:
Code:
PL=xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
LI=xbmcgui.ListItem()
LI.setInfo('music', {'title': TITL, 'album': albumID})
LI.setArt({'thumbnailImage': thumb})
LI.setContentLookup(False)
PL.add(url='', listitem=LI, index=-1)
xbmc.Player().play(FILEPATH,LI,True,-1)
xbmc.Player().play(PL, LI, True,9000) <-- Probably no work if playlist length is OVER 9000!

Well it almost works anyways. The thumb is not displayed unless the file path is local. Those found by the scraper with http://... urls are not displayed. Not important for me as I just need the data stored for retrieval and can porbably use another infolabel.

.... bleh!?!
There are few things that you might think about:

1) I'm not familiar with listitem.setContentLookup(), don't see it in the Pydocs, so I went to the listitem source to see:
Code:
/**
       * setContentLookup(enable) -- Enable or disable content lookup for item.
       *
       * If disabled, HEAD requests to e.g determine mime type will not be sent.
       *
       * enable : bool
       */
      void setContentLookup(bool enable);
which may explain why you don't see the "http;" images, particularly if you aren't setting the mime-type in the listitem. I'm guessing here, but probably should work after the first time when the thumb is cached, so you'll get weird results. I don't know why you feel the need to use listitem.setContentLookup (which is very different from container.setContent() suggested in a previous post.)

2) You are using the same instance of listitem for playlist.add() and xbmc.Player().play() method calls. I believe this is not a good idea. Try using separate instances of listitem.

3) I could be barking out of my ass because I don't use playlists often.
Reply
#8
I have removed both the art and the contentlookuo lines. If I only do the play with the last line it plays ok. But rhe playlist head is bit moved. I feel closer.. No wonder a skin takes a year.. heh
Reply
#9
(2015-11-20, 17:57)Torben Wrote: I have removed both the art and the contentlookuo lines. If I only do the play with the last line it plays ok. But rhe playlist head is bit moved. I feel closer.. No wonder a skin takes a year.. heh

Did you try separate listitem instances?
Reply
#10
Not yet. Will do asap and report back.
Reply
#11
(2015-11-20, 18:14)Torben Wrote: Not yet. Will do asap and report back.

Just don't put the listitem parm in the xbmc.Player().play() call - it's optional. The art on the listitem in the playlist entry should display, at least it does for a video playlist.
Reply
#12
This worked for my needs (adding and playing a playlist item whilst setting the info and moving the "playhead"):

Code:
PL=xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
L=len(PL)
LI=xbmcgui.ListItem()
LI.setInfo('music', {'title': TITL, 'album': albumID, 'genre': unicode(thumb)})
PL.add(url='', listitem=LI, index=L)
PL[L].setPath(FILEPATH)
xbmc.Player().play(item=PL,startpos=L)

If "you" know of anything better/safer, do tell.
Reply

Logout Mark Read Team Forum Stats Members Help
Setting art in playlist item0