mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 20:53:13 -06:00
Improvements for #102
This commit is contained in:
parent
682ee82aa8
commit
6a3b498d52
@ -24,10 +24,11 @@ class timelinesStreamer(TwythonStreamer):
|
|||||||
def check_tls(self, data):
|
def check_tls(self, data):
|
||||||
for i in self.session.settings["other_buffers"]["timelines"]:
|
for i in self.session.settings["other_buffers"]["timelines"]:
|
||||||
if data["user"]["id_str"] == i:
|
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...")
|
log.error("duplicated tweet. Ignoring it...")
|
||||||
return
|
return
|
||||||
# try:
|
# try:
|
||||||
|
if utils.is_allowed(data, self.session.settings, "%s-timeline" % (i,)):
|
||||||
data_ = self.session.check_quoted_status(data)
|
data_ = self.session.check_quoted_status(data)
|
||||||
data_ = self.session.check_long_tweet(data_)
|
data_ = self.session.check_long_tweet(data_)
|
||||||
data = data_
|
data = data_
|
||||||
|
@ -142,7 +142,6 @@ def is_allowed(tweet, settings, buffer_name):
|
|||||||
def filter_tweet(tweet, settings, buffer_name):
|
def filter_tweet(tweet, settings, buffer_name):
|
||||||
for i in settings["filters"]:
|
for i in settings["filters"]:
|
||||||
if settings["filters"][i]["in_buffer"] == buffer_name:
|
if settings["filters"][i]["in_buffer"] == buffer_name:
|
||||||
result = True
|
|
||||||
regexp = settings["filters"][i]["regexp"]
|
regexp = settings["filters"][i]["regexp"]
|
||||||
word = settings["filters"][i]["word"]
|
word = settings["filters"][i]["word"]
|
||||||
if word != "" and settings["filters"][i]["if_word_exists"]:
|
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:
|
elif word != "" and settings["filters"][i]["if_word_exists"] == False:
|
||||||
if word in tweet["full_text"]:
|
if word in tweet["full_text"]:
|
||||||
return False
|
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"]:
|
if tweet["lang"] not in settings["filters"][i]["languages"]:
|
||||||
return False
|
return False
|
||||||
elif settings["filters"][i]["in_lang"] == False:
|
elif settings["filters"][i]["in_lang"] == "False":
|
||||||
if tweet["lang"] in settings["filters"][i]["languages"]:
|
if tweet["lang"] in settings["filters"][i]["languages"]:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user