Kodi Community Forum

Full Version: Call built-in functions and open music playlist
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey guys,
I just started a project that requires remote controlling my XBMC instance (so please excuse me being a naive beginner here). I got most of the things working (using the JSON methods and input actions) by looking endlessly through this forum, except I still can't get one thing to work:

How can I call a built-in function using the JSON-RPC API, more specifically the PlayMedia() function? I want to open one of my music playlists remotely.

Code:
<keymap><global><keyboard><r>PlayMedia(special://musicplaylists/myplaylist.m3u)</r></keyboard></global></keymap>
Defining it in the keymaps/keybard.xml does work, but that still doesn't provide me with access from the remote command line

Code:
curl "http://192.168.1.12/xbmcCmds/xbmcHttp?command=ExecBuiltIn(PlayMedia(path/to/playlist/playlist.m3u))"
is being depreciated/not working anymore with Frodo, so not an option. With that in mind I imagine that the purpose of the JSON API is exactly not to have to call the built-in functions but at this point this makes it unfortunately trickier for me.

So I tried
Code:
{"jsonrpc":"2.0","id":1,"method":"Player.Open","params":{"item":{"file":"Path/to/playlist/playlist.m3u"}}}

but that causes the screen to go black and just stand there idle. Using this call with a single .mp3 file works fine.

I checked the method list for the JSON-API and the Input actions but nothing seems to fit my purpose (does files.media have something to do with it?). So does somebody know how to call built-in functions or how to open a music playlist using the json api (Input.builtin or Open.playlist Tongue )
Thanks in advance

Jaden
There's a stupid bug in Xbmc about m3u files Smile
They are tagged as pictures playlist (still wondering why ??)

The simple solution :

You just need to add the following in your advanced settings in Xbmc installation
<pictureextensions>
<remove>.m3u</remove>
</pictureextensions>
Thanks a lot that works perfectly!

I take it I can then control set the list to repeat and shuffle with Player.SetShuffle and Player.SetRepeat?
Yes or if you just want to change them once you can specify them in the "options" parameter of the Player.Open call.
Perfect. Exactly what I was looking for after all.

Thanks a lot guys
I ran into this m3u issue as well.
Would it be possible to fix this once and for all by removing m3u from the picture extensions in AdvancedSettings.cpp?