GetMovieDetails – A little help on how to get this API call to work?

Hello,

I’m almost certainly missing something basic and when someone clues me in, I’ll no doubt smack myself on the forehead.

I wrote a python script many years ago which works with XBMC (prior to the rebrand to Kodi). The script used the GetMovieDetails API call and continued to work after the switch from XBMC to Kodi. At some point this stopped working (I can’t recall exactly which version of Kodi) and I never really fixed it was only something I was working on and never completely finished, but figured it was time to. However I’m struggling to do so since the API has changed (again, I’m sure i’m overlooking the obvious, please be kind!).

Originally I used the following code (where movieID is the id of the movie in the SQL database i.e. 51)

Code:
xbmc_json_rpc_url = "http://username:password@localhost:8080/jsonrpc"

payload = {"jsonrpc": "2.0", "method": "VideoLibrary.GetMovieDetails", "params": {"properties": ["mpaa","tagline"], "movieid": int(movieID)}, "id": "1"}
url_param = urllib.parse.urlencode({'request': json.dumps(payload)})

response = requests.get(xbmc_json_rpc_url + '?' + url_param, headers=headers)

Looking at http://kodi.wiki/view/JSON-RPC_API/v6#Vi…vieDetails, the JSON request body has changed since I last used it, but I can’t figure out how to get it working again even in a basic form and was hoping for help.

On this page the schema is

Code:
{
  "params": [
    {
      "$ref": "Library.Id",
      "name": "movieid",
      "required": True
    },
    {
      "$ref": "Video.Fields.Movie",
      "name": "properties"
    }
  ],
  "description": "Retrieve details about a specific movie",
  "returns": {
    "properties": {
      "moviedetails": {
        "$ref": "Video.Details.Movie"
      }
    },
    "type": "object"
  }
}

It also mentioned the parameters are

Quote:
Library.Id movieid
[ Video.Fields.Movie properties ]

So for example if I wanted to obtain the details for a movie with an ID “51”, I thought it would be the case that I need to create the following (where the Library.Id has been substituted for the movieID):

Code:
payload = {"jsonrpc": "2.0", "method": "VideoLibrary.GetMovieDetails", \
            "params": [\
             {\
             "$ref": 51,\
             "name": "movieid",\
             "required": True
             },\
             {\
             "$ref": "Video.Fields.Movie",\
             "name":"properties"\
             }\
            ],\
            "description":"Retrieve the details about a specific movie",\
            "returns":{\
             "properties":{\
              "moviedetails":{\
               "$ref":"Video.Details.Movie"\
              }\
             },\
            "type":"object"\
            }\
            }

Using a logger object in python, this produces the json below, which is then used as a request body to http://username:password@localhost:8080/jsonrpc (as shown in the original code).

Code:
{
    "params": [
        {
            "name": "movieid",
            "$ref": 51,
            "required": true
        },
        {
            "name": "properties",
            "$ref": "Video.Fields.Movie"
        }
    ],
    "description": "Retrieve the details about a specific movie",
    "returns": {
        "type": "object",
        "properties": {
            "moviedetails": {
                "$ref": "Video.Details.Movie"
            }
        }
    },
    "jsonrpc": "2.0",
    "method": "VideoLibrary.GetMovieDetails"
}

When I do this, I only seem to get a hang up on the python script. No data or error codes being returned from Kodi or an indication of what’s happening.

Could anyone shed any light on this?
Could anyone provide me with a basic GetMovieDetails example in case that helps?

Any help would be greatly appreciated. Thanks in advance!