diff --git a/CHANGELOG b/CHANGELOG index 17cbddfc..1cef311c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,8 +1,9 @@ # Requirements Update (requirements will need to be reinstalled) Added tenacity requirement at 8.4.2 +Update pillow requirement to 10.4.0 Update PlexAPI requirement to 4.15.14 Update psutil requirement to 6.0.0 -Update setuptools requirement to 70.1.1 +Update setuptools requirement to 70.2.0 # Removed Features @@ -16,6 +17,7 @@ Added [`letterboxd_user_lists`](https://kometa.wiki/en/latest/files/dynamic_type # Bug Fixes Fixed multiple anime `int()` Errors Fixed #2100 `verify_ssl` wasn't working when downloading images +Fixed an issue with `delete_collections` where items were being deleted if they only matched one criteria vs all criteria Fixed `imdb_watchlist` Various other Minor Fixes \ No newline at end of file diff --git a/VERSION b/VERSION index 1b256a2d..5859a5e4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.2-build24 +2.0.2-build25 diff --git a/modules/operations.py b/modules/operations.py index 4ff7b103..6e8ef19c 100644 --- a/modules/operations.py +++ b/modules/operations.py @@ -64,6 +64,29 @@ class Operations: logger.debug(f"Item Operation: {self.library.items_library_operation}") logger.debug("") + def should_be_deleted(col_in, labels_in, configured_in, managed_in, less_in): + if all((x is None for x in [configured_in, managed_in, less_in])): + return False + + less_check = True + if less_in is not None: + less_check = col_in.childCount < less_in + logger.trace(f"{col_in.title} - collection size: {col_in.childCount} < less: {less_in}, DELETE: {less_check}") + + managed_check = True + if managed_in is not None: + is_managed = "PMM" in labels_in or "Kometa" in labels_in + managed_check = managed_in == is_managed + logger.trace(f"{col_in.title} - collection managed: {is_managed} vs managed: {managed_in}, DELETE: {managed_check}") + + configured_check = True + if configured_in is not None: + is_configured = col_in.title in self.library.collections + configured_check = configured_in == is_configured + logger.trace(f"{col_in.title} - collection configured: {is_configured} vs configured: {configured_in}, DELETE: {configured_check}") + + return all((less_check, managed_check, configured_check)) + if self.library.split_duplicates: items = self.library.search(**{"duplicate": True}) for item in items: @@ -1055,16 +1078,8 @@ class Operations: logger.ghost(f"Reading Collection: {i}/{len(all_collections)} {col.title}") col = self.library.reload(col, force=True) labels = [la.tag for la in self.library.item_labels(col)] - if (less is not None or managed is not None or configured is not None) \ - and (less is None or col.childCount < less) \ - and (managed is None - or (managed is True and "PMM" in labels) - or (managed is True and "Kometa" in labels) - or (managed is False and "PMM" not in labels) - or (managed is False and "Kometa" 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)): + + if should_be_deleted(col, labels, configured, managed, less): try: self.library.delete(col) logger.info(f"{col.title} Deleted") diff --git a/requirements.txt b/requirements.txt index 658efff2..685d9413 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ GitPython==3.1.43 lxml==5.2.2 num2words==0.5.13 pathvalidate==3.2.0 -pillow==10.3.0 +pillow==10.4.0 PlexAPI==4.15.14 psutil==6.0.0 python-dotenv==1.0.1 @@ -12,5 +12,5 @@ requests==2.32.3 tenacity==8.4.2 ruamel.yaml==0.18.6 schedule==1.2.2 -setuptools==70.1.1 +setuptools==70.2.0 tmdbapis==1.2.16 \ No newline at end of file