pull/1261/head
meisnate12 2 years ago
parent 23d43cc6d7
commit edc8cdc230

@ -9,6 +9,7 @@ Added Spanish Defaults Translation
Added Delete Webhooks
# Bug Fixes
Fixes #1187 Franchise Defaults no longer ignore collection_section and sort_title
Fixed Italian Defaults Translation
Fixed TMDb Modified Filters
Fixed ValueError from Anime IDs

@ -1 +1 @@
1.18.2-develop7
1.18.2-develop8

@ -27,12 +27,10 @@ templates:
collection_order_<<key>>: <<collection_order>>
optional:
- summary_<<key>>
- name_<<key>>
- movie
- name_mapping
- build_collection
- collection_mode
- collection_order
- collection_section
- radarr_add_missing
- radarr_folder
@ -41,7 +39,6 @@ templates:
- radarr_monitor
- url_poster_<<key>>
summary: <<summary_<<key>>>>
name: <<name_<<key>>>>
cache_builders: 1
minimum_items: <<minimum_items>>
url_poster: <<url_poster_<<key>>>>

@ -28,7 +28,6 @@ templates:
url_poster_<<key>>: https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager-Images/master/franchise/<<key_name_encoded>>.jpg
optional:
- summary_<<key>>
- name_<<key>>
- name_mapping
- sort_title
- build_collection
@ -41,7 +40,6 @@ templates:
- item_sonarr_tag
- sonarr_monitor
summary: <<summary_<<key>>>>
name: <<name_<<key>>>>
minimum_items: <<minimum_items>>
tmdb_show: <<value>>
url_poster: <<url_poster_<<key>>>>

@ -35,7 +35,6 @@ Note that the `template_variables:` section only needs to be used if you do want
| Variable | Description & Values |
|:-----------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name_<<key>>`<sup>1</sup> | **Description:** Changes the name of the specified key's collection.<br>**Values:** New Collection Name |
| `summary_<<key>>`<sup>1</sup> | **Description:** Changes the summary of the specified key's collection.<br>**Values:** New Collection Summary |
| `collection_section` | **Description:** Adds a sort title with this collection sections.<br>**Values:** Any number |
| `order_<<key>>`<sup>1</sup> | **Description:** Controls the sort order of the collections in their collection section.<br>**Values:** Any number |

@ -35,7 +35,6 @@ Note that the `template_variables:` section only needs to be used if you do want
| Variable | Description & Values |
|:-----------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name_<<key>>`<sup>1</sup> | **Description:** Changes the name of the specified key's collection.<br>**Values:** New Collection Name |
| `summary_<<key>>`<sup>1</sup> | **Description:** Changes the summary of the specified key's collection.<br>**Values:** New Collection Summary |
| `collection_section` | **Description:** Adds a sort title with this collection sections.<br>**Values:** Any number |
| `order_<<key>>`<sup>1</sup> | **Description:** Controls the sort order of the collections in their collection section.<br>**Values:** Any number |

@ -468,7 +468,7 @@ class DataFile:
logger.trace(f"Translation: {translation_variables}")
logger.trace("")
def check_for_var(_method, _data):
def check_for_var(_method, _data, _debug):
def scan_text(og_txt, var, actual_value):
if og_txt is None:
return og_txt
@ -478,9 +478,13 @@ class DataFile:
return str(og_txt).replace(f"<<{var}>>", str(actual_value))
else:
return og_txt
if _debug:
logger.trace(f"Start {_method}: {_data}")
for i_check in range(8):
for option in optional:
if option not in variables and option not in translation_variables and f"<<{option}>>" in str(_data):
if _debug:
logger.trace(f"Failed {_method}: {_data}")
raise Failed
for variable, variable_data in variables.items():
if (variable == "collection_name" or variable == "playlist_name") and _method in ["radarr_tag", "item_radarr_tag", "sonarr_tag", "item_sonarr_tag"]:
@ -491,14 +495,16 @@ class DataFile:
_data = scan_text(_data, variable, variable_data)
for dm, dd in default.items():
_data = scan_text(_data, dm, dd)
if _debug:
logger.trace(f"End {_method}: {_data}")
return _data
def check_data(_method, _data):
def check_data(_method, _data, _debug):
if isinstance(_data, dict):
final_data = {}
for sm, sd in _data.items():
try:
final_data[check_for_var(_method, sm)] = check_data(_method, sd)
final_data[check_for_var(_method, sm, _debug)] = check_data(_method, sd, _debug)
except Failed:
continue
if not final_data:
@ -507,24 +513,25 @@ class DataFile:
final_data = []
for li in _data:
try:
final_data.append(check_data(_method, li))
final_data.append(check_data(_method, li, _debug))
except Failed:
continue
if not final_data:
raise Failed
else:
final_data = check_for_var(_method, _data)
final_data = check_for_var(_method, _data, _debug)
return final_data
for method_name, attr_data in template.items():
if method_name not in data and method_name not in ["default", "optional", "conditionals", "move_collection_prefix", "move_prefix"]:
try:
new_name = check_for_var(method_name, method_name)
debug_template = False
new_name = check_for_var(method_name, method_name, debug_template)
if new_name in new_attributes:
logger.info("")
logger.warning(f"Template Warning: template attribute: {new_name} from {variables['name']} skipped")
else:
new_attributes[new_name] = check_data(new_name, attr_data)
new_attributes[new_name] = check_data(new_name, attr_data, debug_template)
except Failed:
continue
logger.separator(f"Final Template Attributes", space=False, border=False, debug=True)

Loading…
Cancel
Save