Kodi Community Forum
Call built-in functions and open music playlist - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+---- Forum: JSON-RPC (https://forum.kodi.tv/forumdisplay.php?fid=174)
+---- Thread: Call built-in functions and open music playlist (/showthread.php?tid=163348)



Call built-in functions and open music playlist - Jaden - 2013-04-26

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


RE: Call built-in functions and open music playlist - Tolriq - 2013-04-26

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>


RE: Call built-in functions and open music playlist - Jaden - 2013-04-26

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?


RE: Call built-in functions and open music playlist - Montellese - 2013-04-26

Yes or if you just want to change them once you can specify them in the "options" parameter of the Player.Open call.


RE: Call built-in functions and open music playlist - Jaden - 2013-04-27

Perfect. Exactly what I was looking for after all.

Thanks a lot guys


RE: Call built-in functions and open music playlist - spud.webb - 2013-12-30

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?