[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,13 +1813,22 @@ class CollectionBuilder:
else: else:
valid_list.append(search_choices[str(value).lower()]) valid_list.append(search_choices[str(value).lower()])
else: else:
error = f"Plex Error: {attribute}: {value} not found" actor_id = None
if self.details["show_options"]: if attribute in ["actor", "director", "producer", "writer"]:
error += f"\nOptions: {names}" actor_id = self.library.get_actor_id(value)
if validate: if actor_id:
raise Failed(error) if pairs:
else: valid_list.append((value, actor_id))
logger.error(error) 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}"
if validate:
raise Failed(error)
else:
logger.error(error)
return valid_list return valid_list
elif attribute in plex.date_attributes and modifier in [".before", ".after"]: elif attribute in plex.date_attributes and modifier in [".before", ".after"]:
if data == "today": if data == "today":

@ -8,6 +8,7 @@ from plexapi import utils
from plexapi.audio import Artist, Track, Album from plexapi.audio import Artist, Track, Album
from plexapi.exceptions import BadRequest, NotFound, Unauthorized from plexapi.exceptions import BadRequest, NotFound, Unauthorized
from plexapi.collection import Collection from plexapi.collection import Collection
from plexapi.library import Actor
from plexapi.playlist import Playlist from plexapi.playlist import Playlist
from plexapi.server import PlexServer from plexapi.server import PlexServer
from plexapi.video import Movie, Show, Season, Episode from plexapi.video import Movie, Show, Season, Episode
@ -568,6 +569,13 @@ class Plex(Library):
item.uploadPoster(filepath=image) item.uploadPoster(filepath=image)
self.reload(item) 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) @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): def get_search_choices(self, search_name, title=True):
final_search = search_translation[search_name] if search_name in search_translation else search_name final_search = search_translation[search_name] if search_name in search_translation else search_name

Loading…
Cancel
Save