Kodi Community Forum
VideoLibrary.GetMovies filter? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+---- Forum: JSON-RPC (https://forum.kodi.tv/forumdisplay.php?fid=174)
+---- Thread: VideoLibrary.GetMovies filter? (/showthread.php?tid=171843)

Pages: 1 2


VideoLibrary.GetMovies filter? - ScottyDoo - 2013-08-22

Hi,

I'm new to all this so sorry if its a dumb question but how do you use the filter on VideoLibrary.GetMovies? an example would be great

Thanks


RE: VideoLibrary.GetMovies filter? - MokuJinJin - 2013-08-24

Hi,

i've you tried this :
Code:
"filter" : ["year" : "2010", "tag" : "MyTag"]

As i understand, "filter" is an array with specific parameters as 'year' or 'tag'.

To see all parameters : Wiki, and expand JSON Schema Description


RE: VideoLibrary.GetMovies filter? - ScottyDoo - 2013-08-27

Thanks

So you cant just filter by name? I need to create tags and filter by those?


RE: VideoLibrary.GetMovies filter? - MokuJinJin - 2013-08-27

Apparently you can't filter by title. It would be great by the way : VideoLibrary.GetMovies 'StarWars'

Tags may be a solution to categorize/organize your movies, and then use it as filter.

If you want to retreive a single movie, only knowing his title, you may have to do it in two times.
  1. First retrieve all movies (VideoLibrary.GetMovies)
  2. search in that list the movie's title to get the movieid you search
  3. and then get detail information (VideoLibrary.GetMovieDetails)

I've not deeply searched it, so i may be mistaken.

After all i'm maybe as new as you are, i'm just a developper trying to help.


RE: VideoLibrary.GetMovies filter? - Montellese - 2013-08-27

You can use advanced filtering in VideoLibrary.GetMovies but it's a bit complicated. IIRC there are a few example requests floating around in the JSON-RPC part of the forum.


RE: VideoLibrary.GetMovies filter? - Milhouse - 2013-08-27

(2013-08-27, 13:25)MokuJinJin Wrote: Apparently you can't filter by title. It would be great by the way : VideoLibrary.GetMovies 'StarWars'

Actually you can:

Code:
{"jsonrpc": "2.0", "params": {"sort": {"order": "ascending", "method": "title"}, "filter": {"operator": "contains", "field": "title", "value": "Star Wars"}, "properties": ["title", "art", "file"]}, "method": "VideoLibrary.GetMovies", "id": "libMovies"}

And an example combining two filters to find only Star Wars movies IV through VI (substitute a tag of "EmbarassinglyAwful" to find I through III):

Code:
{"jsonrpc": "2.0", "params": {"sort": {"order": "ascending", "method": "title"}, "filter": {"and": [{"operator": "contains", "field": "title", "value": "Star Wars"}, {"operator": "contains", "field": "tag", "value": "Good"}]}, "properties": ["title", "art"]}, "method": "VideoLibrary.GetMovies", "id": "libTags"}



RE: VideoLibrary.GetMovies filter? - MokuJinJin - 2013-08-28

There is no documentation of this 'wonderfull' filter Blush

thank you very much for this well illustrated exemple MilhouseVH.


RE: VideoLibrary.GetMovies filter? - ScottyDoo - 2013-08-28

(2013-08-28, 01:17)MokuJinJin Wrote: There is no documentation of this 'wonderfull' filter Blush

thank you very much for this well illustrated exemple MilhouseVH.

I 2nd that, This is exactly what I wanted Many Thanks Big Grin


RE: VideoLibrary.GetMovies filter? - jitterjames - 2014-07-27

Yes. Very helpful. Thanks!


RE: VideoLibrary.GetMovies filter? - hernandito - 2015-01-05

(2013-08-27, 22:46)Milhouse Wrote: Actually you can:

Code:
{"jsonrpc": "2.0", "params": {"sort": {"order": "ascending", "method": "title"}, "filter": {"operator": "contains", "field": "title", "value": "Star Wars"}, "properties": ["title", "art", "file"]}, "method": "VideoLibrary.GetMovies", "id": "libMovies"}

And an example combining two filters to find only Star Wars movies IV through VI (substitute a tag of "EmbarassinglyAwful" to find I through III):

Code:
{"jsonrpc": "2.0", "params": {"sort": {"order": "ascending", "method": "title"}, "filter": {"and": [{"operator": "contains", "field": "title", "value": "Star Wars"}, {"operator": "contains", "field": "tag", "value": "Good"}]}, "properties": ["title", "art"]}, "method": "VideoLibrary.GetMovies", "id": "libTags"}


I need a little newbie help on the above.... I want to create a web page where I click on a button to filter my movie titles by the first letter of the title (excluding articles). I would have a button for all the letters in alphabet..... I need help on the filter section for what the operator and values are.

"filter": {"operator": "contains", "field": "title", "value": "S or s"}

Many thanks,

H.


RE: VideoLibrary.GetMovies filter? - Milhouse - 2015-01-05

The filter isn't case-sensitive so "value": "S" will suffice and find titles starting with both uppercase and lowercase S.


RE: VideoLibrary.GetMovies filter? - hernandito - 2015-01-06

(2015-01-05, 22:14)Milhouse Wrote: The filter isn't case-sensitive so "value": "S" will suffice and find titles starting with both uppercase and lowercase S.

Thank you Millhouse. So far I have the following working....

Code:
/jsonrpc?request={"jsonrpc": "2.0", "params": {"sort": {"order": "ascending", "method": "title", "ignorearticle": true}, "filter":{"operator": "startswith", "field": "title", "value": "f"}, "properties": ["title", "thumbnail", "imdbnumber", "year", "plot", "rating"]}, "method": "VideoLibrary.GetMovies", "id": "libMovies"}

It is filtering for fovies starting with the letter "f". But If I have a movie called "The Fall", it will NOT show up on my results. In essence the ignorearticle thing is not really doing anything. Is there a way to have the filter display The Fall movie?

Thank you for your help!!

H.


RE: VideoLibrary.GetMovies filter? - Milhouse - 2015-01-06

(2015-01-06, 00:29)hernandito Wrote: Thank you Millhouse. So far I have the following working....

Code:
/jsonrpc?request={"jsonrpc": "2.0", "params": {"sort": {"order": "ascending", "method": "title", "ignorearticle": true}, "filter":{"operator": "startswith", "field": "title", "value": "f"}, "properties": ["title", "thumbnail", "imdbnumber", "year", "plot", "rating"]}, "method": "VideoLibrary.GetMovies", "id": "libMovies"}

It is filtering for fovies starting with the letter "f". But If I have a movie called "The Fall", it will NOT show up on my results. In essence the ignorearticle thing is not really doing anything. Is there a way to have the filter display The Fall movie?

Thank you for your help!!

H.

I don't think that's possible. "ignorearticle" is a property of the sort, not the filter.


RE: VideoLibrary.GetMovies filter? - hernandito - 2015-01-06

(2015-01-06, 00:40)Milhouse Wrote: I don't think that's possible. "ignorearticle" is a property of the sort, not the filter.

Thank you Millhouse. I really appreciate your help.

I think I am able to do this by following your example above using combined "OR" operations like:

Code:
jsonrpc?request={"jsonrpc": "2.0", "params": {"filter": {"or": [{"operator": "startswith", "field": "title", "value": "f"}, {"operator": "startswith", "field": "title", "value": "The f"}]}, "sort": {"order": "ascending", "method": "title", "ignorearticle": true}, "properties": ["title", "thumbnail", "imdbnumber", "year", "plot", "rating"]}, "method": "VideoLibrary.GetMovies", "id": "libMovies"}

Can you anticipate any issues with this? I would never have figured this out without your reply to the original post.

Thanks again,

H.


RE: VideoLibrary.GetMovies filter? - Milhouse - 2015-01-06

(2015-01-06, 03:54)hernandito Wrote: Can you anticipate any issues with this? I would never have figured this out without your reply to the original post.

Only that it is a very language specific solution, ie, works only for languages such as English where "The" is only article, which is totally fine if this is only for personal use.

You can view what is considered to be an article in each language by viewing the langinfo.xml file and searching for "<tokens>". Most languages either have no article or only "The", but some languages, ie. Spanish, have several variations (The, El, Los, La, Las, Un), while Belarusian/Russian/Ukranian have 18 variations! This would make your solution more or less impractical for these languages. But for languages with only "The", it's fine.

Definite article (<token>) counts by language:
Code:
18 Belarusian
18 Russian
18 Ukrainian
10 Italian
9 Catalan
7 French
7 French (Canada)
6 Spanish
6 Spanish (Argentina)
5 Portuguese
5 Spanish (Mexico)
4 Dutch
4 German
4 Slovenian
3 Hungarian
1 Burmese
1 Czech
1 Danish
1 English
1 English (Australia)
1 English (New Zealand)
1 English (US)
1 Estonian
1 Faroese
1 Finnish
1 Icelandic
1 Japanese
1 Latvian
1 Maori
1 Norwegian
1 Romanian
1 Swedish
1 Thai
1 Welsh