-
Notifications
You must be signed in to change notification settings - Fork 200
Fix and update library searching #693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix and update library searching #693
Conversation
saw this and started playing with the update to see what it could do and when I try this: ps = PlexServer("http://IP.IP.IP.IP:32400", "thisisnotmytoken", timeout=600)
plex = next((s for s in ps.library.sections() if s.title == "TV Shows"), None)
items = plex.search(**{"genre": "Comedy"})
print(items) i get the error
if I change also, I tried specifying the |
Try it now. Let me know if you find any other errors. |
ok it works now I'm working on an update for my program for once this comes out if I find anything else I'll let you know |
ok so now im trying to use the ps = PlexServer("http://IP.IP.IP.IP:32400", "thisisnotmytoken", timeout=600)
plex = next((s for s in ps.library.sections() if s.title == "Movies"), None)
print(len(plex.search(**{"genre": "Comedy"})))
print(len(plex.search(**{"genre": "Action"})))
print(len(plex.search(**{"genre": ["Comedy", "Action"]})))
print(len(plex.search(**{"genre&": ["Comedy", "Action"]})))
print(len(plex.search(**{"genre": "Comedy", "genre&": ["Action"]}))) with the results:
it seems to me that the |
Fixed the |
Fixes pushingkarmaorg#694 When using a PlexAPI operator, fetchItems may return zero results in the first container causing the loop to break early. This changes the break condition to check if the container exceeds the total number of items therefore there will be no more items to fetch.
Fixes pushingkarmaorg#695 totalSize was getting overwritten when using search with a different libtype. This makes totalSize independant from search.
|
I cannot reproduce the issue. >>> movies = plex.library.section("Movies")
>>> len(movies.all())
1937
>>> duration = 5400000 # 1.5 hours in milliseconds
>>> len(movies.search(**{"duration<<": duration}))
288
>>> len(movies.search(**{"duration>>": duration}))
1649 |
ok yea that ones my mess up it does work sorry |
This looks awesome. Great work! |
Thanks for all these changes. I noticed that your change to split Furthermore I noticed that you changed all library section IDs from |
Thanks. See #712. |
I was trying to do a title search using a list like so print(len(plex.search(**{"title": "Star"}))) # Worked returned 32
print(len(plex.search(**{"title": "Wars"}))) # Worked returned 16
print(len(plex.search(**{"title": ["Wars"]}))) # Failed returned 0
print(len(plex.search(**{"title": ["Star", "Wars"]}))) # Failed returned 0
print(len(plex.search(**{"title&": ["Star", "Wars"]}))) # Worked returned 13 and while getting the correct results for some searches, using a list with title results in 0 items returned. Is there any way to do an OR title search? If not could it be added in? I tried similar tests with the other string I'm using, which is studio, and it was able to or together values ok |
That's a bug I missed because This should be a workaround for title plex.search(title="Star,Wars") |
Description
This is a complete rewrite of the library search feature. See doc string for
LibrarySection.search()
for complete details and examples.Deprecated methods
LibrarySection.filterFields()
: uselistFields()
instead.LibrarySection.listChoices()
: uselistFilterChoices()
instead.New methods
See doc strings for each method for complete details and examples.
LibrarySection.filterTypes()
LibrarySection.getFilterType()
LibrarySection.fieldTypes()
LibrarySection.getFieldType()
LibrarySection.listFilters()
LibrarySection.listSorts()
LibrarySection.listFields()
LibrarySection.listOperators()
LibrarySection.listFilterChoices()
LibrarySection.hubSearch()
: alias forPlexServer.search(query, sectionId=librarySectionID)
MovieSection.searchMovies()
: alias forLibrarySection.search(libtype='movie')
ShowSection.searchSeasons()
: alias forLibrarySection.search(libtype='season')
Breaking changes
librarySectionID
is casted to anint
everywhere instead of astr
LibrarySection.filters
is casted to abool
instead of astr
LibrarySection.key
is casted to aint
instead of astr
Closes #598
Fixes #320
Fixes #392
Fixes #553
Fixes #595
Fixes #623
Fixes #691
Fixes #694
Fixes #695
Type of change
Please delete options that are not relevant.
Checklist: