diff --git a/VERSION b/VERSION index e9577298..1b6c504c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.17.3-develop166 +1.17.3-develop167 diff --git a/defaults/overlays/audio_codec.yml b/defaults/overlays/audio_codec.yml index aed1b63e..db86a445 100644 --- a/defaults/overlays/audio_codec.yml +++ b/defaults/overlays/audio_codec.yml @@ -15,8 +15,9 @@ external_templates: conditions: - style: standard value: <> - standard_value: 105 - style: compact + default: + standard_value: 105 + style: compact group: audio_codec horizontal_offset: 0 horizontal_align: center diff --git a/defaults/overlays/commonsense.yml b/defaults/overlays/commonsense.yml index de7739aa..fe9b0f11 100644 --- a/defaults/overlays/commonsense.yml +++ b/defaults/overlays/commonsense.yml @@ -19,11 +19,12 @@ external_templates: conditions: - overlay_name: NR value: <> - key: <> - pre_text: "" - post_text: "+" - pre_nr_text: "" - post_nr_text: "" + default: + key: <> + pre_text: "" + post_text: "+" + pre_nr_text: "" + post_nr_text: "" horizontal_offset: 15 horizontal_align: left vertical_offset: 270 diff --git a/defaults/overlays/flixpatrol.yml b/defaults/overlays/flixpatrol.yml index d63f7250..2b825538 100644 --- a/defaults/overlays/flixpatrol.yml +++ b/defaults/overlays/flixpatrol.yml @@ -8,11 +8,12 @@ external_templates: pmm: templates template_variables: + default: + pre_text: TOP + style: round + limit: 10 + limit_<>: <> queue: position - limit: 10 - limit_<>: <> - pre_text: TOP - style: round back_color: "#00000099" back_width: 160 back_height: 160 diff --git a/defaults/overlays/languages.yml b/defaults/overlays/languages.yml index d4bf23b6..0b6103bd 100644 --- a/defaults/overlays/languages.yml +++ b/defaults/overlays/languages.yml @@ -30,13 +30,14 @@ external_templates: value: 26 - style: square value: - style: round - country: <> - country_<>: <> + default: + style: round + country: <> + country_<>: <> + offset: 10 queue: position pmm: flag/<>/<>>> addon_position: <> - offset: 10 addon_offset: <> back_color: "#00000099" back_width: 190 @@ -55,15 +56,15 @@ queues: left: - horizontal_align: left - vertical_offset: 75 - - vertical_offset: 136 - - vertical_offset: 197 - - vertical_offset: 258 + - vertical_offset: 137 + - vertical_offset: 199 + - vertical_offset: 261 right: - horizontal_align: right - vertical_offset: 75 - - vertical_offset: 136 - - vertical_offset: 197 - - vertical_offset: 258 + - vertical_offset: 137 + - vertical_offset: 199 + - vertical_offset: 261 templates: flags: diff --git a/defaults/overlays/resolution.yml b/defaults/overlays/resolution.yml index fe5d30be..53825bdb 100644 --- a/defaults/overlays/resolution.yml +++ b/defaults/overlays/resolution.yml @@ -99,7 +99,6 @@ external_templates: value: edition - type: [resolution, resolution_dovetail] value: resolution - horizontal_align: left vertical_align: top diff --git a/defaults/overlays/video_format.yml b/defaults/overlays/video_format.yml index 04cf826f..80fcdf57 100644 --- a/defaults/overlays/video_format.yml +++ b/defaults/overlays/video_format.yml @@ -9,7 +9,8 @@ external_templates: pmm: templates template_variables: - text_<>: <> + default: + text_<>: <> group: quality horizontal_offset: 15 horizontal_align: left diff --git a/docs/defaults/overlays/languages.md b/docs/defaults/overlays/languages.md index 43f06266..01848338 100644 --- a/docs/defaults/overlays/languages.md +++ b/docs/defaults/overlays/languages.md @@ -134,7 +134,7 @@ All [Shared Overlay Variables](variables) are available with the default values | `style` | **Description:** Controls the visual theme of the overlays created.
Values:
roundRound Theme
squareSquare Theme
halfSquare Flag with Round Background
| | `offset` | **Description:** Controls the offset between the flag and the text.
**Default:** `10`
**Values:** Any Integer 0 or greater | | `align` | **Description:** Controls the flag alignment in the backdrop.
**Default:** `left`
**Values:** `left` or `right` | -| `country_<>`1 | **Description:** Controls the country image for the Overlay.
**Default:** Listed in the [Table](#supported-audio-subtitle-language-flags) above
**Values:** [ISO 3166-1 Country Code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes) for the flag desired | +| `country_<>`1 | **Description:** Controls the country image for the Overlay.
**Default:** Listed in the [Table](#supported-audiosubtitle-language-flags) above
**Values:** [ISO 3166-1 Country Code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes) for the flag desired | | `use_lowercase` | **Description:** Controls if the overlay display is in lowercase.
**Values:** `true` to use lowercase text | | `use_subtitles` | **Description:** Controls if the overlay is based on subtitle language instead of audio language.
**Values:** `true` to look at subtitle language instead of audio language | | `overlay_level` | **Description:** Choose the Overlay Level.
**Values:** `season` or `episode` | diff --git a/modules/logs.py b/modules/logs.py index d0045179..d7af605e 100644 --- a/modules/logs.py +++ b/modules/logs.py @@ -17,6 +17,7 @@ WARNING = 30 WARN = WARNING INFO = 20 DEBUG = 10 +TRACE = 0 def fmt_filter(record): @@ -182,7 +183,7 @@ class MyLogger: def trace(self, msg, *args, **kwargs): if self.is_trace: - self._log(DEBUG, str(msg), args, **kwargs) + self._log(TRACE, str(msg), args, **kwargs) def error(self, msg, *args, **kwargs): if self.save_errors: @@ -229,6 +230,16 @@ class MyLogger: self.secrets.append(str(text)) def _log(self, level, msg, args, exc_info=None, extra=None, stack_info=False, stacklevel=1): + trace = False + original_format_str = "[%(asctime)s] %(filename)-27s %(levelname)-10s | %(message)s" + format_str = original_format_str + if level == TRACE: + trace = True + level = DEBUG + format_str = "[%(asctime)s] %(filename)-27s [TRACE] | %(message)s" + for handler in self._logger.handlers: + if isinstance(handler, RotatingFileHandler): + handler.setFormatter(logging.Formatter(format_str)) if self.spacing > 0: self.exorcise() if "\n" in msg: @@ -240,7 +251,7 @@ class MyLogger: handler.setFormatter(logging.Formatter(" " * 65 + "| %(message)s")) for handler in self._logger.handlers: if isinstance(handler, RotatingFileHandler): - handler.setFormatter(logging.Formatter("[%(asctime)s] %(filename)-27s %(levelname)-10s | %(message)s")) + handler.setFormatter(logging.Formatter(format_str)) else: for secret in self.secrets: if secret in msg: @@ -262,6 +273,10 @@ class MyLogger: exc_info = sys.exc_info() record = self._logger.makeRecord(self._logger.name, level, fn, lno, msg, args, exc_info, func, extra, sinfo) self._logger.handle(record) + if trace: + for handler in self._logger.handlers: + if isinstance(handler, RotatingFileHandler): + handler.setFormatter(logging.Formatter(original_format_str)) def findCaller(self, stack_info=False, stacklevel=1): f = logging.currentframe() diff --git a/modules/meta.py b/modules/meta.py index 32b07b29..b7f128b4 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -245,6 +245,13 @@ class DataFile: conditionals[ck] = cv added_vars = {} + init_defaults = {} + if "default" in template: + if not template["default"]: + raise Failed(f"{self.data_type} Error: template sub-attribute default is blank") + if not isinstance(template["default"], dict): + raise Failed(f"{self.data_type} Error: template sub-attribute default is not a dictionary") + init_defaults = template["default"] for input_dict, input_type, overwrite_call in [ (temp_vars, "External", False), (extra_variables, "Definition", False), @@ -260,6 +267,13 @@ class DataFile: raise Failed(f"{self.data_type} Error: {input_type} template sub-attribute conditionals is not a dictionary") for ck, cv in input_value.items(): conditionals[ck] = cv + elif input_key == "default": + if not input_value: + raise Failed(f"{self.data_type} Error: {input_type} template sub-attribute default is blank") + if not isinstance(input_value, dict): + raise Failed(f"{self.data_type} Error: {input_type} template sub-attribute default is not a dictionary") + for dk, dv in input_value.items(): + init_defaults[dk] = dv elif input_value is None: optional.append(str(input_key)) elif overwrite_call: @@ -295,20 +309,15 @@ class DataFile: return_item = str(return_item).replace(f"<<{rk}>>", str(rv)) return return_item - ini_default = {} default = {} - if "default" in template: - if not template["default"]: - raise Failed(f"{self.data_type} Error: template sub-attribute default is blank") - if not isinstance(template["default"], dict): - raise Failed(f"{self.data_type} Error: template sub-attribute default is not a dictionary") - ini_default = {replace_var(dv, variables): replace_var(template["default"][dv], variables) for dv in template["default"] if dv not in variables} - for dkey, dvalue in ini_default.items(): - final_key = replace_var(dkey, ini_default) - final_value = replace_var(dvalue, ini_default) - if final_key not in optional and final_key not in variables and final_key not in conditionals: - default[final_key] = final_value - default[f"{final_key}_encoded"] = requests.utils.quote(str(final_value)) + if init_defaults: + var_default = {replace_var(dk, variables): replace_var(dv, variables) for dk, dv in init_defaults.items() if dk not in variables} + for dkey, dvalue in var_default.items(): + final_key = replace_var(dkey, var_default) + final_value = replace_var(dvalue, var_default) + if final_key not in optional and final_key not in variables and final_key not in conditionals: + default[final_key] = final_value + default[f"{final_key}_encoded"] = requests.utils.quote(str(final_value)) if "optional" in template: if template["optional"]: @@ -491,7 +500,9 @@ class DataFile: except Failed: continue logger.debug("") - logger.debug(f"Final Template Attributes: {new_attributes}") + logger.separator(f"Final Template Attributes", space=False, border=False, debug=True) + logger.debug("") + logger.debug(new_attributes) logger.debug("") return new_attributes