forked from hkc/mastoposter
Ignore case in tags and removed debug print
This commit is contained in:
parent
209d1a9072
commit
7c2760783b
|
@ -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?")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue