diff --git a/src/twitter/buffers/indibidual.py b/src/twitter/buffers/indibidual.py index b8f130ca..138605ab 100644 --- a/src/twitter/buffers/indibidual.py +++ b/src/twitter/buffers/indibidual.py @@ -24,19 +24,20 @@ class timelinesStreamer(TwythonStreamer): def check_tls(self, data): for i in self.session.settings["other_buffers"]["timelines"]: if data["user"]["id_str"] == i: - if utils.find_item(data["id"], self.session.db["%s-timeline" % (i,)]) != None and utils.is_allowed(data, self.session.settings, "%s-timeline" % (i,)): + if utils.find_item(data["id"], self.session.db["%s-timeline" % (i,)]) != None: log.error("duplicated tweet. Ignoring it...") return # try: - data_ = self.session.check_quoted_status(data) - data_ = self.session.check_long_tweet(data_) - data = data_ + if utils.is_allowed(data, self.session.settings, "%s-timeline" % (i,)): + data_ = self.session.check_quoted_status(data) + data_ = self.session.check_long_tweet(data_) + data = data_ # except ValueError: # pass - if self.session.settings["general"]["reverse_timelines"] == False: self.session.db["%s-timeline" % (i,)].append(data) - else: self.session.db["%s-timeline" % (i,)].insert(0, data) - pub.sendMessage("item-in-timeline", data= data, user= self.session.db["user_name"], who= i) - return + if self.session.settings["general"]["reverse_timelines"] == False: self.session.db["%s-timeline" % (i,)].append(data) + else: self.session.db["%s-timeline" % (i,)].insert(0, data) + pub.sendMessage("item-in-timeline", data= data, user= self.session.db["user_name"], who= i) + return for i in self.session.lists: try: i.users.index(data["user"]["id"]) diff --git a/src/twitter/utils.py b/src/twitter/utils.py index 6ee5ab43..04d235a8 100644 --- a/src/twitter/utils.py +++ b/src/twitter/utils.py @@ -142,7 +142,6 @@ def is_allowed(tweet, settings, buffer_name): def filter_tweet(tweet, settings, buffer_name): for i in settings["filters"]: if settings["filters"][i]["in_buffer"] == buffer_name: - result = True regexp = settings["filters"][i]["regexp"] word = settings["filters"][i]["word"] if word != "" and settings["filters"][i]["if_word_exists"]: @@ -151,10 +150,10 @@ def filter_tweet(tweet, settings, buffer_name): elif word != "" and settings["filters"][i]["if_word_exists"] == False: if word in tweet["full_text"]: return False - if settings["filters"][i]["in_lang"] == True: + if settings["filters"][i]["in_lang"] == "True": if tweet["lang"] not in settings["filters"][i]["languages"]: return False - elif settings["filters"][i]["in_lang"] == False: + elif settings["filters"][i]["in_lang"] == "False": if tweet["lang"] in settings["filters"][i]["languages"]: return False return True