Filter usting 'contains' clause like % in databases
#1
Hello,
I realized a plugin that show a movie list by actor/actress name.

But now I must write full actor name like 'Morgan Freeman'.
I would to know if it is possible seach with a partial string i.e using 'Freeman' or 'Free'.

It is possible to do this using rpc/json?
Do you know the syntax or point me to a right documentation?

Thanks
Reply
#2
List.Filter.Operators
Type: string
JSON Schema Description

json:
{
  "default": "contains",
  "enums": [
    "contains",
    "doesnotcontain",
    "is",
    "isnot",
    "startswith",
    "endswith",
    "greaterthan",
    "lessthan",
    "after",
    "before",
    "inthelast",
    "notinthelast",
    "true",
    "false",
    "between"
  ],
  "type": "string",
  "id": "List.Filter.Operators"
}

https://kodi.wiki/view/JSON-RPC_API/v13
Reply
#3
This Is a Little bit strange.
This Is the relevant part of the call:

Quote:params = {"sort": {"order": "ascending", "method": "year", "ignorearticle": True},
"filter": {"actor": "%s" % actor}}

self.sendKodiRequest("VideoLibrary.GetMovies", params)

but if the default value is "contains" it could work fine. But It isn't.

Is not so clear for me how I have to change parameter value in order ti reach my goal.
Reply
#4
Try
json:
params = {"sort": {"order": "ascending", "method": "year", "ignorearticle": True},
"filter": {"operator":"contains", "field":"actor", "value":"%s"}}

scott s.
.
Reply
#5
Thank you Scott. It appears very simple but log said:
Quote:Error Type: <class 'AttributeError'>
Error Contents: 'NoneType' object has no attribute 'get'

If I restore old parameter, it works fine again.
So, I think this is not the right way. I have to study a little bit more but if someone has a suggestion...
Reply
#6
I solved! Please ignore previous response.
In my code I inserted other operator.
Changing it to 'contains' works fine.

Thank you.
Reply

Logout Mark Read Team Forum Stats Members Help
Filter usting 'contains' clause like % in databases0