result is null from JSON RPC API
#1
Hi,
I am trying to use JSON RPC API talking to my XBMC v10.0 running on MacOS X. I tried the following calls but got result "null":

telnet localhost 9090

{"jsonrpc": "2.0", "method": "AudioLibrary.GetArtists", "params": {"fields": ["artistid", "label"]}, "id": 1}
{
"id" : 1,
"jsonrpc" : "2.0",
"result" : null
}

{"jsonrpc": "2.0", "method": "AudioLibrary.GetArtists","params":{}, "id":3}
{
"id" : 3,
"jsonrpc" : "2.0",
"result" : null
}

{"jsonrpc": "2.0", "method": "AudioLibrary.GetSongs", "id": 1}
{
"id" : 1,
"jsonrpc" : "2.0",
"result" : null
}

But I can play songs in XBMC and I can see the Announcements via JSON-RPC:

{
"jsonrpc" : "2.0",
"method" : "Announcement",
"params" : {
"message" : "QueueNextItem",
"sender" : "xbmc"
}
}

I cannot find why I was not able to get results querying about Artists. Any help is appreciated.

Thanks.
Reply
#2
keepsimple Wrote:Hi,
I am trying to use JSON RPC API talking to my XBMC v10.0 running on MacOS X. I tried the following calls but got result "null":

telnet localhost 9090

{"jsonrpc": "2.0", "method": "AudioLibrary.GetArtists", "params": {"fields": ["artistid", "label"]}, "id": 1}
{
"id" : 1,
"jsonrpc" : "2.0",
"result" : null
}

{"jsonrpc": "2.0", "method": "AudioLibrary.GetArtists","params":{}, "id":3}
{
"id" : 3,
"jsonrpc" : "2.0",
"result" : null
}
Check the output of JSONRPC.Introspect for the valid fields. If you drop the 'params":{} all together, you will get the output your looking for(artistid and label)

Quote:{"jsonrpc": "2.0", "method": "AudioLibrary.GetSongs", "id": 1}
{
"id" : 1,
"jsonrpc" : "2.0",
"result" : null
}

But I can play songs in XBMC and I can see the Announcements via JSON-RPC:

{
"jsonrpc" : "2.0",
"method" : "Announcement",
"params" : {
"message" : "QueueNextItem",
"sender" : "xbmc"
}
}

I cannot find why I was not able to get results querying about Artists. Any help is appreciated.

Thanks.

AudioLibrary.GetSongs needs params...
Reply
#3
giftie Wrote:Check the output of JSONRPC.Introspect for the valid fields. If you drop the 'params":{} all together, you will get the output your looking for(artistid and label)

I tried to drop the "params":{} , but still get result "null":

{"jsonrpc": "2.0", "method": "AudioLibrary.GetArtists", "id": 2}
{
"id" : 2,
"jsonrpc" : "2.0",
"result" : null
}
Reply
#4
first question would have to be have you scanned media in to your library?

what you describe is exactly the response i get before adding a source to my library and scanning it.
Reply
#5
dann0 Wrote:first question would have to be have you scanned media in to your library?

what you describe is exactly the response i get before adding a source to my library and scanning it.

I did scan the library and I can play the songs in XBMC. Still cannot get results:


{"jsonrpc": "2.0", "method": "AudioLibrary.ScanForContent", "id": 1}
{
"id" : 1,
"jsonrpc" : "2.0",
"result" : "OK"
}
{"jsonrpc": "2.0", "method": "AudioLibrary.GetAlbums", "params": {"fields": ["album_title"]}, "id": 1}
{
"id" : 1,
"jsonrpc" : "2.0",
"result" : null
}

{"jsonrpc": "2.0", "method": "AudioLibrary.GetArtists", "id": 1}
{
"id" : 1,
"jsonrpc" : "2.0",
"result" : null
}
Reply
#6
keepsimple Wrote:I did scan the library and I can play the songs in XBMC. Still cannot get results:


{"jsonrpc": "2.0", "method": "AudioLibrary.ScanForContent", "id": 1}
{
"id" : 1,
"jsonrpc" : "2.0",
"result" : "OK"
}

That's not enough to get your albums, artists and songs into your library and you can also play songs in XBMC without adding them to the library. You need to add a music source to your library and tell it where to look for your audio files.

If JSONRPC does not return a result you haven't scanned your audio files into your library.
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
Montellese Wrote:That's not enough to get your albums, artists and songs into your library and you can also play songs in XBMC without adding them to the library. You need to add a music source to your library and tell it where to look for your audio files.

If JSONRPC does not return a result you haven't scanned your audio files into your library.

Thanks for the assertion :-) Finally I found what it means by "into the library". It had to right click on the music item and select "Scan item to library".

I am sorry that I am asking some very basic questions. However, is this just me? I found this is very confusing. First, I am wondering what is the difference between "Add source" and "Scan to library"? Second, where can I look at my music library? It's clear that all sources are listed. But where is the "library"?

In any case, Thanks again for your help. Now my JSON-RPC is working :-)
Reply
#8
Just a follow-up, I found that I have to enable "Library mode" from a "hidden" left-bar menu to be able to see the music library. I thought it could be more straight forward...
Reply

Logout Mark Read Team Forum Stats Members Help
result is null from JSON RPC API0