Kodi Community Forum
Queue Smart Playlist with Movie Sets? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Queue Smart Playlist with Movie Sets? (/showthread.php?tid=90905)



Queue Smart Playlist with Movie Sets? - TheOddLinguist - 2011-01-18

Let's say I have a smart playlist that includes some movie sets. When I open the contextual menu with a smart playlist selected and choose "Queue Item" or "Play", the video playlist is properly converted to a static one. (i.e. the items in the set are extracted to each be part of the list) However, if I try to queue that smart playlist through code, the sets show up as the sets themselves, not the movies within.

Is there a way to mimic XBMC's "Queue Item" functionality in Python? I've tried:

XBMC.PlayMedia()
XBMC.PlayList().add()
Both operate in the latter fashion mentioned above

XBMC.PlayList().load()
Doesn't like the format of the smart playlist

I looked up the contextual menu in the source. CGUIWindowVideoBase::OnQueueItem seems to work similarly to the PlayList.add() route, but calls CGUIWindowVideoBase::AddItemToPlayList, which appears to have some recursion magic--to handle things like folders and sets, I'm guessing--that we don't have access to in the Python library. Am I correct? Is there any way to properly convert a smart playlist to a static one?

Thanks for your time...hope I explained my question well enough...hehe


- spiff - 2011-01-18

i suspect you are correct, no bindings to those methods. for now you'll have to list the dir (a playlist is just a directory - do getdirectory on it) and add the items manually i guess.


- TheOddLinguist - 2011-01-21

Thanks for the reply, and sorry for the late response...I have another question, then, if you don't mind.

GetDirectory() seems to be a JSON-RPC call, right? I can't find confirmation that executejsonapi() ever made it in. (I'm doing this within an addon, and I'd rather not require the webserver to be on.) Is there a way to use JSON-RPC in python without the server, or am I misunderstanding your suggestion entirely, perhaps? hehe

Thanks again.


- TheOddLinguist - 2011-01-21

Sorry...a little more research and I found executeJSONRPC(). I'm guessing this is what I need then?


- spiff - 2011-01-21

yes, that was the idea.


- Jason102 - 2011-01-21

TheOddLinguist did an excellent job of implementing this into PseudoTV. There does seem to be one issue with it, though. spiff, you mentioned that playlists are treated as directories. When a smart playlist includes another smart playlist in its parameters, though, the JSON GetDirectory call returns an "Invalid Params" message. Is this expected, or a bug?


- TheOddLinguist - 2011-01-21

@Jason102: Could it be a string format issue somehow? Maybe the result you get from the initial JSON call needs to be escaped?


- Jason102 - 2011-01-21

No, I output the result from the initial JSON call to the log and it outputs that error.