Position in playlist VS Songid
#1
Hi,
This is my request to retrieve all song in the AudioLibrary
Code:
{"jsonrpc":"2.0", "method": "AudioLibrary.GetSongs","params": {"limits": { "start" : 0 }, "properties": [ "artist", "duration", "album", "track" ], sort": { "order": "ascending", "method": "track", "ignorearticle": true } }, "id": "getsongs"}
and here is result:
Image

But When I click on "Love To be Loved by You", XBMC plays another song (Payphone).
Every time user click on item in the list, I get the POSITION of that line, and assign to a function to execute this request:
Code:
{"jsonrpc": "2.0", "id" : "playsong", "method": "Player.Open","params":{"item": {"position":"+ POSITION +","playlistid":0}}}

I can't play exactly the song in the list. Any idea to fix this?
Reply
#2
AudioLibrary.GetSongs returns all the songs in your library independent of whether they are currently part of a playlist or not. When you use Player.Open with the "playlistid" and the "position" properties you reference the currently active music playlist (which most likely does not contain all the songs of your library and if so probably not in the same order).

You need to use the "songid" property in the Player.Open request and pass it in the actual "songid" and not the position of that song in your list.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#3
(2013-07-28, 19:50)Montellese Wrote: AudioLibrary.GetSongs returns all the songs in your library independent of whether they are currently part of a playlist or not. When you use Player.Open with the "playlistid" and the "position" properties you reference the currently active music playlist (which most likely does not contain all the songs of your library and if so probably not in the same order).

You need to use the "songid" property in the Player.Open request and pass it in the actual "songid" and not the position of that song in your list.

Yes, I did think about that, but if I use SongID as parameter of Player.Open, the Player did not automatically play the next item.
Reply
#4
Yes because it's the only item in the playlist. If you want it to automatically play the next song you have to put together a playlist first using Playlist.Add/Insert (with the "songid"s of the songs) and then you can use Player.Open the way you posted in your initial post.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#5
(2013-07-28, 22:25)Montellese Wrote: Yes because it's the only item in the playlist. If you want it to automatically play the next song you have to put together a playlist first using Playlist.Add/Insert (with the "songid"s of the songs) and then you can use Player.Open the way you posted in your initial post.

Oh, maybe I didn't say detailed what I did with my project.
I added all song to playlist (as you just said). If I use Play.Open with 'position' parameter, player just played wrong song but automatically play the next song. (Does this mean I added songs to the playlist correctly, right?)
And now I want to know how to play right song as it shown in the list.
Reply
#6
Are you sure that you added the songs to the playlist in the proper order? Did you do that through JSON-RPC or through xbmc's GUI? Maybe you should use Playlist.GetItems to retrieve the list of songs in the proper order and use that list to display the items in your application. Then the position in your list should be the same as the position in xbmc's playlist.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#7
When I have a list of songs (by using AudioLibrary.GetSongs), I make a loop to add every song to the playlist but I'm not sure that I add them in the right order. I will try your suggestion: Using Playlist.GetItems. (Err, do I always need to process adding songs to playlist before getting items from the playlist?)
Reply

Logout Mark Read Team Forum Stats Members Help
Position in playlist VS Songid1