2010-03-19, 17:52
jez500 Wrote:Hi all, long time xbmc fan, first time poster.
Firstly a big thanks to all involved in the move to json (and xbmc in general), it is a dream to use compared to the old httpapi. I am a web developer by trade and have been working on a web ui over the last few months. The news of a json-rpc was music to my ears, So I decided to spend a few days rebuilding my app using json but during this process I got a bit stuck on a few things...
Glad to see that the decision to move to json is appreciated by the client creators
jez500 Wrote:1. Search : I found the combination of QueryMusicDatabase + LIKE %q% + searchbox + ajax resulted in powerful and fast itunes style searching. I can’t seem to make “MusicLibrary.GetSongs” do the same thing, is it possible? I am currently grabbing all songs at page load and looping through each item when searched - which I don’t think will scale well.
Great idea! I'll add some form of filter parameters to all the FooLibrary.GetBar calls.
Does
Code:
{"jsonrpc": "2.0", "method": "MusicLibrary.GetSongs", "params": { "filter": { "artist": "FOO", "album": "BAR" } } , "id": 1 }
I think filter object could have some settings aswell, like compare case and such aswell. Only problem might be if you want to compare case on artist but not album, but I doubt many will need that? If we need more granualirity it probably need to be something like:
Code:
"filter": { "artist": { "beginswith": "ac", "endswith": "dc", "casesensative": false } }
Also FOO and BAR would probably be regular expressions, sounds best imo?
jez500 Wrote:2. Add to Playlist: “Playlist.Add” doesn’t seem to have the same power as AddToPlayListFromDB, I found the ability to add songs, albums or artists to the playlist by id to be very useful.
Yeah it really needs to be connected with db here for sure, same with play and such aswell.
jez500 Wrote:3. Playlist data: more of a feature request here but it would be great if each playlist item was a fully loaded db row. Eg artist, artistid, genre, albumid, album ,thumb....etc. The virtual playlist sounds very cool!
Hmm, thought it did do that already. I'll need to check that abit the code is in place to handle the data atleast if data is given.
jez500 Wrote:4. Maybe these don’t exist yet or maybe I'm going blind but I cannot find equivalents of: clearPlayList, playFile, GetCurrentlyPlaying and SetPlaylistSong, any ideas?
I have been using this: http://pastebin.com/m340ebb83 and the default web interface (nightly win32 xbmc-r28256-trunk.exe) as my point of reference for documentation, is there anywhere else I should be looking?
Thanks again for all the great work!
To clear playlists you call "Playlist.Clear" with ID.
GetCurrentlyPlaying is still not implemented, basically I'm missing some stuff in core to make it working (threadsafe atleast). But playlist without ID can be used for the same thing in the mean time (check code in NowPlaying.html).
Thanx for the great ideas and kind words, hope you get it working.
Cheers,
Tobias