- if (not self.filter.contains_bad_words(msg.title)
- and msg.ups > self.min_votes
- and not msg.title in self.deduper):
- try:
- self.deduper.add(msg.title)
- content = "%d" % msg.ups
- if (msg.thumbnail != "self" and
- msg.thumbnail != "default" and
- msg.thumbnail != ""):
- content = '<IMG SRC="%s">' % msg.thumbnail
- x = """
-<TABLE STYLE="font-size:%dpt;">
+ title = str(msg.title)
+ if title in self.deduper:
+ continue
+ filtered = ""
+ for filt in self.filters:
+ if filt(title) is True:
+ filtered = filt.__name__
+ break
+ if filtered != "":
+ logger.info(f'Filter {filtered} struck down "{title}"')
+ continue
+ if msg.ups < self.min_votes:
+ logger.debug(
+ f'"{title}" doesn\'t have enough upvotes to be interesting'
+ )
+ continue
+
+ self.deduper.add(title)
+ content = f"{msg.ups}"
+ if (
+ msg.thumbnail != "self"
+ and msg.thumbnail != "default"
+ and msg.thumbnail != ""
+ ):
+ content = f'<IMG SRC="{msg.thumbnail}">'
+ self.messages.add(
+ f"""
+<TABLE STYLE="font-size:{self.font_size}pt;">