diff --git a/VERSION b/VERSION index bd35fdca..2eefae00 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.18.0-develop15 +1.18.0-develop16 diff --git a/docs/config/operations.md b/docs/config/operations.md index d06a0e94..338838c7 100644 --- a/docs/config/operations.md +++ b/docs/config/operations.md @@ -57,13 +57,11 @@ Deletes collections based on a set of given attributes. The Collection must matc **Values:** There are a few different options to determine how the `delete_collections` works. -| Attribute | Description | -|:---------------|:----------------------------------------------------------------------------------------------------------------------------------------------------| -| `managed` | Matches with a Collection Managed by PMM (the collection has the `PMM` label).
**Default:** `false`
**Values:** `true` or `false` | -| `unmanaged` | Matches with a Collection Unmanaged by PMM (the collection does not have the `PMM` label).
**Default:** `false`
**Values:** `true` or `false` | -| `configured` | Matches with a Collection Configured in the specific PMM run.
**Default:** `false`
**Values:** `true` or `false` | -| `unconfigured` | Matches with a Collection Not Configured in the specific PMM run.
**Default:** `false`
**Values:** `true` or `false` | -| `less` | Matches with a Collection that contains less then the given number of items.
**Default:** ` `
**Values:** Number Greater then 0 | +| Attribute | Description | +|:---------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `managed` | Collection must be a Managed (the collection has the `PMM` label) or Unmanaged (the collection does not have the `PMM` label) Collection.
**Values:** `true` (Managed) or `false` (Unmanged) | +| `configured` | Collection must be a Configured (collection is in the specific PMM run) or Unconfigured (collection is not in the specific PMM run) Collection.
**Values:** `true` (Configured) or `false` (Unconfigured) | +| `less` | Collection must contain less then the given number of items.
**Default:** ` `
**Values:** Number Greater then 0 | **Example:** @@ -74,7 +72,7 @@ library: Movies: operations: delete_collections: - unconfigured: true + configured: false managed: true ``` diff --git a/modules/builder.py b/modules/builder.py index 90f335f6..eeac37a9 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -2738,7 +2738,7 @@ class CollectionBuilder: logger.info(f"Moving {util.item_title(item)} {text}") previous = item except Failed: - logger.error(f"Moving {util.item_title(item)} Failed") + logger.error(f"Failed to Move {util.item_title(item)}") def sync_trakt_list(self): logger.info("") diff --git a/modules/config.py b/modules/config.py index a50b9754..afbf5daf 100644 --- a/modules/config.py +++ b/modules/config.py @@ -277,8 +277,9 @@ class ConfigFile: if isinstance(data[attribute], bool): return data[attribute] else: message = f"{text} must be either true or false" elif var_type == "int": - if isinstance(data[attribute], int) and data[attribute] >= int_min: return data[attribute] - else: message = f"{text} must an integer >= 0" + if isinstance(data[attribute], bool): message = f"{text} must an integer >= {int_min}" + elif isinstance(data[attribute], int) and data[attribute] >= int_min: return data[attribute] + else: message = f"{text} must an integer >= {int_min}" elif var_type == "path": if os.path.exists(os.path.abspath(data[attribute])): return data[attribute] else: message = f"Path {os.path.abspath(data[attribute])} does not exist" @@ -733,10 +734,8 @@ class ConfigFile: params[op][old_value] = new_value if new_value else None if data_type == "delete_collections": params[op] = { - "managed": check_for_attribute(lib["operations"][op], "managed", var_type="bool", default=False, save=False), - "unmanaged": check_for_attribute(lib["operations"][op], "unmanaged", var_type="bool", default=False, save=False), - "configured": check_for_attribute(lib["operations"][op], "configured", var_type="bool", default=False, save=False), - "unconfigured": check_for_attribute(lib["operations"][op], "unconfigured", var_type="bool", default=False, save=False), + "managed": check_for_attribute(lib["operations"][op], "managed", var_type="bool", default_is_none=True, save=False), + "configured": check_for_attribute(lib["operations"][op], "configured", var_type="bool", default_is_none=True, save=False), "less": check_for_attribute(lib["operations"][op], "less", var_type="int", default_is_none=True, save=False, int_min=1), } else: diff --git a/modules/operations.py b/modules/operations.py index edb74331..d4ae97b6 100644 --- a/modules/operations.py +++ b/modules/operations.py @@ -234,7 +234,7 @@ class Operations: def update_rating(attribute, item_attr, display): current = getattr(item, item_attr) - if attribute in ["remove", "reset"] and current: + if attribute in ["remove", "reset"] and current is not None: item.editField(item_attr, None, locked=attribute == "remove") return f"\n{display} | None" elif attribute in ["unlock", "reset"] and item_attr in locked_fields: @@ -514,7 +514,8 @@ class Operations: logger.info(f"Background | No Reset Image Found") if self.library.is_show: - tmdb_seasons = {s.season_number: s for s in tmdb_item.seasons} if tmdb_item else {} + real_show = tmdb_item.load_show() if tmdb_item else None + tmdb_seasons = {s.season_number: s for s in real_show.seasons} if real_show else {} for season in self.library.query(item.seasons): try: season_poster, season_background, _, _ = self.library.find_item_assets(season, item_asset_directory=item_dir, folder_name=name) @@ -704,26 +705,26 @@ class Operations: if self.library.delete_collections: logger.info("") - logger.separator(f"Deleting All Collections", space=False, border=False) + logger.separator(f"Deleting Collections", space=False, border=False) logger.info("") less = self.library.delete_collections["less"] if self.library.delete_collections and self.library.delete_collections["less"] is not None else None managed = self.library.delete_collections["managed"] if self.library.delete_collections else False - unmanaged = self.library.delete_collections["unmanaged"] if self.library.delete_collections else False configured = self.library.delete_collections["configured"] if self.library.delete_collections else False - unconfigured = self.library.delete_collections["unconfigured"] if self.library.delete_collections else False unmanaged_collections = [] unconfigured_collections = [] all_collections = self.library.get_all_collections() for i, col in enumerate(all_collections, 1): logger.ghost(f"Reading Collection: {i}/{len(all_collections)} {col.title}") labels = [la.tag for la in self.library.item_labels(col)] - if (less is not None or unmanaged or managed or unconfigured or configured) \ + if (less is not None or managed is not None or configured is not None) \ and (less is None or col.childCount < less) \ - and (unmanaged is False or "PMM" not in labels) \ - and (managed is False or "PMM" in labels) \ - and (unconfigured is False or col.title not in self.library.collections) \ - and (configured is False or col.title in self.library.collections): + and (managed is None + or (managed is True and "PMM" in labels) + or (managed is False and "PMM" not in labels)) \ + and (configured is None + or (configured is True and col.title in self.library.collections) + or (configured is False and col.title not in self.library.collections)): self.library.query(col.delete) logger.info(f"{col.title} Deleted") else: