[9] #667 Allow other actors in filters

pull/847/head
meisnate12 3 years ago
parent 3ad0e79c9a
commit 4dfbabf679

@ -1 +1 @@
1.16.3-develop8
1.16.3-develop9

@ -1813,6 +1813,15 @@ class CollectionBuilder:
else:
valid_list.append(search_choices[str(value).lower()])
else:
actor_id = None
if attribute in ["actor", "director", "producer", "writer"]:
actor_id = self.library.get_actor_id(value)
if actor_id:
if pairs:
valid_list.append((value, actor_id))
else:
valid_list.append(actor_id)
if not actor_id:
error = f"Plex Error: {attribute}: {value} not found"
if self.details["show_options"]:
error += f"\nOptions: {names}"

@ -8,6 +8,7 @@ from plexapi import utils
from plexapi.audio import Artist, Track, Album
from plexapi.exceptions import BadRequest, NotFound, Unauthorized
from plexapi.collection import Collection
from plexapi.library import Actor
from plexapi.playlist import Playlist
from plexapi.server import PlexServer
from plexapi.video import Movie, Show, Season, Episode
@ -568,6 +569,13 @@ class Plex(Library):
item.uploadPoster(filepath=image)
self.reload(item)
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_failed)
def get_actor_id(self, name):
results = self.Plex.hubSearch(name)
for result in results:
if isinstance(result, Actor) and result.librarySectionID == self.Plex.key and result.tag == name:
return result.id
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_failed)
def get_search_choices(self, search_name, title=True):
final_search = search_translation[search_name] if search_name in search_translation else search_name

Loading…
Cancel
Save