show_absent: bool = False
) -> list[Self]:
"""Return cls.get_all matching provided filter criteria."""
- return [f for f in cls.get_all(conn)
+ filtered_before_tags = [
+ f for f in cls.get_all(conn)
if str(filter_path).lower() in str(f.rel_path).lower()
- and ([t for t in f.tags if str(filter_tags).lower() in t]
- or not filter_tags)
and (show_absent or f.present)]
+ if filter_tags:
+ tags_or = filter_tags.split(',')
+ filtered_after_tags = set()
+ 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)
+ return filtered_before_tags
def unused_tags(self, conn: BaseDbConn) -> set[Tag]:
"""Return tags used among other VideoFiles, not in self."""