Kodi Community Forum
JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - 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: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC (/showthread.php?tid=68263)



- topfs2 - 2011-10-16

FSS_Dawid Wrote:I just found a bug. Im using the new libnfs library in xbmc and my files are mapped in XBMC using the nfs://xxx.xxx.xxx.xx/folder/file.xxx protocol the problem is that the nfs protocol is not accessible via vfs

PHP Code:
http://10.0.1.28:8080/vfs/nfs%3A%2F%2F10.0.1.4%2Fmnt%2Fuser%2FTVShows%2FBoardwalk%20Empire%2Ffile.xxx 

i get a response:
File not found... from the VFS.

BTW. grate Job on the JSON-RPC!!!
Kind regards
Dawid

EDIT:
Just tried to open a ticket for this problem but I can't register to trac Smile there's just the login option... Or I'm blind O_o ?

Its the same login as normal forum. But vfs access shouldn't be jsonrpc specific, we simply do a CFile::Exist (which might not be hooked up in the implementation of nfs, so then its nfs bug). and if exists we open and let you download.

So try if ExecBuiltin "playmedia(nfs://10.0.1.4/mnt/user/TVShows/Boardwalk Empire/file.xxx)" works, if it doesn't its most likely nfs cfile implementation (or wrong url)


- FSS_Dawid - 2011-10-16

topfs2 Wrote:Its the same login as normal forum. But vfs access shouldn't be jsonrpc specific, we simply do a CFile::Exist (which might not be hooked up in the implementation of nfs, so then its nfs bug). and if exists we open and let you download.

So try if ExecBuiltin "playmedia(nfs://10.0.1.4/mnt/user/TVShows/Boardwalk Empire/file.xxx)" works, if it doesn't its most likely nfs cfile implementation (or wrong url)
LOG dump:

http://pastebin.com/MtpUn2vn

request
PHP Code:
http://10.0.1.7:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(playmedia(nfs://10.0.1.4/mnt/user/TVShows/Boardwalk%20Empire/file.xxx)) 

it looks like the something on the NFS side, the file exist.
I will have a deeper look @ this. Who should I ticket about it ?


- Montellese - 2011-10-16

FSS_Dawid Wrote:I will have a deeper look @ this. Who should I ticket about it ?

IIRC Memphiz implemented NFS support (for OSX).


- jasonvp - 2011-10-17

Montellese Wrote:Friday, October 14th 2011:
Commit: 53ee2724ede510a8a3a0
  • Refactored Files.Download into Files.PrepareDownload and Files.Download. Using jsonrpc over HTTP Files.PrepareDownload does, what Files.Download did until now. It provides a URL which can be called to download the file (beware the answer format has changed). The idea behind the changes is that some transport layers will support direct download through Files.Download while others (like HTTP) will not and in that case the method name "Download" may be confusing. That's why we split the functionality into Files.PrepareDownload (which will be available over HTTP) and Files.Download (which will not be available over HTTP because it's not supported).


Do you know when this will be added to the nightly build?

Still not in the introspect for 20111017-ea79501.


Cheers
Jason


- Montellese - 2011-10-17

jasonvp Wrote:Do you know when this will be added to the nightly build?

Still not in the introspect for 20111017-ea79501.

Uhm it is in my introspect:
Code:
"Files.PrepareDownload": {
                "description": "Provides a way to download a given file (e.g. providing an URL to the real file location)",
                "params": [
                    {
                        "name": "path",
                        "required": true,
                        "type": "string"
                    }
                ],
                "returns": {
                    "properties": {
                        "id": {
                            "required": true,
                            "type": "string"
                        },
                        "mode": {
                            "description": "Direct mode allows using Files.Download whereas redirect mode requires the usage of a different protocol",
                            "enums": [
                                "redirect",
                                "direct"
                            ],
                            "required": true,
                            "type": "string"
                        },
                        "protocol": {
                            "enums": [
                                "http"
                            ],
                            "required": true,
                            "type": "string"
                        }
                    },
                    "type": "object"
                },
                "type": "method"
            },

Currently you won't see Files.Download in any introspect because no transport layer supports direct download through jsonrpc. Furthermore jsonrpc over TCP does not support any download so you won't see Files.PrepareDownload in introspect over TCP either. It only appears over HTTP.


- jasonvp - 2011-10-17

Montellese Wrote:Uhm it is in my introspect:

Currently you won't see Files.Download in any introspect because no transport layer supports direct download through jsonrpc. Furthermore jsonrpc over TCP does not support any download so you won't see Files.PrepareDownload in introspect over TCP either. It only appears over HTTP.

That's probably why I don't see it.Smile

Thanks again Montellese.

Oh yeah, I also found that "Player.UnShuffle","params":{"playerid":2} doesn't work but "Player.Shuffle","params":{"playerid":2} does.

