home · contact · privacy
Turn tags-filtering from OR into AND filter.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 10 Dec 2024 23:45:54 +0000 (00:45 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 10 Dec 2024 23:45:54 +0000 (00:45 +0100)
src/ytplom/misc.py

index e3d3728587980f79d2eee10ab5b647e396a9aaeb..5800b5412e6fa23d58e4c9af957020c3b2d91bd2 100644 (file)
@@ -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]: