mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
Improvements for #102
This commit is contained in:
parent
682ee82aa8
commit
6a3b498d52
@ -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"])
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user