Skip to content

Commit

Permalink
Add show_unfiltered to allow display of things that *do* match a filt…
Browse files Browse the repository at this point in the history
…er (#2280)
  • Loading branch information
chazlarson authored Nov 15, 2024
1 parent 673ab45 commit cd37a77
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 451 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Update setuptools requirement to 75.3.0

# New Features
Added the `character` search option to the `imdb_search` builder
Add `show_unfiltered` setting to display items which make it through a filter

# Defaults
Fixed incorrect content rating mappings in various Default files
Expand Down
1 change: 1 addition & 0 deletions config/config.yml.template
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ settings:
show_unmanaged: true
show_unconfigured: true
show_filtered: false
show_unfiltered: false
show_options: true
show_missing: true
show_missing_assets: true
Expand Down
24 changes: 23 additions & 1 deletion docs/config/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ The available setting attributes which can be set at each level are outlined bel
show_unconfigured: false
```

??? blank "`show_filtered` - Used to show filtered items.<a class="headerlink" href="#show-filtered" title="Permanent link">¶</a>"
??? blank "`show_filtered` - Used to show items filtered out.<a class="headerlink" href="#show-filtered" title="Permanent link">¶</a>"

<div id="show-filtered" />List all items which have been filtered out of a collection or playlist (i.e. if it
doesn't meet the filter criteria)
Expand All @@ -615,6 +615,28 @@ The available setting attributes which can be set at each level are outlined bel
show_filtered: true
```

??? blank "`show_unfiltered` - Used to show items which make it through filters.<a class="headerlink" href="#show-unfiltered" title="Permanent link">¶</a>"

<div id="show-unfiltered" />List all items which have made it through the filters INTO a collection or playlist (i.e. if it
meets the filter criteria)

<hr style="margin: 0px;">

**Attribute:** `show_unfiltered`

**Levels with this Attribute:** Global/Library/Collection/Playlist

**Accepted Values:** `true` or `false`

**Default Value:** `false`

???+ example "Example"
```yaml
settings:
show_unfiltered: true
```

??? blank "`show_options` - Used to show attribute options from plex.<a class="headerlink" href="#show-options" title="Permanent link">¶</a>"

<div id="show-options" />While `show_options` is true the available options for an attribute when using
Expand Down
448 changes: 2 additions & 446 deletions docs/files/filters.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/files/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ tags:
- missing_only_released
- only_filter_missing
- show_filtered
- show_unfiltered
- show_missing
- save_report
- ignore_ids
Expand Down Expand Up @@ -66,6 +67,7 @@ All the following attributes serve various functions as how the definition funct
| `missing_only_released` | **Description:** definition Level `missing_only_released` toggle.<br>**Default:** `missing_only_released` [settings value](../config/settings.md) in the Configuration File<br>**Values:** `true` or `false` |
| `only_filter_missing` | **Description:** definition Level `only_filter_missing` toggle.<br>**Default:** `only_filter_missing` [settings value](../config/settings.md) in the Configuration File<br>**Values:** `true` or `false` |
| `show_filtered` | **Description:** definition level `show_filtered` toggle.<br>**Default:** `show_filtered` [settings value](../config/settings.md) in the Configuration File<br>**Values:** `true` or `false` |
| `show_unfiltered` | **Description:** definition level `show_unfiltered` toggle.<br>**Default:** `show_unfiltered` [settings value](../config/settings.md) in the Configuration File<br>**Values:** `true` or `false` |
| `show_missing` | **Description:** definition level `show_missing` toggle.<br>**Default:** `show_missing` [settings value](../config/settings.md) in the Configuration File<br>**Values:** `true` or `false` |
| `save_report` | **Description:** definition level `save_report` toggle.<br>**Default:** `save_report` [settings value](../config/settings.md) in the Configuration File<br>**Values:** `true` or `false` |
| `ignore_ids` | **Description:** definition level `ignore_ids` which is combined with the library and global `ignore_ids`.<br>**Default:** `ignore_ids` [settings value](../config/settings.md) in the Configuration File<br>**Values:** List or comma-separated String of TMDb/TVDb IDs |
Expand Down
4 changes: 4 additions & 0 deletions json-schema/config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,10 @@
"description": "Used to show filtered items.\nList all items which have been filtered out of a collection or playlist (i.e. if it doesn't meet the filter criteria)",
"type": "boolean"
},
"show_unfiltered": {
"description": "Used to show unfiltered items.\nList all items which make it through a filter into a collection or playlist (i.e. if it MEETS the filter criteria)",
"type": "boolean"
},
"show_options": {
"description": "Used to show attribute options from plex.\nWhile show_options is true the available options for an attribute when using plex_search, smart_filter or filters will be shown. i.e. a smart_filter on the genre attribute will return all of the attributes within the specified library.",
"type": "boolean"
Expand Down
1 change: 1 addition & 0 deletions json-schema/kitchen_sink_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ settings: # Can be individually specif
show_unconfigured: true
show_unmanaged: true
show_filtered: true
show_unfiltered: true
show_options: true
show_missing: false
only_filter_missing: false
Expand Down
1 change: 1 addition & 0 deletions kometa.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ def run_libraries(config):
logger.debug(f"Show Unmanaged: {library.show_unmanaged}")
logger.debug(f"Show Unconfigured: {library.show_unconfigured}")
logger.debug(f"Show Filtered: {library.show_filtered}")
logger.debug(f"Show Unfiltered: {library.show_unfiltered}")
logger.debug(f"Show Options: {library.show_options}")
logger.debug(f"Show Missing: {library.show_missing}")
logger.debug(f"Save Report: {library.save_report}")
Expand Down
11 changes: 7 additions & 4 deletions modules/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
poster_details = ["url_poster", "tmdb_poster", "tmdb_profile", "tvdb_poster", "file_poster"]
background_details = ["url_background", "tmdb_background", "tvdb_background", "file_background"]
boolean_details = [
"show_filtered", "show_missing", "save_report", "missing_only_released", "only_filter_missing",
"show_filtered", "show_unfiltered", "show_missing", "save_report", "missing_only_released", "only_filter_missing",
"delete_below_minimum", "asset_folders", "create_asset_folders"
]
scheduled_boolean = ["visible_library", "visible_home", "visible_shared"]
Expand Down Expand Up @@ -143,7 +143,7 @@
boolean_attributes = plex.boolean_attributes + boolean_filters
smart_invalid = ["collection_order", "builder_level"]
smart_only = ["collection_filtering"]
smart_url_invalid = ["filters", "run_again", "sync_mode", "show_filtered", "show_missing", "save_report", "smart_label"] + radarr_details + sonarr_details
smart_url_invalid = ["filters", "run_again", "sync_mode", "show_filtered", "show_unfiltered", "show_missing", "save_report", "smart_label"] + radarr_details + sonarr_details
custom_sort_builders = [
"plex_search", "plex_watchlist", "plex_pilots", "tmdb_list", "tmdb_popular", "tmdb_now_playing", "tmdb_top_rated",
"tmdb_trending_daily", "tmdb_trending_weekly", "tmdb_discover", "reciperr_list", "trakt_chart", "trakt_userlist",
Expand Down Expand Up @@ -172,7 +172,7 @@
"cache_builders", "url_theme", "file_theme", "item_label", "default_percent", "non_item_remove_label", "item_analyze"
] + episode_parts_only + summary_details + poster_details + background_details + string_details
playlist_attributes = [
"filters", "name_mapping", "show_filtered", "show_missing", "save_report", "allowed_library_types", "run_definition",
"filters", "name_mapping", "show_filtered", "show_unfiltered", "show_missing", "save_report", "allowed_library_types", "run_definition",
"missing_only_released", "only_filter_missing", "delete_below_minimum", "ignore_ids", "ignore_imdb_ids",
"server_preroll", "changes_webhooks", "minimum_items", "cache_builders", "default_percent"
] + custom_sort_builders + summary_details + poster_details + radarr_details + sonarr_details
Expand Down Expand Up @@ -569,6 +569,7 @@ def apply_vars(input_str, var_set, var_key, var_limit):
self.language = self.library.Plex.language
self.details = {
"show_filtered": self.library.show_filtered,
"show_unfiltered": self.library.show_unfiltered,
"show_options": self.library.show_options,
"show_missing": self.library.show_missing,
"save_report": self.library.save_report,
Expand Down Expand Up @@ -2411,7 +2412,7 @@ def filter_and_save_items(self, ids):
name = self.obj.title if self.obj else self.name
total = len(items)
max_length = len(str(total))
if self.filters and self.details["show_filtered"] is True:
if self.filters and (self.details["show_filtered"] is True or self.details["show_unfiltered"] is True):
logger.info("")
logger.info("Filtering Builders:")
filtered_items = []
Expand All @@ -2427,6 +2428,8 @@ def filter_and_save_items(self, ids):
current_title = util.item_title(item)
if self.check_filters(item, f"{(' ' * (max_length - len(str(i))))}{i}/{total}"):
self.found_items.append(item)
if self.details["show_unfiltered"] is True:
logger.info(f"{name} {self.Type} | = | {current_title}")
else:
filtered_items.append(item)
self.filtered_keys[item.ratingKey] = current_title
Expand Down
4 changes: 4 additions & 0 deletions modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def replace_attr(all_data, in_attr, par):
replace_attr(self.data, "sync_mode", "plex")
replace_attr(self.data, "show_unmanaged", "plex")
replace_attr(self.data, "show_filtered", "plex")
replace_attr(self.data, "show_unfiltered", "plex")
replace_attr(self.data, "show_missing", "plex")
replace_attr(self.data, "save_missing", "plex")
if self.data["libraries"]:
Expand All @@ -240,6 +241,7 @@ def replace_attr(all_data, in_attr, par):
replace_attr(self.data["libraries"][library], "sync_mode", "plex")
replace_attr(self.data["libraries"][library], "show_unmanaged", "plex")
replace_attr(self.data["libraries"][library], "show_filtered", "plex")
replace_attr(self.data["libraries"][library], "show_unfiltered", "plex")
replace_attr(self.data["libraries"][library], "show_missing", "plex")
replace_attr(self.data["libraries"][library], "save_missing", "plex")
if "settings" in self.data["libraries"][library] and self.data["libraries"][library]["settings"]:
Expand Down Expand Up @@ -465,6 +467,7 @@ def check_for_attribute(data, attribute, parent=None, test_list=None, translatio
"show_unmanaged": check_for_attribute(self.data, "show_unmanaged", parent="settings", var_type="bool", default=True),
"show_unconfigured": check_for_attribute(self.data, "show_unconfigured", parent="settings", var_type="bool", default=True),
"show_filtered": check_for_attribute(self.data, "show_filtered", parent="settings", var_type="bool", default=False),
"show_unfiltered": check_for_attribute(self.data, "show_unfiltered", parent="settings", var_type="bool", default=False),
"show_options": check_for_attribute(self.data, "show_options", parent="settings", var_type="bool", default=False),
"show_missing": check_for_attribute(self.data, "show_missing", parent="settings", var_type="bool", default=True),
"save_report": check_for_attribute(self.data, "save_report", parent="settings", var_type="bool", default=False),
Expand Down Expand Up @@ -836,6 +839,7 @@ def check_for_attribute(data, attribute, parent=None, test_list=None, translatio
params["show_unmanaged"] = check_for_attribute(lib, "show_unmanaged", parent="settings", var_type="bool", default=self.general["show_unmanaged"], do_print=False, save=False)
params["show_unconfigured"] = check_for_attribute(lib, "show_unconfigured", parent="settings", var_type="bool", default=self.general["show_unconfigured"], do_print=False, save=False)
params["show_filtered"] = check_for_attribute(lib, "show_filtered", parent="settings", var_type="bool", default=self.general["show_filtered"], do_print=False, save=False)
params["show_unfiltered"] = check_for_attribute(lib, "show_unfiltered", parent="settings", var_type="bool", default=self.general["show_unfiltered"], do_print=False, save=False)
params["show_options"] = check_for_attribute(lib, "show_options", parent="settings", var_type="bool", default=self.general["show_options"], do_print=False, save=False)
params["show_missing"] = check_for_attribute(lib, "show_missing", parent="settings", var_type="bool", default=self.general["show_missing"], do_print=False, save=False)
params["show_missing_assets"] = check_for_attribute(lib, "show_missing_assets", parent="settings", var_type="bool", default=self.general["show_missing_assets"], do_print=False, save=False)
Expand Down
1 change: 1 addition & 0 deletions modules/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def __init__(self, config, params):
self.show_unmanaged = params["show_unmanaged"]
self.show_unconfigured = params["show_unconfigured"]
self.show_filtered = params["show_filtered"]
self.show_unfiltered = params["show_unfiltered"]
self.show_options = params["show_options"]
self.show_missing = params["show_missing"]
self.show_missing_assets = params["show_missing_assets"]
Expand Down

0 comments on commit cd37a77

Please sign in to comment.