mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 19:28:09 -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):
|
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:
|
||||||
data_ = self.session.check_quoted_status(data)
|
if utils.is_allowed(data, self.session.settings, "%s-timeline" % (i,)):
|
||||||
data_ = self.session.check_long_tweet(data_)
|
data_ = self.session.check_quoted_status(data)
|
||||||
data = data_
|
data_ = self.session.check_long_tweet(data_)
|
||||||
|
data = data_
|
||||||
# except ValueError:
|
# except ValueError:
|
||||||
# pass
|
# pass
|
||||||
if self.session.settings["general"]["reverse_timelines"] == False: self.session.db["%s-timeline" % (i,)].append(data)
|
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)
|
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)
|
pub.sendMessage("item-in-timeline", data= data, user= self.session.db["user_name"], who= i)
|
||||||
return
|
return
|
||||||
for i in self.session.lists:
|
for i in self.session.lists:
|
||||||
try:
|
try:
|
||||||
i.users.index(data["user"]["id"])
|
i.users.index(data["user"]["id"])
|
||||||
|
@ -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