From: Christian Heller Date: Tue, 10 Dec 2024 23:45:54 +0000 (+0100) Subject: Turn tags-filtering from OR into AND filter. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/%7B%7Bprefix%7D%7D/error?a=commitdiff_plain;h=ec760273becfc5e43fa78d203fc0bae0e838397d;p=ytplom Turn tags-filtering from OR into AND filter. --- 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]: