From ec760273becfc5e43fa78d203fc0bae0e838397d Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Wed, 11 Dec 2024 00:45:54 +0100 Subject: [PATCH] Turn tags-filtering from OR into AND filter. --- src/ytplom/misc.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ytplom/misc.py b/src/ytplom/misc.py index e3d3728..5800b54 100644 --- a/src/ytplom/misc.py +++ b/src/ytplom/misc.py @@ -310,12 +310,13 @@ class VideoFile(DbData): if str(filter_path).lower() in str(f.rel_path).lower() and (show_absent or f.present)] if filter_tags: - tags_or = filter_tags.split(',') - filtered_after_tags = set() + to_remove = set() + tags_and = filter_tags.split(',') for f in filtered_before_tags: - for t in [t for t in tags_or if t in f.tags]: - filtered_after_tags.add(f) - return list(filtered_after_tags) + for t in [t for t in tags_and if t not in f.tags]: + to_remove.add(f) + for f in to_remove: + filtered_before_tags.remove(f) return filtered_before_tags def unused_tags(self, conn: BaseDbConn) -> set[Tag]: -- 2.30.2