diff --git a/VERSION b/VERSION index 0be4c4ad..b06356b7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.16.5-develop46 +1.16.5-develop47 diff --git a/docs/metadata/filters.md b/docs/metadata/filters.md index 1302a15b..ff69c269 100644 --- a/docs/metadata/filters.md +++ b/docs/metadata/filters.md @@ -157,16 +157,16 @@ Special Filters each have their own set of rules for how they're used. ### Attribute -| Special Filters | Description | Movies | Shows | Seasons | Episodes | Artists | Albums | Track | -|:--------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:| -| `history` | Uses the release date attribute (originally available) to match dates throughout history
`day`: Match the Day and Month to Today's Date
`month`: Match the Month to Today's Date
`1-30`: Match the Day and Month to Today's Date or `1-30` days before Today's Date | ✅ | ✅ | ❌ | ✅ | ❌ | ✅ | ❌ | -| `episodes` | Uses the item's episodes attributes to match
Use the `percentage` attribute given a number between 0-100 to determine the percentage of an items episodes that must match the sub-filter. | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | -| `seasons` | Uses the item's seasons attributes to match
Use the `percentage` attribute given a number between 0-100 to determine the percentage of an items seasons that must match the sub-filter. | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | -| `tracks` | Uses the item's tracks attributes to match
Use the `percentage` attribute given a number between 0-100 to determine the percentage of an items tracks that must match the sub-filter. | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ | ❌ | -| `albums` | Uses the item's albums attributes to match
Use the `percentage` attribute given a number between 0-100 to determine the percentage of an items albums that must match the sub-filter. | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | -| `original_language`/`original_language.not`1 | Uses TMDb original language [ISO 639-1 codes](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) to match
Example: `original_language: en, ko` | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | -| `tmdb_status`/`tmdb_status.not`1 | Uses TMDb Status to match
**Values:** `returning`, `planned`, `production`, `ended`, `canceled`, `pilot` | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | -| `tmdb_type`/`tmdb_type.not`1 | Uses TMDb Type to match
**Values:** `documentary`, `news`, `production`, `miniseries`, `reality`, `scripted`, `talk_show`, `video` | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | +| Special Filters | Description | Movies | Shows | Seasons | Episodes | Artists | Albums | Track | +|:-----------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:| +| `history` | Uses the release date attribute (originally available) to match dates throughout history
`day`: Match the Day and Month to Today's Date
`month`: Match the Month to Today's Date
`1-30`: Match the Day and Month to Today's Date or `1-30` days before Today's Date | ✅ | ✅ | ❌ | ✅ | ❌ | ✅ | ❌ | +| `episodes` | Uses the item's episodes attributes to match
Use the `percentage` attribute given a number between 0-100 to determine the percentage of an items episodes that must match the sub-filter. | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | +| `seasons` | Uses the item's seasons attributes to match
Use the `percentage` attribute given a number between 0-100 to determine the percentage of an items seasons that must match the sub-filter. | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | +| `tracks` | Uses the item's tracks attributes to match
Use the `percentage` attribute given a number between 0-100 to determine the percentage of an items tracks that must match the sub-filter. | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ | ❌ | +| `albums` | Uses the item's albums attributes to match
Use the `percentage` attribute given a number between 0-100 to determine the percentage of an items albums that must match the sub-filter. | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | +| `original_language`1
`original_language.not`1 | Uses TMDb original language [ISO 639-1 codes](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) to match
Example: `original_language: en, ko` | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | +| `tmdb_status`1
`tmdb_status.not`1 | Uses TMDb Status to match
**Values:** `returning`, `planned`, `production`, `ended`, `canceled`, `pilot` | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | +| `tmdb_type`1
`tmdb_type.not`1 | Uses TMDb Type to match
**Values:** `documentary`, `news`, `production`, `miniseries`, `reality`, `scripted`, `talk_show`, `video` | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | 1 Also filters out missing movies/shows from being added to Radarr/Sonarr. diff --git a/modules/config.py b/modules/config.py index 9ea197ff..a81436ff 100644 --- a/modules/config.py +++ b/modules/config.py @@ -562,7 +562,6 @@ class ConfigFile: self.libraries = [] libs = check_for_attribute(self.data, "libraries", throw=True) - for library_name, lib in libs.items(): if self.requested_libraries and library_name not in self.requested_libraries: continue diff --git a/modules/meta.py b/modules/meta.py index 7a69fa6a..0dcbc81e 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -47,6 +47,8 @@ def get_dict(attribute, attr_data, check_list=None, lower=False): logger.warning(f"Config Warning: {attribute[:-1] if attribute[-1] == 's' else attribute}: {_name} has no data") elif not isinstance(_data, dict): logger.warning(f"Config Warning: {attribute[:-1] if attribute[-1] == 's' else attribute}: {_name} must be a dictionary") + elif attribute == "templates": + new_dict[str(_name)] = (_data, {}) else: new_dict[str(_name)] = _data return new_dict @@ -118,7 +120,7 @@ class DataFile: raise Failed(f"{self.data_type} Error: template sub-attribute name is blank") elif variables["name"] not in self.templates: raise Failed(f"{self.data_type} Error: template {variables['name']} not found") - elif not isinstance(self.templates[variables["name"]], dict): + elif not isinstance(self.templates[variables["name"]][0], dict): raise Failed(f"{self.data_type} Error: template {variables['name']} is not a dictionary") else: remove_variables = [] @@ -138,11 +140,14 @@ class DataFile: variables["overlay_name"] = str(name) variables["library_type"] = self.library.type.lower() - for temp_key, temp_value in self.temp_vars.items(): + template_name = variables["name"] + template, temp_vars = self.templates[template_name] + + for temp_key, temp_value in temp_vars.items(): variables[temp_key] = temp_value - template_name = variables["name"] - template = self.templates[template_name] + for temp_key, temp_value in self.temp_vars.items(): + variables[temp_key] = temp_value for key, value in variables.copy().items(): variables[f"{key}_encoded"] = requests.utils.quote(str(value)) @@ -252,10 +257,7 @@ class DataFile: if temp_data and isinstance(temp_data, dict) and "templates" in temp_data and temp_data["templates"] and isinstance(temp_data["templates"], dict): for temp_key, temp_value in temp_data["templates"].items(): if temp_key not in self.templates: - self.templates[temp_key] = temp_value - for tk, tv in temp_vars.items(): - if tk not in self.temp_vars: - self.temp_vars[tk] = tv + self.templates[temp_key] = (temp_value, temp_vars) class MetadataFile(DataFile): def __init__(self, config, library, file_type, path, temp_vars, asset_directory): @@ -496,12 +498,12 @@ class MetadataFile(DataFile): for template_name in template_names: if template_name not in self.templates: raise Failed(f"Config Error: {map_name} template: {template_name} not found") - if "<>" in str(self.templates[template_name]) or f"<<{auto_type}>>" in str(self.templates[template_name]): + if "<>" in str(self.templates[template_name][0]) or f"<<{auto_type}>>" in str(self.templates[template_name][0]): has_var = True if not has_var: raise Failed(f"Config Error: One {map_name} template: {template_names} is required to have the template variable <>") else: - self.templates[map_name] = default_template if default_template else default_templates[auto_type] + self.templates[map_name] = (default_template if default_template else default_templates[auto_type], {}) template_names = [map_name] remove_prefix = [] if "remove_prefix" in self.temp_vars: @@ -1101,7 +1103,7 @@ class PlaylistFile(DataFile): super().__init__(config, file_type, path, temp_vars, asset_directory) self.data_type = "Playlist" logger.info("") - logger.info(f"Loading Playlist File {file_type}: {path}") + logger.info(f"Loading Playlist {file_type}: {path}") data = self.load_file(self.type, self.path) self.playlists = get_dict("playlists", data, self.config.playlist_names) self.templates = get_dict("templates", data) @@ -1116,7 +1118,7 @@ class OverlayFile(DataFile): self.library = library self.data_type = "Overlay" logger.info("") - logger.info(f"Loading Overlay File {file_type}: {path}") + logger.info(f"Loading Overlay {file_type}: {path}") data = self.load_file(self.type, self.path) self.overlays = get_dict("overlays", data, self.library.overlays) self.templates = get_dict("templates", data) diff --git a/modules/overlays.py b/modules/overlays.py index fb46b73c..070bbcf7 100644 --- a/modules/overlays.py +++ b/modules/overlays.py @@ -128,7 +128,6 @@ class Overlays: time.sleep(1) has_original = backup_image_path - poster_compare = None if poster is None and has_original is None: logger.error(f"{item_title[:60]:<60} | Overlay Error: No poster found") diff --git a/plex_meta_manager.py b/plex_meta_manager.py index b9030f2d..9bb1f8b1 100644 --- a/plex_meta_manager.py +++ b/plex_meta_manager.py @@ -448,9 +448,9 @@ def run_collection(config, library, metadata, requested_collections): and data_template["name"] \ and metadata.templates \ and data_template["name"] in metadata.templates \ - and metadata.templates[data_template["name"]] \ - and "test" in metadata.templates[data_template["name"]] \ - and metadata.templates[data_template["name"]]["test"] is True: + and metadata.templates[data_template["name"]][0] \ + and "test" in metadata.templates[data_template["name"]][0] \ + and metadata.templates[data_template["name"]][0]["test"] is True: no_template_test = False if no_template_test: continue @@ -622,9 +622,9 @@ def run_playlists(config): and data_template["name"] \ and playlist_file.templates \ and data_template["name"] in playlist_file.templates \ - and playlist_file.templates[data_template["name"]] \ - and "test" in playlist_file.templates[data_template["name"]] \ - and playlist_file.templates[data_template["name"]]["test"] is True: + and playlist_file.templates[data_template["name"]][0] \ + and "test" in playlist_file.templates[data_template["name"]][0] \ + and playlist_file.templates[data_template["name"]][0]["test"] is True: no_template_test = False if no_template_test: continue