2012-03-04, 02:20
Ok, thanks for your fast reply.
Sorry for posting this question again, I will search better next time.
Sorry for posting this question again, I will search better next time.
samdret Wrote:I'm wondering if there's a way to get the current database revision (I think that's what you call it) number from XBMC via JSON RPC? My system would like a way to backup said database.I don't think that this will ever make it into JSON-RPC because it offers zero benefit to a normal client which wants to access the libraries and control playback etc. Furthermore if you want to perform a backup you'll have to access the MySQL database manually anyway so why don't you do that in the first place and use some SQL queries to get the name of your database?
samdret Wrote:Also, I would love the ability to add sources via JSON RPC to the MySQL database. Or at the very least, directly into the XBMC databases. Previously I just edited sources.xml, but since going over to MySQL, this is no longer possible.Sources are not stored in the database independant of whether you use MySQL or SQLite, they are still stored in a sources.xml. In the future there will eventually be the functionality to add/edit/remove sources but it's not one of the urgent features. Please create a feature request ticket for it.
samdret Wrote:Any word on a screenshot feature for JSON RPC?Not yet. Please create a feature request ticket.
samdret Wrote:Would it also be a possibility to get a function which returns the appropriate ID (to use with Play) when given a filename?Why don't you just pass the filename in the "file" property of the "item" parameter of Player.Open or Playlist.Add? Saves you a call to an extra function.
samdret Wrote:Mark movies/episodes as "Watched" via JSON RPC?This will be possible with my FooLibrary.SetBarDetails() methods which should be available in the next release. You'll be able to set the "playcount" property to whatever you want.
Montellese Wrote:I don't think that this will ever make it into JSON-RPC because it offers zero benefit to a normal client which wants to access the libraries and control playback etc. Furthermore if you want to perform a backup you'll have to access the MySQL database manually anyway so why don't you do that in the first place and use some SQL queries to get the name of your database?
Montellese Wrote:Sources are not stored in the database independant of whether you use MySQL or SQLite, they are still stored in a sources.xml. In the future there will eventually be the functionality to add/edit/remove sources but it's not one of the urgent features.
Montellese Wrote:Not yet. Please create a feature request ticket.
Montellese Wrote:Why don't you just pass the filename in the "file" property of the "item" parameter of Player.Open or Playlist.Add? Saves you a call to an extra function.
Montellese Wrote:This will be possible with my FooLibrary.SetBarDetails() methods which should be available in the next release. You'll be able to set the "playcount" property to whatever you want.
samdret Wrote:I believe I've tried this, but when it's done this way, Player.GetItem does not return all the meta data that XBMC has, only marginal information. I'll give this another go and report back.When you go through JSON-RPC with a file that is in XBMC's databases you should always get all the information available. If the file is not in the database you will only get a limited set of information. There will be some improvement for this in the future but not for Eden.
samdret Wrote:Awesome. By next release, you mean RC3/Final or Eden+1?Beta's and RC's are not real releases. With "next release" I refer to Eden+1 i.e. Frodo.
curl -d "{\"jsonrpc\": \"2.0\", \"method\": \"Files.PrepareDownload\", \"params\" : { \"path\" : \"/media/media/Music/Full Albums/Electro/Bob Sinclar feat. Sean Paul - Disco Crash - 2012/02 - Bob Sinclar feat. Sophie Ellis-Bextor & Gilbere Forte - F++k With You.mp3\" }, \"id\" : 1 }" http://192.168.1.40:6666/jsonrpc
{"id":1,"jsonrpc":"2.0","result":{"details":{"path":"vfs/%2fmedia%2fmedia%2fMusic%2fFull%20Albums%2fElectro%2fBob%20Sinclar%20feat%2e%20Sean%20Paul%20%2d%20Disco%20Crash%20%2d%202012%2f02%20%2d%20Bob%20Sinclar%20feat%2e%20Sophie%20Ellis%2dBextor%20%26%20Gilbere%20Forte%20%2d%20F%2b%2bk%20With%20You%2emp3"},"mode":"redirect","protocol":"http"}}
curl http://192.168.1.40:6666/vfs/%2fmedia%2fmedia%2fMusic%2fFull%20Albums%2fElectro%2fBob%20Sinclar%20feat%2e%20Sean%20Paul%20%2d%20Disco%20Crash%20%2d%202012%2f02%20%2d%20Bob%20Sinclar%20feat%2e%20Sophie%20Ellis%2dBextor%20%26%20Gilbere%20Forte%20%2d%20F%2b%2bk%20With%20You%2emp3
ERROR: WebServer: Failed to open /media/media/Music/Full Albums/Electro/Bob Sinclar feat. Sean Paul - Disco Crash - 2012/02 - Bob Sinclar feat. Sophie Ellis-Bextor & Gilbere Forte - F k With You.mp3
Montellese Wrote:The problems is the two "+" you have in your path. XBMC thinks that "+" needs to be replaced with a whitespace when decoding the URL. I'll have to read up in the RFC on URI/URLs on how this is supposed to work. But it looks like XBMC correctly URL encodes the "+" to "%2b" but on decoding it it first decodes "%2b" to "+" and then to a whitespace.
http://192.168.1.40:6666/vfs/%2fmedia%2fmedia%2fMusic%2fFull%20Albums%2fElectro%2fBob%20Sinclar%20feat%2e%20Sean%20Paul%20%2d%20Disco%20Crash%20%2d%202012%2f02%20%2d%20Bob%20Sinclar%20feat%2e%20Sophie%20Ellis%2dBextor%20%26%20Gilbere%20Forte%20%2d%20F%252b%252bk%20With%20You%2emp3
Montellese Wrote:I have located the problem. It seems that the library we use for our webserver already decodes incoming URLs and then we (i.e. XBMC) decode it again so first the %2b is decoded to + by libmicrohttpd and then to a whitespace by XBMC. I'll see if I can get a fix for that into Eden.
Millencolin007 Wrote:Great! Thanks for your help
curl -d "{\"jsonrpc\": \"2.0\", \"method\": \"Files.GetDirectory\", \"params\" : { \"directory\" : \"special://musicplaylists\" }, \"id\" : 1 }" http://192.168.1.40:6666/jsonrpc | python -mjson.tool
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"files": [
{
"file": "special://profile/playlists/music/arabic.xsp",
"filetype": "directory",
"label": "arabic",
"type": "unknown"
},
{
"file": "special://profile/playlists/music/hip-hop.xsp",
"filetype": "directory",
"label": "hip-hop",
"type": "unknown"
},
{
"file": "special://profile/playlists/music/aaa.xsp",
"filetype": "directory",
"label": "pop-rock",
"type": "unknown"
},
{
"file": "special://profile/playlists/music/Queue.m3u",
"filetype": "directory",
"label": "Queue.m3u",
"type": "unknown"
},
{
"file": "special://profile/playlists/music/rhythmbox/",
"filetype": "directory",
"label": "rhythmbox",
"type": "unknown"
},
{
"file": "special://profile/playlists/music/salsa.xsp",
"filetype": "directory",
"label": "salsa",
"type": "unknown"
},
{
"file": "special://profile/playlists/music/test/",
"filetype": "directory",
"label": "test",
"type": "unknown"
}
],
"limits": {
"end": 7,
"start": 0,
"total": 7
}
}
}
Montellese Wrote:Yeah that's intended and correct because to XBMC a smartplaylist is a directory/node containing items (e.g. movies, episodes, albums, songs, ...). So you pass one of those paths to an XSP to Files.GetDirectory and specify the matching "media" parameter ("music" in the above example) and you will get a list of all items contained in that playlist. You can even retrieve all the properties you'd get from AudioLibrary.GetFoo if you specify them in the "properties" parameter.