Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shuffle really large playlists #79

Open
jingai opened this issue Dec 18, 2016 · 5 comments
Open

Shuffle really large playlists #79

jingai opened this issue Dec 18, 2016 · 5 comments

Comments

@jingai
Copy link
Collaborator

jingai commented Dec 18, 2016

This is more of a Kodi limitation, but documenting it here for possible future fix/workaround.

Kodi's JSON interface doesn't pay attention to the "shuffled" option when opening playlists. So, in the skill, we use the Files.GetDirectory method to retrieve every item from a playlist, shuffle it, and then add it to the appropriate transient playlist (id 0 or 1).

However, it seems Kodi has a limit to the number of items it can receive in a single Playlist.Add call. This means that shuffling really large playlists will just outright fail.

In practice, this isn't a massive problem because for most really large playlists users are going to want to shuffle them by default, which you can do in the playlist settings in Kodi. But, if the user tells Alexa to "shuffle" the playlist instead of "play/listen to/watch," it will fail even if the playlist is auto-randomized by Kodi.

One solution I can think of is to break up the array into chunks that won't cause Kodi to fail on the request; i.e., make multiple Playlist.Add calls.

Ultimately though, with the large playlists I'm referring to, the whole operation takes ages to complete anyway. It'd be best if Kodi would simply allow us to say "shuffle playlist X," but it doesn't currently and it's been years that it's been asked for.

I'm mostly looking for some discussion around the issue here to see what we might be able to do about this in the skill. Even if we can't do anything, I think having this Issue open will at least serve as a reference point when we get complaints about the behavior.

@m0ngr31
Copy link
Owner

m0ngr31 commented Dec 22, 2016

Breaking them into arrays and sending each isn't a huge deal if we want to go that route.

@jingai
Copy link
Collaborator Author

jingai commented Jan 4, 2017

Observed by Kodi forum user ConstantSphere as well here. Just noting for context.

@jingai
Copy link
Collaborator Author

jingai commented Apr 19, 2017

Splitting up the array works, but it's really slow sending this many items from Amazon to Kodi. There's no other way to do it atm though since Kodi doesn't support shuffling a playlist via JSON-RPC, so just going to push forward with this for now.

jingai added a commit that referenced this issue Apr 19, 2017
Kodi has a limit on how much it will accept in a single playlist add
call, so make multiple calls if necessary.

NOTE that this is incredibly slow, but because there is no other way to
shuffle playlists from Kodi's JSON-RPC interface, this is all we can do
at the moment.

Addresses Issue #79.
@jingai
Copy link
Collaborator Author

jingai commented Apr 19, 2017

This issue is technically addressed, but I'm leaving it open in the event that the Kodi devs add a way to shuffle playlists without manually adding every item to the queue.

For clarity, I know there's an option in the request to shuffle, but for some reason it doesn't work right for me. I have no idea why.

@jingai
Copy link
Collaborator Author

jingai commented Mar 12, 2018

Playlist handling via JSON-RPC is apparently even worse in Kodi 18, so I'm not really holding out much hope that this can be addressed properly any time soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants