Adding multiple playlist items without batch request
#1
I'm developing a cross platform desktop remote for Kodi called ReKodi. One of its features is to allow users to create playlists and save them locally. Each playlist contains all the related 'file'-paths, as provided by Kodi. Now I want the users to be able to open (and apply) a locally stored playlist. In my case that means looping through an array and calling Playlist.Add or Playlist.Insert at each iteration, providing the playlistid and file path (and in case of Playlist.Insert the position) as parameters.

I don't really like this way of doing this, because it's dirty to make api requests in a loop. Apart from that it's killing my websocket connection after 5 requests. So the connection is being closed momentarily and only 5 items are being added to the playlist. I can see why. Probably this is some kind of security feature.
Ideally I would like to be able to send and array of files, albumids, episodeids, etc.... But that doesn't seem to be possible. Or am I mistaking?

The api client I'm using does not seem to be prepared for batch requests and I'm really liking it as is. Modifying it to support batch requests would be my last resort. Is there any way to achieve my wish without having to use batch request?
Image

Please add to my reputation if you find my posts usefull (+/- button below posts)
Ubuntu 12.10 minimal XBMC auto-install script :: XBMControl :: Xbmc XBOX Skins :: XBMControl for Android :: Owner of Sudo Systems
Reply
#2
Not possible without batch.

And be careful with playlist saving out of Kodi.

Ids can change on any database update or rescrape, and queuing media from path and not ids will make the non playing items in the playing not load their metadata until they are read.

Those are quite a big limitation that have stopped me from being able to do this correctly.
Reply
#3
Thank you for your reply Tolriq.

I'm aware it's not a very reliable way of creating playlists. It's a concession I'm willing to make. I find the way playlists work in Kodi hardly usable, but I still want to be able to create them, even if that means they'll be useless at some point. I can warn the users clearly about the (possibly short) lifespan of the playlists, during the process of creating them.
Using the 'file' paths is probably the most reliable way to store items locally. Any playlist (with absolute paths) wouldn't work anymore if the paths change. So the way I want to do it seems like an acceptable situation to me.

Too bad I'll need batch requests. Thanks for clearing that up. Are you using batch requests in Yatse?

edit: It would be even better if Kodi would offer a Playlist.Save and Playlist.GetSaved (or something). If playlists would be saved in the database they could be included in database updates and never 'expire'. But that's probably not something we will see in the near future Smile
Image

Please add to my reputation if you find my posts usefull (+/- button below posts)
Ubuntu 12.10 minimal XBMC auto-install script :: XBMControl :: Xbmc XBOX Skins :: XBMControl for Android :: Owner of Sudo Systems
Reply
#4
Yes batch request are near mandatory, but (as always there's a big but) topfs said that we should not rely on command ordering in batch commands as the spec does not says so.

So in theory in any future release batch command ordering could be broken and leave all remote maker in a quite uncomfortable position.

Playlist managing was asked but it needs a complete rewrite from what I understood.


What would be cool is that queuing by filepath have a way to trigger meta data loading, but this is out of my competence for a PR, maybe montellese can look at it.
Reply
#5
I'm looking into modifying the api client I'm to accept batch requests. It's brilliant in every other way since it dynamically builds itself based on the Introspect result with just a few lines of code. I wish I could take credit for it. It's a very elegant piece of code. Let's see if I can keep it elegant while adding batch functionality Smile

Thanks Tolriq! You experience/knowledge is very helpful.
Image

Please add to my reputation if you find my posts usefull (+/- button below posts)
Ubuntu 12.10 minimal XBMC auto-install script :: XBMControl :: Xbmc XBOX Skins :: XBMControl for Android :: Owner of Sudo Systems
Reply

Logout Mark Read Team Forum Stats Members Help
Adding multiple playlist items without batch request0