Code:
{"jsonrpc":"2.0","id":2,"method":"Player.UnShuffle","params":{"playerid":2}}
Code:
{"error":{"code":-32100,"message":"Failed to execute method."},"id":2,"jsonrpc":"2.0"}

I know the drill. Wink


Cheers
Jason


- Raginn8 - 2011-10-18

An intospect that returns a COMPLETE params list would be paramount! At the moment I'm having a hell of a time trying to get various methods fully utilized due to a lack of param listings. I have AMX/Crestron client modules half way complete because of all the roadbumps I've hit from an incomplete API. I would also be very willing to assist in fleshing out said API if contacted.


- Montellese - 2011-10-18

Raginn8 Wrote:An intospect that returns a COMPLETE params list would be paramount! At the moment I'm having a hell of a time trying to get various methods fully utilized due to a lack of param listings. I have AMX/Crestron client modules half way complete because of all the roadbumps I've hit from an incomplete API. I would also be very willing to assist in fleshing out said API if contacted.

If you want to have a detailed introspect you need to use the pre-eden nightlies as they provide a fully documented API through JSONRPC.Introspect.


Player.GetActivePlayers and PlayerId - mjeanrichard - 2011-10-18

Hi there,

If I query Player.GetActivePlayers and receive an audio player with playerId 0 and use this id for subsequent queries will it always be the audio player? Or, in other words, can the Id of a player change?

Thanks for your help!
Cheers
Meini


- Montellese - 2011-10-18

mjeanrichard Wrote:Hi there,

If I query Player.GetActivePlayers and receive an audio player with playerId 0 and use this id for subsequent queries will it always be the audio player? Or, in other words, can the Id of a player change?

Thanks for your help!
Cheers
Meini

The ID of the player won't change but the type of the player might. If (in the future) you have a mixed playlist with songs and movies you will be able to use the same "playerid" to control playback of all the items in that playlist but when playing a song the player will be of type "audio" and when playing a movie it will be of type "video".


- ViRuSTriNiTy - 2011-10-18

Hi Montellese,

first, good job with the json rpc interface. C:

i would like to report a "bug" that is most likely not a bug because its not implemented. when i play a audio stream with XBMC pre-eden and try to query the info with Player.GetItem no data is returned. so i think theres just a condition or something missing that handles streams when Player.GetItem request comes in.

So lonG
Daniel


- Montellese - 2011-10-18

ViRuSTriNiTy Wrote:Hi Montellese,

first, good job with the json rpc interface. C:

i would like to report a "bug" that is most likely not a bug because its not implemented. when i play a audio stream with XBMC pre-eden and try to query the info with Player.GetItem no data is returned. so i think theres just a condition or something missing that handles streams when Player.GetItem request comes in.

So lonG
Daniel

I'm not sure I understand. Does Player.GetItem not work at all? How do you play the audio stream? Is it a web stream? If so it might be that you don't get any information. Haven't been able to add that to Player.GetItem yet.


- ViRuSTriNiTy - 2011-10-18

Montellese Wrote:I'm not sure I understand ... Is it a web stream? ... Haven't been able to add that to Player.GetItem yet.

ok, as i was expecting it. so waiting for the implementation should "fix" the "bug", thx C:


- jasonvp - 2011-10-19

Hi guys,

When I send,
Code:
{"jsonrpc":"2.0","id":0,"method":"Player.GetItem","params":{"playerid":1,"properties":["fanart"]}}

I get,
Code:
{"id":0,"jsonrpc":"2.0","result":{"item":{"fanart":"special://masterprofile/Thumbnails/Video/Fanart/9e82215b.tbn","id":1,"label":"15x01. HUMANCENTiPAD","type":"episode"}}}

The problem is "9e82215b.tbn" is not located in "Thumbnails/Video/Fanart" it is in "Thumbnails/Video/9/9e82215b.tbn" and is the Thumbnail and not the Fanart. The Fanart is actually "Thumbnails/Video/Fanart/307790e7.tbn".

Any ideas to what may be going on.


Cheers
Jason

20111017-ea79501


- Montellese - 2011-10-19

jasonvp Wrote:Hi guys,

When I send,
Code:
{"jsonrpc":"2.0","id":0,"method":"Player.GetItem","params":{"playerid":1,"properties":["fanart"]}}

I get,
Code:
{"id":0,"jsonrpc":"2.0","result":{"item":{"fanart":"special://masterprofile/Thumbnails/Video/Fanart/9e82215b.tbn","id":1,"label":"15x01. HUMANCENTiPAD","type":"episode"}}}

The problem is "9e82215b.tbn" is not located in "Thumbnails/Video/Fanart" it is in "Thumbnails/Video/9/9e82215b.tbn" and is the Thumbnail and not the Fanart. The Fanart is actually "Thumbnails/Video/Fanart/307790e7.tbn".

Any ideas to what may be going on.


Cheers
Jason

20111017-ea79501

Hm I tried playing a view movies and executed your jsonrpc request and the returned fanart path was always correct. Does this problem occur with every video you play?