result is null from JSON RPC API

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
keepsimple Offline
Junior Member
Posts: 7
Joined: Aug 2011
Reputation: 0
Post: #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.
find quote
giftie Offline
Skilled Python Coder
Posts: 2,037
Joined: Mar 2010
Reputation: 35
Post: #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...

[Image: e4f63e45ba34fe4695b3bb08eb2499d8e4ee484e...4c076g.jpg]
For troubleshooting and bug reporting please make sure you read this first you can also use XBMC Log Uploader Script.
Cinema Experience
Cinema Experience Wiki
cdART Manager
fanart.tv


find quote
keepsimple Offline
Junior Member
Posts: 7
Joined: Aug 2011
Reputation: 0
Post: #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
}
find quote
dann0 Offline
Junior Member
Posts: 29
Joined: Jan 2011
Reputation: 0
Post: #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.
find quote
keepsimple Offline
Junior Member
Posts: 7
Joined: Aug 2011
Reputation: 0
Post: #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
}
find quote
Montellese Offline
Team-XBMC Developer
Posts: 2,789
Joined: Jan 2009
Reputation: 20
Location: Switzerland
Post: #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 XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
keepsimple Offline
Junior Member
Posts: 7
Joined: Aug 2011
Reputation: 0
Post: #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 :-)
find quote
keepsimple Offline
Junior Member
Posts: 7
Joined: Aug 2011
Reputation: 0
Post: #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...
find quote