1
0
Fork 0

Ignore case in tags and removed debug print

This commit is contained in:
Casey 2022-08-30 15:54:05 +03:00
parent 209d1a9072
commit 7c2760783b
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 2 additions and 3 deletions

View File

@ -17,7 +17,7 @@ class TextFilter(BaseFilter, filter_name="content"):
if self.mode == "regexp": if self.mode == "regexp":
self.regexp = regexp(section["regexp"]) self.regexp = regexp(section["regexp"])
elif self.mode in ("hashtag", "tag"): elif self.mode in ("hashtag", "tag"):
self.tags = set(section["tags"].split()) self.tags = set(map(str.lower, section["tags"].split()))
else: else:
raise ValueError(f"Invalid filter mode {self.mode}") raise ValueError(f"Invalid filter mode {self.mode}")
@ -46,8 +46,7 @@ class TextFilter(BaseFilter, filter_name="content"):
is not None is not None
) )
elif self.tags: elif self.tags:
print(f"{self.tags=} {source.tags=}") return len(self.tags & {t.name.lower() for t in source.tags}) > 0
return len(self.tags & {t.name for t in source.tags}) > 0
else: else:
raise ValueError("Neither regexp or tags were set. Why?") raise ValueError("Neither regexp or tags were set. Why?")