Skip to content

libtype not handled properly for ShowSection search with kwargs #623

@mikethecalamity

Description

@mikethecalamity

I was trying to run the following:

shows = plex.library.section('Shows')
for show in shows.searchShows(unwatchedLeaves = True):
    print(show.title)

and I receive the following error:

    for show in shows.searchShows(unwatchedLeaves = True):
  File "C:\Program Files\Python36\lib\site-packages\plexapi\library.py", line 907, in searchShows
    return self.search(libtype='show', **kwargs)
  File "C:\Program Files\Python36\lib\site-packages\plexapi\library.py", line 669, in search
    args[category] = self._cleanSearchFilter(category, value, libtype)
  File "C:\Program Files\Python36\lib\site-packages\plexapi\library.py", line 717, in _cleanSearchFilter
    raise BadRequest('Unknown filter category: %s' % category)
plexapi.exceptions.BadRequest: Unknown filter category: unwatchedLeaves

When I delved into the code I saw:
https://github.com/pkkid/python-plexapi/blob/master/plexapi/library.py#L718-723

categories = [x.key for x in self.filterFields()]
...
elif category not in categories

And it looks like at this point, based on the key values of .filterFields() the category has to be show.unwatchedLeaves to not throw an error. I also tried making that my kwarg (shows.searchShows(show.unwatchedLeaves = True) but python did not like that at all.

It seems like the libtype needs to be appended on the front of the category at some point?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions