From f60bcefcacd37ffa4c463f33059b7e8e7101ab76 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Thu, 12 Jan 2023 15:30:31 -0500 Subject: [PATCH] [15] fix replacing flags using the language overlay --- VERSION | 2 +- defaults/overlays/languages.yml | 2 +- modules/meta.py | 33 +++++++++++++++++++-------------- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/VERSION b/VERSION index 369e5aef..afc7ceb7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.18.2-develop14 +1.18.2-develop15 diff --git a/defaults/overlays/languages.yml b/defaults/overlays/languages.yml index 7f431d6c..886e4659 100644 --- a/defaults/overlays/languages.yml +++ b/defaults/overlays/languages.yml @@ -38,7 +38,7 @@ external_templates: country_<>: <> offset: 10 queue: flags - pmm: flag/<>/<>>> + pmm_<>: flag/<>/<>>> addon_position: <> addon_offset: <> back_color: "#00000099" diff --git a/modules/meta.py b/modules/meta.py index f137a6b0..bcc1dd0b 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -488,21 +488,26 @@ class DataFile: 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"]: - _data = scan_text(_data, variable, variable_data.replace(",", "")) - elif variable != "name": + try: + 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"]: + _data = scan_text(_data, variable, variable_data.replace(",", "")) + elif variable != "name": + _data = scan_text(_data, variable, variable_data) + for variable, variable_data in translation_variables.items(): _data = scan_text(_data, variable, variable_data) - for variable, variable_data in translation_variables.items(): - _data = scan_text(_data, variable, variable_data) - for dm, dd in default.items(): - _data = scan_text(_data, dm, dd) + for dm, dd in default.items(): + _data = scan_text(_data, dm, dd) + except Failed: + if _debug: + logger.trace(f"Failed {_method}: {_data}") + raise if _debug: logger.trace(f"End {_method}: {_data}") return _data