mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-10 06:54:21 +00:00
[3] make a dynamic keys strings
This commit is contained in:
parent
dec20321bd
commit
14d061ac62
5 changed files with 12 additions and 10 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.16.1-develop2
|
||||
1.16.1-develop3
|
||||
|
|
|
@ -284,9 +284,9 @@ class MetadataFile(DataFile):
|
|||
if auto_type in ["genre", "mood", "style", "country", "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
|
||||
if auto_type in ["decade", "subtitle_language", "audio_language"]:
|
||||
auto_list = {i.key: i.title for i in library.get_tags(search_tag) if i.title not in exclude and i.key not in exclude}
|
||||
auto_list = {str(i.key): i.title for i in library.get_tags(search_tag) if str(i.title) not in exclude and str(i.key) not in exclude}
|
||||
else:
|
||||
auto_list = {i.title: i.title for i in library.get_tags(search_tag) if i.title not in exclude}
|
||||
auto_list = {str(i.title): i.title for i in library.get_tags(search_tag) if str(i.title) not in exclude}
|
||||
if library.is_music:
|
||||
default_template = {"smart_filter": {"limit": 50, "sort_by": "plays.desc", "any": {f"artist_{auto_type}": f"<<{auto_type}>>"}}}
|
||||
default_title_format = "Most Played <<key_name>> <<library_type>>s"
|
||||
|
@ -304,7 +304,7 @@ class MetadataFile(DataFile):
|
|||
tmdb_id, tvdb_id, imdb_id = library.get_ids(item)
|
||||
tmdb_item = config.TMDb.get_item(item, tmdb_id, tvdb_id, imdb_id, is_movie=True)
|
||||
if tmdb_item and tmdb_item.collection and tmdb_item.collection.id not in exclude and tmdb_item.collection.name not in exclude:
|
||||
auto_list[tmdb_item.collection.id] = tmdb_item.collection.name
|
||||
auto_list[str(tmdb_item.collection.id)] = tmdb_item.collection.name
|
||||
logger.exorcise()
|
||||
elif auto_type == "original_language":
|
||||
if not all_items:
|
||||
|
@ -369,7 +369,7 @@ class MetadataFile(DataFile):
|
|||
try:
|
||||
results = self.config.TMDb.search_people(role["name"])
|
||||
if results[0].id not in exclude:
|
||||
auto_list[results[0].id] = results[0].name
|
||||
auto_list[str(results[0].id)] = results[0].name
|
||||
person_count += 1
|
||||
except TMDbNotFound:
|
||||
logger.error(f"TMDb Error: Actor {role['name']} Not Found")
|
||||
|
@ -399,8 +399,8 @@ class MetadataFile(DataFile):
|
|||
methods["title_override"] = methods.pop("post_format_override")
|
||||
if "pre_format_override" in methods:
|
||||
methods["key_name_override"] = methods.pop("pre_format_override")
|
||||
title_override = util.parse("Config", "title_override", dynamic, parent=map_name, methods=methods, datatype="dict") if "title_override" in methods else {}
|
||||
key_name_override = util.parse("Config", "key_name_override", dynamic, parent=map_name, methods=methods, datatype="dict") if "key_name_override" in methods else {}
|
||||
title_override = util.parse("Config", "title_override", dynamic, parent=map_name, methods=methods, datatype="strdict") if "title_override" in methods else {}
|
||||
key_name_override = util.parse("Config", "key_name_override", dynamic, parent=map_name, methods=methods, datatype="strdict") if "key_name_override" in methods else {}
|
||||
test = util.parse("Config", "test", dynamic, parent=map_name, methods=methods, default=False, datatype="bool") if "test" in methods else False
|
||||
sync = util.parse("Config", "sync", dynamic, parent=map_name, methods=methods, default=False, datatype="bool") if "sync" in methods else False
|
||||
if "<<library_type>>" in title_format:
|
||||
|
|
|
@ -139,7 +139,7 @@ class TMDb:
|
|||
except TMDbException as e: raise Failed(f"TMDb Error: No List found for TMDb ID {tmdb_id}: {e}")
|
||||
|
||||
def get_popular_people(self, limit):
|
||||
return {p.id: p.name for p in self.TMDb.popular_people().get_results(limit)}
|
||||
return {str(p.id): p.name for p in self.TMDb.popular_people().get_results(limit)}
|
||||
|
||||
def search_people(self, name):
|
||||
return self.TMDb.people_search(name)
|
||||
|
|
|
@ -241,7 +241,7 @@ class Trakt:
|
|||
return self._parse(items, typeless=pagenation == "popular", item_type="movie" if is_movie else "show")
|
||||
|
||||
def get_people(self, data):
|
||||
return {i[0][0]: i[0][1] for i in self._user_list(data) if i[1] == "tmdb_person"}
|
||||
return {str(i[0][0]): i[0][1] for i in self._user_list(data) if i[1] == "tmdb_person"}
|
||||
|
||||
def validate_trakt(self, trakt_lists, is_movie, trakt_type="list"):
|
||||
values = util.get_list(trakt_lists, split=False)
|
||||
|
|
|
@ -438,12 +438,14 @@ def parse(error, attribute, data, datatype=None, methods=None, parent=None, defa
|
|||
else:
|
||||
raise Failed(f"{error} Error: {display} {dict_data} is not a dictionary")
|
||||
return final_list
|
||||
elif datatype in ["dict", "dictlist", "dictdict"]:
|
||||
elif datatype in ["dict", "dictlist", "dictdict", "strdict"]:
|
||||
if isinstance(value, dict):
|
||||
if datatype == "dict":
|
||||
return value
|
||||
elif datatype == "dictlist":
|
||||
return {k: v if isinstance(v, list) else [v] for k, v in value.items()}
|
||||
elif datatype == "strdict":
|
||||
return {str(k): str(v) for k, v in value.items()}
|
||||
else:
|
||||
final_dict = {}
|
||||
for dict_key, dict_data in value.items():
|
||||
|
|
Loading…
Reference in a new issue