2012-12-11, 23:32
Hi,
first of all I want to congratulate with the XBMC team that is doing an AMAZING work!
I'm planning to develop a new android app that instead of being a remote (since we already have an EXCELLENT one thanks to YATSE developer(s) ) wants to be a smart way to share music with friends.
The app it's in a very early stage and I'm still exploring the JSONRPC api but I think I've encountered a bug.
Let me explain.
Suppose we have 2 upnp resources:
1 - An album, that XMBC treat as a folder (DIR: "upnp://55370cfc-82ed-4290-a37f-3927585a4ada/43868/")
2 - A song, that XBMC treat as a file (FILE: "upnp://55370cfc-82ed-4290-a37f-3927585a4ada/43914")
So I have this little function that allow me to make XBMC calls from chromium with injected jquery (I'll post it here just to help reproducing the problem)
Now the DIR calls:
Things seems instead not to work with songs:
I found that YATSE behave the same way so I think it _may_ be a bug in the current JSONRPC implementation (go to Files/Playlist -> Audio Files -> YOUR UPNP SOURCE and try adding an album and than a single file).
I also found an old pull somehow related to this problem but I'm no C++ expert so before digging more into xbmc code I thought it may be a good idea to ask here.
Can anybody confirm the problem? Is it a bug or am I doing something wrong?
Thanks!
P.S. : I'm using JSON-RPC API v6
first of all I want to congratulate with the XBMC team that is doing an AMAZING work!
I'm planning to develop a new android app that instead of being a remote (since we already have an EXCELLENT one thanks to YATSE developer(s) ) wants to be a smart way to share music with friends.
The app it's in a very early stage and I'm still exploring the JSONRPC api but I think I've encountered a bug.
Let me explain.
Suppose we have 2 upnp resources:
1 - An album, that XMBC treat as a folder (DIR: "upnp://55370cfc-82ed-4290-a37f-3927585a4ada/43868/")
2 - A song, that XBMC treat as a file (FILE: "upnp://55370cfc-82ed-4290-a37f-3927585a4ada/43914")
So I have this little function that allow me to make XBMC calls from chromium with injected jquery (I'll post it here just to help reproducing the problem)
Code:
function xbmc(data) {
$.ajax({
data: data,
contentType: "application/json",
jsonp: 'jsonp_callback',
url: "http://localhost:8081/jsonrpc",
type: 'post', //make this a post instead of a get
success: function (data) {
window.lastRes = data;
console.log( data );
},
error:function( result ){
console.log( result );
console.log('error!!!');
}
})
};
Now the DIR calls:
Code:
// will correctly return an object with the songs inside DIR
xbmc( '{"jsonrpc":"2.0", "method":"Files.GetDirectory", "params":[DIR], "id":"1"}')
// will correctly add all songs in that album to the playlist (with full metadata!)
xbmc( '{"jsonrpc":"2.0", "method":"Playlist.Add", "params":[0,{"directory":"DIR"}], "id":"1"}');
Things seems instead not to work with songs:
Code:
// will add the song but no metadata will be read from the file
// (the label will be empty "" or the name of the upnp device in source, no cover, no album, no metadata)
xbmc( '{"jsonrpc":"2.0", "method":"Playlist.Add", "params":[0,{"file":FILE}], "id":"1"}');
// will return an error "Invalid params."
xbmc( '{"jsonrpc":"2.0", "method":"Files.GetFileDetails", "params":[FILE], "id":"1"}')
I found that YATSE behave the same way so I think it _may_ be a bug in the current JSONRPC implementation (go to Files/Playlist -> Audio Files -> YOUR UPNP SOURCE and try adding an album and than a single file).
I also found an old pull somehow related to this problem but I'm no C++ expert so before digging more into xbmc code I thought it may be a good idea to ask here.
Can anybody confirm the problem? Is it a bug or am I doing something wrong?
Thanks!
P.S. : I'm using JSON-RPC API v6