mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-10 15:04:21 +00:00
added crew to plex_search
This commit is contained in:
parent
c33852dc43
commit
7f07bd22c9
2 changed files with 41 additions and 15 deletions
|
@ -536,18 +536,25 @@ class CollectionBuilder:
|
||||||
results_list = [(t, t) for t in util.get_list(smart_data, split=False)]
|
results_list = [(t, t) for t in util.get_list(smart_data, split=False)]
|
||||||
elif smart in plex.tags and smart_mod in ["", ".not", ".begins", ".ends"]:
|
elif smart in plex.tags and smart_mod in ["", ".not", ".begins", ".ends"]:
|
||||||
if smart_final in plex.tmdb_searches:
|
if smart_final in plex.tmdb_searches:
|
||||||
final_tmdb_values = []
|
smart_values = []
|
||||||
for tmdb_value in util.get_list(smart_data):
|
for tmdb_value in util.get_list(smart_data):
|
||||||
if tmdb_value.lower() == "tmdb" and "tmdb_person" in self.details:
|
if tmdb_value.lower() == "tmdb" and "tmdb_person" in self.details:
|
||||||
for tmdb_name in self.details["tmdb_person"]:
|
for tmdb_name in self.details["tmdb_person"]:
|
||||||
final_tmdb_values.append(tmdb_name)
|
smart_values.append(tmdb_name)
|
||||||
else:
|
else:
|
||||||
final_tmdb_values.append(tmdb_value)
|
smart_values.append(tmdb_value)
|
||||||
elif smart == "studio":
|
elif smart == "studio":
|
||||||
final_tmdb_values = util.get_list(smart_data, split=False)
|
smart_values = util.get_list(smart_data, split=False)
|
||||||
else:
|
else:
|
||||||
final_tmdb_values = util.get_list(smart_data)
|
smart_values = util.get_list(smart_data)
|
||||||
results_list = self.library.validate_search_list(final_tmdb_values, smart, title=False, pairs=True)
|
if smart == "crew":
|
||||||
|
results_list = []
|
||||||
|
for c_type in ["actor", "director", "producer", "writer"]:
|
||||||
|
results_list.extend(self.library.validate_search_list(smart_values, c_type, title=False, pairs=True, fail=False))
|
||||||
|
if len(results_list) == 0:
|
||||||
|
raise Failed(f"Plex Error: crew: {final_values} not found")
|
||||||
|
else:
|
||||||
|
results_list = self.library.validate_search_list(smart_values, smart, title=False, pairs=True)
|
||||||
elif smart in ["decade", "year", "episode_year"] and smart_mod in ["", ".not"]:
|
elif smart in ["decade", "year", "episode_year"] and smart_mod in ["", ".not"]:
|
||||||
results_list = [(y, y) for y in util.get_year_list(smart_data, current_year, smart_final)]
|
results_list = [(y, y) for y in util.get_year_list(smart_data, current_year, smart_final)]
|
||||||
else:
|
else:
|
||||||
|
@ -776,11 +783,18 @@ class CollectionBuilder:
|
||||||
else:
|
else:
|
||||||
final_values = method_data
|
final_values = method_data
|
||||||
search = os.path.splitext(method_name)[0]
|
search = os.path.splitext(method_name)[0]
|
||||||
valid_values = self.library.validate_search_list(final_values, search)
|
if search == "crew":
|
||||||
|
valid_methods = []
|
||||||
|
for crew_type in ["actor", "director", "producer", "writer"]:
|
||||||
|
valid_values = self.library.validate_search_list(final_values, crew_type, fail=False)
|
||||||
if len(valid_values) > 0:
|
if len(valid_values) > 0:
|
||||||
self.methods.append(("plex_search", [{method_name: valid_values}]))
|
valid_methods.append(("plex_search", [{crew_type: valid_values}]))
|
||||||
|
if len(valid_methods) > 0:
|
||||||
|
self.methods.extend(valid_methods)
|
||||||
else:
|
else:
|
||||||
logger.warning(f"Collection Warning: No valid {search} values found in {final_values}")
|
raise Failed(f"Plex Error: crew: {method_data} not found")
|
||||||
|
else:
|
||||||
|
self.methods.append(("plex_search", [{method_name: self.library.validate_search_list(final_values, search)}]))
|
||||||
elif method_name == "plex_all":
|
elif method_name == "plex_all":
|
||||||
self.methods.append((method_name, [""]))
|
self.methods.append((method_name, [""]))
|
||||||
elif method_name == "plex_collection":
|
elif method_name == "plex_collection":
|
||||||
|
@ -940,11 +954,18 @@ class CollectionBuilder:
|
||||||
final_values.append(value)
|
final_values.append(value)
|
||||||
else:
|
else:
|
||||||
final_values = util.get_list(search_data)
|
final_values = util.get_list(search_data)
|
||||||
valid_values = self.library.validate_search_list(final_values, search)
|
if search == "crew":
|
||||||
if valid_values:
|
valid_methods = []
|
||||||
searches[search_final] = valid_values
|
for crew_type in ["actor", "director", "producer", "writer"]:
|
||||||
|
valid_values = self.library.validate_search_list(final_values, crew_type, fail=False)
|
||||||
|
if len(valid_values) > 0:
|
||||||
|
valid_methods.append(("plex_search", [{crew_type: valid_values}]))
|
||||||
|
if len(valid_methods) > 0:
|
||||||
|
self.methods.extend(valid_methods)
|
||||||
else:
|
else:
|
||||||
logger.warning(f"Collection Warning: No valid {search} values found in {final_values}")
|
raise Failed(f"Plex Error: crew: {final_values} not found")
|
||||||
|
else:
|
||||||
|
searches[search_final] = self.library.validate_search_list(final_values, search)
|
||||||
elif search == "year" and modifier in [".gt", ".gte", ".lt", ".lte"]:
|
elif search == "year" and modifier in [".gt", ".gte", ".lt", ".lte"]:
|
||||||
searches[search_final] = util.check_year(search_data, current_year, search_final)
|
searches[search_final] = util.check_year(search_data, current_year, search_final)
|
||||||
elif search in ["added", "originally_available"] and modifier in [".before", ".after"]:
|
elif search in ["added", "originally_available"] and modifier in [".before", ".after"]:
|
||||||
|
|
|
@ -82,6 +82,7 @@ searches = [
|
||||||
"actor", "actor.and", "actor.not",
|
"actor", "actor.and", "actor.not",
|
||||||
"audio_language", "audio_language.and", "audio_language.not",
|
"audio_language", "audio_language.and", "audio_language.not",
|
||||||
"collection", "collection.and", "collection.not",
|
"collection", "collection.and", "collection.not",
|
||||||
|
"crew",
|
||||||
"content_rating", "content_rating.and", "content_rating.not",
|
"content_rating", "content_rating.and", "content_rating.not",
|
||||||
"country", "country.and", "country.not",
|
"country", "country.and", "country.not",
|
||||||
"director", "director.and", "director.not",
|
"director", "director.and", "director.not",
|
||||||
|
@ -114,6 +115,7 @@ show_only_searches = [
|
||||||
]
|
]
|
||||||
tmdb_searches = [
|
tmdb_searches = [
|
||||||
"actor", "actor.and", "actor.not",
|
"actor", "actor.and", "actor.not",
|
||||||
|
"crew",
|
||||||
"director", "director.and", "director.not",
|
"director", "director.and", "director.not",
|
||||||
"producer", "producer.and", "producer.not",
|
"producer", "producer.and", "producer.not",
|
||||||
"writer", "writer.and", "writer.not"
|
"writer", "writer.and", "writer.not"
|
||||||
|
@ -157,6 +159,7 @@ tags = [
|
||||||
"collection",
|
"collection",
|
||||||
"content_rating",
|
"content_rating",
|
||||||
"country",
|
"country",
|
||||||
|
"crew",
|
||||||
"director",
|
"director",
|
||||||
"genre",
|
"genre",
|
||||||
"label",
|
"label",
|
||||||
|
@ -473,7 +476,7 @@ class PlexAPI:
|
||||||
smart_filter = self.get_collection(collection)._data.attrib.get('content')
|
smart_filter = self.get_collection(collection)._data.attrib.get('content')
|
||||||
return smart_filter[smart_filter.index("?"):]
|
return smart_filter[smart_filter.index("?"):]
|
||||||
|
|
||||||
def validate_search_list(self, data, search_name, title=True, pairs=False):
|
def validate_search_list(self, data, search_name, title=True, pairs=False, fail=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
|
||||||
search_choices = self.get_search_choices(final_search, title=title)
|
search_choices = self.get_search_choices(final_search, title=title)
|
||||||
valid_list = []
|
valid_list = []
|
||||||
|
@ -483,6 +486,8 @@ class PlexAPI:
|
||||||
valid_list.append((value, search_choices[str(value).lower()]))
|
valid_list.append((value, search_choices[str(value).lower()]))
|
||||||
else:
|
else:
|
||||||
valid_list.append(search_choices[str(value).lower()])
|
valid_list.append(search_choices[str(value).lower()])
|
||||||
|
elif fail:
|
||||||
|
raise Failed(f"Plex Error: {search_name}: {value} not found")
|
||||||
else:
|
else:
|
||||||
logger.error(f"Plex Error: {search_name}: {value} not found")
|
logger.error(f"Plex Error: {search_name}: {value} not found")
|
||||||
return valid_list
|
return valid_list
|
||||||
|
|
Loading…
Reference in a new issue