Double tweets should be ignored in streams

This commit is contained in:
Manuel Cortez 2015-09-23 10:01:00 -05:00
parent a69bf99c1a
commit 89e39e2168
2 changed files with 6 additions and 0 deletions

View File

@ -30,6 +30,9 @@ 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"]["screen_name"] == i: if data["user"]["screen_name"] == i:
if utils.find_item(data["id"], self.session.db["%s-timeline" % (i,)]) != None:
log.error("duplicated tweet. Ignoring it...")
return
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)

View File

@ -33,6 +33,9 @@ class streamer(TwythonStreamer):
def put_data(self, place, data): def put_data(self, place, data):
if self.session.db.has_key(place): if self.session.db.has_key(place):
if utils.find_item(data["id"], self.session.db[place]) != None:
log.error("duplicated tweet. Ignoring it...")
return
if self.session.settings["general"]["reverse_timelines"] == False: if self.session.settings["general"]["reverse_timelines"] == False:
self.session.db[place].append(data) self.session.db[place].append(data)
else: else: