0

I am working with XBMC. I have installed XBMC in my system(Windows 7, 32 bit). Xbmc is working fine in my system. I have developed an application in order to control the Xbmc remotely from Ipad. In order to retrieve the music files or video files from Xbmc, I am unable to. By searching the forums of xbmc, I found that we can write an sql query to get them out. But, the thing is I am unable to make out where the database is located in my system. Someone help me out where I can find it.

Regards, Sushma.

sushma
  • 333
  • 1
  • 4
  • 13

1 Answers1

3

The database itself

By default the location of the database is that described on the wiki page XBMC databases but the actual location can be changed by the user, or a different database technology can be used entirely.

The settings that would affect this are located in advancedsettings.xml.

But in general it is advised by the XBMC developers to never access the database directly.

JSONRPC

In order to help with interacting with the database XBMC has supported the JSONRPC queries, the one downside of these is that XBMC needs to be running at the time to respond to these queries. The major advantage is that it XBMC will find the database for you and expose access to it with a common interface.

JSONRPC support was first added to XBMC in "Darhma" (v10), became really useful in "Eden" (v11) and will support almost everything possible in "Frodo" (v12). Information about the use of JSONRPC can be found in the wiki.

An example

In this example I'm assuming that you are targeting "Eden", the current stable release of XBMC. Also I have formatted the following with new lines, these are not required and are not present in the response from XBMC.

Request

If you were to use JSONRPC the request you would need to send would look something like:

{
  "jsonrpc": "2.0",
  "method": "VideoLibrary.GetMovies",
  "params": {
    "properties": [
      "title",
      "year",
      "file"
    ],
    "limits": {
      "start": 0,
      "end": 2
    }
  },
  "id": 1
}

Note: If you wanted different information about each movie you could use other properties listed here. *Note: You probably want to omit the "limits" part to get all movies.*

Responce

The response to this would be something like:

{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "limits": {
      "end": 2,
      "start": 0,
      "total": 47
    },
    "movies": [
      {
        "label": "Label for movie",
        "movieid": 1,
        "title": "Title of movie",
        "year": 2012
      },
      {
        "label": "Label for another movie",
        "movieid": 2,
        "title": "Title of another movie",
        "year": 2010
      },
      {
        "label": "Label for a third movie",
        "movieid": 3,
        "title": "Title of a third movie",
        "year": 2012
      }
    ]
  }
}

What to do now?

You have a choice at this point, you can either:

  1. Add "file" to the list of properties, this will return the "file" property, the location of the video file.
  2. Use JSONRPC to tell xbmc to play a movie.

    Using this method is best when you don't want to play the file locally (on the iPad) but instead on XBMC.

Playing a movie on XBMC via JSONRPC

This is quite simple, use the "movieid" you received earlier in the following request:

{
  "jsonrpc": "2.0",
  "method": "Player.Open",
  "params": {
    "item": {
      "movieid": 2
    }
  },
  "id": 1
}

Lastly I would note that there are equivalent commands for TV episodes as shown for movies.

Othrayte
  • 637
  • 6
  • 18