Kodi Community Forum

Full Version: Play all song of audio library
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
I faced this problem for a while but I haven't found out the solution:
I use JSONRPC to retrieve all song of audio library, and then display them on a ListView (an Android View).
Requirement is when click on any item of the listview, XBMC will play the coresponding song.
What I have tried:
- When get all song from AudioLibrary, I sorted them by their songid, then I add them to the audio playlist, using method Playlist.Add
- Every song I get (that have been sorted in the previous step) will be displayed to the screen in a listview.
- If you click on any item (row), I use method Player.Open:
{"jsonrpc":"2.0","id":"playsong","method":"Player.Open","params":{"item":{"playlistid":0,"position"TongueOS}}}
where POS is a variable I pass from the selected song.
I know that the order of the song in the listview is not similar to the order of songs in the playlist.
Can you suggest a solution to solve this?
Thanks.
You should retrieve the contents of the playlist and show that in your listview. This will make both your playlist and listview consistent.
{"jsonrpc":"2.0","method":"Playlist.GetItems","params":{"playlistid":0},"id":1}
Hi Kabooga, I did try your request and it worked well.
But when I sorted the result by adding "sort":{"method":"label","order":"ascending"}, I can't play the correct song in the listview.
So is there anyway to sort songs by their label and they still be played correctly?