Kodi Community Forum

Full Version: HTTP API: Queue and play songs
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Maybe someone figures that out, I'm kinda stuck here. For our XBMC client for Android, I'm selecting arbitrarily songs which XBMC is supposed to play or queue. That can be a whole album, all songs from an artist, all songs of a genre, etc. Controls pass through the HTTP API.

In order to play song A, B, C (in that order), I imagined doing the following:

Code:
ClearPlayList(0)
AddToPlayList(A;0)
PlayFile(A;0)
AddToPlayList(B;0)
AddToPlayList(C;0)
[A, B, C being complete path names to the MP3 files]

Now, when I'm in XBMC, pressing space in the music library shows the playlist and shows indeed these three songs queued. Also, song A is playing.

BUT, only the first song plays. It stops playing before the second song. Apparently the PlayFile command only plays ONE single song and then stops. Is there a way to play the whole bunch? I studied the Wiki a while now, but I can't figure it out. Master jmarshall perhaps?

Cheers,

-freezy.
AddToPlaylist and then maybe a PlaylistNext ?
Well, I tried:
Code:
ClearPlayList(0)
AddToPlayList(A;0)
PlaylistNext()
AddToPlayList(B;0)
AddToPlayList(C;0)
That queues ABC (expected) but it doesn't play anything at all (XBMC is stopped). But I just looked in the code and discovered AddToPlayListFromDB. That sounds promising!
That's too weird, here was just someone asking the same question TODAY. I did some research the other day, believe me Smile
Ah, figured it out. The trick is:
Code:
ClearPlayList(0)
AddToPlayList(A;0)
AddToPlayList(B;0)
AddToPlayList(C;0)
SetCurrentPlaylist(0)
PlaylistNext()

That plays it. Thanks for the hint Jonathan.
Cool, glad you got it going!