|
|
@ -9,6 +9,15 @@ logger = logging.getLogger("Plex Meta Manager")
|
|
|
|
|
|
|
|
|
|
|
|
github_base = "https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager-Configs/master/"
|
|
|
|
github_base = "https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager-Configs/master/"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
all_auto = ["genre"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto = {
|
|
|
|
|
|
|
|
"Movie": ["tmdb_collection", "country"] + all_auto,
|
|
|
|
|
|
|
|
"Show": ["network"] + all_auto,
|
|
|
|
|
|
|
|
"Artist": ["mood", "style", "country"] + all_auto,
|
|
|
|
|
|
|
|
"Video": ["country"] + all_auto
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def get_dict(attribute, attr_data, check_list=None):
|
|
|
|
def get_dict(attribute, attr_data, check_list=None):
|
|
|
|
if check_list is None:
|
|
|
|
if check_list is None:
|
|
|
|
check_list = []
|
|
|
|
check_list = []
|
|
|
@ -237,14 +246,20 @@ class MetadataFile(DataFile):
|
|
|
|
raise Failed(f"Config Error: {auto_name}'s auto_list attribute not found")
|
|
|
|
raise Failed(f"Config Error: {auto_name}'s auto_list attribute not found")
|
|
|
|
elif not auto_data[auto_methods["auto_list"]]:
|
|
|
|
elif not auto_data[auto_methods["auto_list"]]:
|
|
|
|
raise Failed(f"Config Error: {auto_name}'s auto_list attribute is blank")
|
|
|
|
raise Failed(f"Config Error: {auto_name}'s auto_list attribute is blank")
|
|
|
|
elif auto_data[auto_methods["auto_list"]] not in ["genre", "tmdb_collection"]:
|
|
|
|
elif auto_data[auto_methods["auto_list"]].lower() not in auto[library.type]:
|
|
|
|
raise Failed(f"Config Error: {auto_name}'s auto_list attribute {auto_data[auto_methods['auto_list']]} invalid")
|
|
|
|
raise Failed(f"Config Error: auto_list attribute {auto_data[auto_methods['auto_list']].lower()} invalid Options: {auto[library.type]}")
|
|
|
|
|
|
|
|
elif auto_data[auto_methods["auto_list"]].lower() == "network" and library.agent not in plex.new_plex_agents:
|
|
|
|
|
|
|
|
raise Failed(f"Config Error: network auto_list only works with the New Plex TV Agent")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
auto_type = auto_data[auto_methods["auto_list"]]
|
|
|
|
auto_type = auto_data[auto_methods["auto_list"]].lower()
|
|
|
|
exclude = util.parse("Config", "exclude", auto_data, methods=auto_methods, datatype="list") if "exclude" in auto_methods else []
|
|
|
|
exclude = util.parse("Config", "exclude", auto_data, methods=auto_methods, datatype="list") if "exclude" in auto_methods else []
|
|
|
|
if auto_type == "genre":
|
|
|
|
if auto_type in ["genre", "mood", "style", "country", "network"]:
|
|
|
|
auto_list = {genre: genre for genre in library.get_genres() if genre not in exclude}
|
|
|
|
auto_list = {i.title: i.title for i in library.get_tags(auto_type) if i.title not in exclude}
|
|
|
|
default_template = {"smart_filter": {"limit": 50, "sort_by": "critic_rating.desc", "all": {"genre": "<<genre>>"}}}
|
|
|
|
if library.is_music:
|
|
|
|
|
|
|
|
use_filter = f"artist_{auto_type}"
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
use_filter = auto_type
|
|
|
|
|
|
|
|
default_template = {"smart_filter": {"limit": 50, "sort_by": "critic_rating.desc", "all": {use_filter: f"<<{auto_type}>>"}}}
|
|
|
|
default_title_format = "Top <<title>> <<library_type>>s"
|
|
|
|
default_title_format = "Top <<title>> <<library_type>>s"
|
|
|
|
elif auto_type == "tmdb_collection":
|
|
|
|
elif auto_type == "tmdb_collection":
|
|
|
|
auto_list = {}
|
|
|
|
auto_list = {}
|
|
|
@ -259,9 +274,10 @@ class MetadataFile(DataFile):
|
|
|
|
default_template = {"tmdb_collection_details": "<<tmdb_collection>>"}
|
|
|
|
default_template = {"tmdb_collection_details": "<<tmdb_collection>>"}
|
|
|
|
default_title_format = "<<title>>"
|
|
|
|
default_title_format = "<<title>>"
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
raise Failed
|
|
|
|
raise Failed(f"Config Error: {auto_name}'s auto_list attribute {auto_data[auto_methods['auto_list']]} invalid")
|
|
|
|
|
|
|
|
title_format = default_title_format
|
|
|
|
|
|
|
|
if "title_format" in auto_methods:
|
|
|
|
title_format = util.parse("Config", "title_format", auto_data, methods=auto_methods, default=default_title_format)
|
|
|
|
title_format = util.parse("Config", "title_format", auto_data, methods=auto_methods, default=default_title_format)
|
|
|
|
|
|
|
|
|
|
|
|
if "<<title>>" not in title_format:
|
|
|
|
if "<<title>>" not in title_format:
|
|
|
|
logger.error(f"Config Error: <<title>> not in title_format: {title_format} using default: {default_title_format}")
|
|
|
|
logger.error(f"Config Error: <<title>> not in title_format: {title_format} using default: {default_title_format}")
|
|
|
|
title_format = default_title_format
|
|
|
|
title_format = default_title_format
|
|
|
|