Improvements for #102

This commit is contained in:
Manuel Cortez 2017-11-14 16:56:45 -06:00
parent 682ee82aa8
commit 6a3b498d52
2 changed files with 11 additions and 11 deletions

View File

@ -24,10 +24,11 @@ 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:
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_

View File

@ -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