|
|
@ -23,13 +23,13 @@ auto = {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
auto_type_translation = {"content_rating": "contentRating", "subtitle_language": "subtitleLanguage", "audio_language": "audioLanguage"}
|
|
|
|
auto_type_translation = {"content_rating": "contentRating", "subtitle_language": "subtitleLanguage", "audio_language": "audioLanguage"}
|
|
|
|
default_templates = {
|
|
|
|
default_templates = {
|
|
|
|
"original_language": {"plex_all": True, "filters": {"original_language": "<<original_language>>"}},
|
|
|
|
"original_language": {"plex_all": True, "filters": {"original_language": "<<value>>"}},
|
|
|
|
"origin_country": {"plex_all": True, "filters": {"origin_country": "<<origin_country>>"}},
|
|
|
|
"origin_country": {"plex_all": True, "filters": {"origin_country": "<<value>>"}},
|
|
|
|
"tmdb_collection": {"tmdb_collection_details": "<<tmdb_collection>>", "minimum_items": 2},
|
|
|
|
"tmdb_collection": {"tmdb_collection_details": "<<value>>", "minimum_items": 2},
|
|
|
|
"trakt_user_lists": {"trakt_list_details": "<<trakt_user_lists>>"},
|
|
|
|
"trakt_user_lists": {"trakt_list_details": "<<value>>"},
|
|
|
|
"trakt_liked_lists": {"trakt_list_details": "<<trakt_liked_lists>>"},
|
|
|
|
"trakt_liked_lists": {"trakt_list_details": "<<value>>"},
|
|
|
|
"tmdb_popular_people": {"tmdb_person": f"<<tmdb_popular_people>>", "plex_search": {"all": {"actor": "tmdb"}}},
|
|
|
|
"tmdb_popular_people": {"tmdb_person": f"<<value>>", "plex_search": {"all": {"actor": "tmdb"}}},
|
|
|
|
"trakt_people_list": {"tmdb_person": f"<<trakt_people_list>>", "plex_search": {"all": {"actor": "tmdb"}}}
|
|
|
|
"trakt_people_list": {"tmdb_person": f"<<value>>", "plex_search": {"all": {"actor": "tmdb"}}}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def get_dict(attribute, attr_data, check_list=None):
|
|
|
|
def get_dict(attribute, attr_data, check_list=None):
|
|
|
@ -285,7 +285,25 @@ class MetadataFile(DataFile):
|
|
|
|
all_keys.append(ck)
|
|
|
|
all_keys.append(ck)
|
|
|
|
if ck not in exclude and cv not in exclude:
|
|
|
|
if ck not in exclude and cv not in exclude:
|
|
|
|
auto_list[ck] = cv
|
|
|
|
auto_list[ck] = cv
|
|
|
|
if auto_type in ["genre", "mood", "style", "country", "studio", "network", "year", "decade", "content_rating", "subtitle_language", "audio_language", "resolution"]:
|
|
|
|
if auto_type == "decade" and library.is_show:
|
|
|
|
|
|
|
|
all_items = library.get_all()
|
|
|
|
|
|
|
|
if addons:
|
|
|
|
|
|
|
|
raise Failed(f"Config Error: addons cannot be used with show decades")
|
|
|
|
|
|
|
|
addons = {}
|
|
|
|
|
|
|
|
all_keys = []
|
|
|
|
|
|
|
|
for i, item in enumerate(all_items, 1):
|
|
|
|
|
|
|
|
logger.ghost(f"Processing: {i}/{len(all_items)} {item.title}")
|
|
|
|
|
|
|
|
if item.year:
|
|
|
|
|
|
|
|
decade = str(int(math.floor(item.year / 10) * 10))
|
|
|
|
|
|
|
|
if decade not in addons:
|
|
|
|
|
|
|
|
addons[decade] = []
|
|
|
|
|
|
|
|
if item.year not in addons[decade]:
|
|
|
|
|
|
|
|
addons[decade].append(item.year)
|
|
|
|
|
|
|
|
all_keys.append(item.year)
|
|
|
|
|
|
|
|
auto_list = {str(k): f"{k}s" for k in addons if str(k) not in exclude and f"{k}s" not in exclude}
|
|
|
|
|
|
|
|
default_template = {"smart_filter": {"limit": 50, "sort_by": "critic_rating.desc", "any": {"year": f"<<value>>"}}}
|
|
|
|
|
|
|
|
default_title_format = "Best <<library_type>>s of <<key_name>>"
|
|
|
|
|
|
|
|
elif auto_type in ["genre", "mood", "style", "country", "studio", "network", "year", "decade", "content_rating", "subtitle_language", "audio_language", "resolution"]:
|
|
|
|
search_tag = auto_type_translation[auto_type] if auto_type in auto_type_translation else auto_type
|
|
|
|
search_tag = auto_type_translation[auto_type] if auto_type in auto_type_translation else auto_type
|
|
|
|
if library.is_show and auto_type in ["resolution", "subtitle_language", "audio_language"]:
|
|
|
|
if library.is_show and auto_type in ["resolution", "subtitle_language", "audio_language"]:
|
|
|
|
tags = library.get_tags(f"episode.{search_tag}")
|
|
|
|
tags = library.get_tags(f"episode.{search_tag}")
|
|
|
@ -298,16 +316,15 @@ class MetadataFile(DataFile):
|
|
|
|
all_keys = [str(i.title) for i in tags]
|
|
|
|
all_keys = [str(i.title) for i in tags]
|
|
|
|
auto_list = {str(i.title): i.title for i in tags if str(i.title) not in exclude}
|
|
|
|
auto_list = {str(i.title): i.title for i in tags if str(i.title) not in exclude}
|
|
|
|
if library.is_music:
|
|
|
|
if library.is_music:
|
|
|
|
default_template = {"smart_filter": {"limit": 50, "sort_by": "plays.desc", "any": {f"artist_{auto_type}": f"<<{auto_type}>>"}}}
|
|
|
|
default_template = {"smart_filter": {"limit": 50, "sort_by": "plays.desc", "any": {f"artist_{auto_type}": f"<<value>>"}}}
|
|
|
|
default_title_format = "Most Played <<key_name>> <<library_type>>s"
|
|
|
|
default_title_format = "Most Played <<key_name>> <<library_type>>s"
|
|
|
|
elif auto_type == "resolution":
|
|
|
|
elif auto_type == "resolution":
|
|
|
|
default_template = {"smart_filter": {"sort_by": "title.asc", "any": {auto_type: f"<<{auto_type}>>"}}}
|
|
|
|
default_template = {"smart_filter": {"sort_by": "title.asc", "any": {auto_type: f"<<value>>"}}}
|
|
|
|
default_title_format = "<<key_name>> <<library_type>>s"
|
|
|
|
default_title_format = "<<key_name>> <<library_type>>s"
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
default_template = {"smart_filter": {"limit": 50, "sort_by": "critic_rating.desc", "any": {auto_type: f"<<{auto_type}>>"}}}
|
|
|
|
default_template = {"smart_filter": {"limit": 50, "sort_by": "critic_rating.desc", "any": {auto_type: f"<<value>>"}}}
|
|
|
|
default_title_format = "Best <<library_type>>s of <<key_name>>" if auto_type in ["year", "decade"] else "Top <<key_name>> <<library_type>>s"
|
|
|
|
default_title_format = "Best <<library_type>>s of <<key_name>>" if auto_type in ["year", "decade"] else "Top <<key_name>> <<library_type>>s"
|
|
|
|
elif auto_type == "tmdb_collection":
|
|
|
|
elif auto_type == "tmdb_collection":
|
|
|
|
if not all_items:
|
|
|
|
|
|
|
|
all_items = library.get_all()
|
|
|
|
all_items = library.get_all()
|
|
|
|
for i, item in enumerate(all_items, 1):
|
|
|
|
for i, item in enumerate(all_items, 1):
|
|
|
|
logger.ghost(f"Processing: {i}/{len(all_items)} {item.title}")
|
|
|
|
logger.ghost(f"Processing: {i}/{len(all_items)} {item.title}")
|
|
|
@ -319,7 +336,6 @@ class MetadataFile(DataFile):
|
|
|
|
auto_list[str(tmdb_item.collection_id)] = tmdb_item.collection_name
|
|
|
|
auto_list[str(tmdb_item.collection_id)] = tmdb_item.collection_name
|
|
|
|
logger.exorcise()
|
|
|
|
logger.exorcise()
|
|
|
|
elif auto_type == "original_language":
|
|
|
|
elif auto_type == "original_language":
|
|
|
|
if not all_items:
|
|
|
|
|
|
|
|
all_items = library.get_all()
|
|
|
|
all_items = library.get_all()
|
|
|
|
for i, item in enumerate(all_items, 1):
|
|
|
|
for i, item in enumerate(all_items, 1):
|
|
|
|
logger.ghost(f"Processing: {i}/{len(all_items)} {item.title}")
|
|
|
|
logger.ghost(f"Processing: {i}/{len(all_items)} {item.title}")
|
|
|
@ -332,7 +348,6 @@ class MetadataFile(DataFile):
|
|
|
|
logger.exorcise()
|
|
|
|
logger.exorcise()
|
|
|
|
default_title_format = "<<key_name>> <<library_type>>s"
|
|
|
|
default_title_format = "<<key_name>> <<library_type>>s"
|
|
|
|
elif auto_type == "origin_country":
|
|
|
|
elif auto_type == "origin_country":
|
|
|
|
if not all_items:
|
|
|
|
|
|
|
|
all_items = library.get_all()
|
|
|
|
all_items = library.get_all()
|
|
|
|
for i, item in enumerate(all_items, 1):
|
|
|
|
for i, item in enumerate(all_items, 1):
|
|
|
|
logger.ghost(f"Processing: {i}/{len(all_items)} {item.title}")
|
|
|
|
logger.ghost(f"Processing: {i}/{len(all_items)} {item.title}")
|
|
|
@ -363,9 +378,7 @@ class MetadataFile(DataFile):
|
|
|
|
person_limit = util.parse("Config", "limit", dynamic_data, parent=f"{map_name} data", methods=person_methods, datatype="int", default=25, minimum=1) if "limit" in person_methods else None
|
|
|
|
person_limit = util.parse("Config", "limit", dynamic_data, parent=f"{map_name} data", methods=person_methods, datatype="int", default=25, minimum=1) if "limit" in person_methods else None
|
|
|
|
if not person_minimum and not person_limit:
|
|
|
|
if not person_minimum and not person_limit:
|
|
|
|
person_minimum = 3
|
|
|
|
person_minimum = 3
|
|
|
|
if not all_items:
|
|
|
|
for i, item in enumerate(library.get_all(), 1):
|
|
|
|
all_items = library.get_all()
|
|
|
|
|
|
|
|
for i, item in enumerate(all_items, 1):
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
self.library.reload(item)
|
|
|
|
self.library.reload(item)
|
|
|
|
for person in getattr(item, f"{auto_type}s")[:person_depth]:
|
|
|
|
for person in getattr(item, f"{auto_type}s")[:person_depth]:
|
|
|
@ -388,7 +401,7 @@ class MetadataFile(DataFile):
|
|
|
|
person_count += 1
|
|
|
|
person_count += 1
|
|
|
|
except TMDbNotFound:
|
|
|
|
except TMDbNotFound:
|
|
|
|
logger.error(f"TMDb Error: Actor {role['name']} Not Found")
|
|
|
|
logger.error(f"TMDb Error: Actor {role['name']} Not Found")
|
|
|
|
default_template = {"tmdb_person": f"<<{auto_type}>>", "plex_search": {"all": {auto_type: "tmdb"}}},
|
|
|
|
default_template = {"tmdb_person": "<<value>>", "plex_search": {"all": {auto_type: "tmdb"}}},
|
|
|
|
elif auto_type == "trakt_user_lists":
|
|
|
|
elif auto_type == "trakt_user_lists":
|
|
|
|
dynamic_data = util.parse("Config", "data", dynamic, parent=map_name, methods=methods, datatype="list")
|
|
|
|
dynamic_data = util.parse("Config", "data", dynamic, parent=map_name, methods=methods, datatype="list")
|
|
|
|
for option in dynamic_data:
|
|
|
|
for option in dynamic_data:
|
|
|
@ -470,9 +483,9 @@ class MetadataFile(DataFile):
|
|
|
|
for suffix in remove_suffix:
|
|
|
|
for suffix in remove_suffix:
|
|
|
|
if key_name.endswith(suffix):
|
|
|
|
if key_name.endswith(suffix):
|
|
|
|
key_name = key_name[:-len(suffix)].strip()
|
|
|
|
key_name = key_name[:-len(suffix)].strip()
|
|
|
|
key_value = [key]
|
|
|
|
key_value = [key] if key in all_keys else []
|
|
|
|
if key in addons:
|
|
|
|
if key in addons:
|
|
|
|
key_value.extend([a for a in addons[key] if a in all_keys])
|
|
|
|
key_value.extend([a for a in addons[key] if a in all_keys and a != key])
|
|
|
|
template_call = {
|
|
|
|
template_call = {
|
|
|
|
"name": template_name,
|
|
|
|
"name": template_name,
|
|
|
|
"value": key_value,
|
|
|
|
"value": key_value,
|
|
|
|