From f546543e9bc5599d55274805f281961e271a1902 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Thu, 14 Jan 2021 09:18:57 -0600 Subject: [PATCH] Implemented tweet searches and conversation fupport --- src/controller/buffers/twitterBuffers.py | 18 +++++++++--------- src/controller/mainController.py | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/controller/buffers/twitterBuffers.py b/src/controller/buffers/twitterBuffers.py index 6a3f1253..2dfcb11f 100644 --- a/src/controller/buffers/twitterBuffers.py +++ b/src/controller/buffers/twitterBuffers.py @@ -1248,23 +1248,23 @@ class conversationBufferController(searchBufferController): self.statuses = [] self.ids = [] self.statuses.append(self.tweet) - self.ids.append(self.tweet["id"]) + self.ids.append(self.tweet.id) tweet = self.tweet - while tweet["in_reply_to_status_id"] != None: + while tweet.in_reply_to_status_id != None: try: - tweet = self.session.twitter.show_status(id=tweet["in_reply_to_status_id"], tweet_mode="extended") + tweet = self.session.twitter.get_status(id=tweet.in_reply_to_status_id, tweet_mode="extended") except TweepError as err: break self.statuses.insert(0, tweet) - self.ids.append(tweet["id"]) - if tweet["in_reply_to_status_id"] == None: - self.kwargs["since_id"] = tweet["id"] - self.ids.append(tweet["id"]) + self.ids.append(tweet.id) + if tweet.in_reply_to_status_id == None: + self.kwargs["since_id"] = tweet.id + self.ids.append(tweet.id) val2 = self.session.search(self.name, tweet_mode="extended", *self.args, **self.kwargs) for i in val2: - if i["in_reply_to_status_id"] in self.ids: + if i.in_reply_to_status_id in self.ids: self.statuses.append(i) - self.ids.append(i["id"]) + self.ids.append(i.id) tweet = i number_of_items = self.session.order_buffer(self.name, self.statuses) log.debug("Number of items retrieved: %d" % (number_of_items,)) diff --git a/src/controller/mainController.py b/src/controller/mainController.py index 05205489..5f8c672a 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -924,7 +924,7 @@ class Controller(object): def open_conversation(self, *args, **kwargs): buffer = self.get_current_buffer() id = buffer.get_right_tweet().id_str - user = buffer.get_right_tweet().user["screen_name"] + user = buffer.get_right_tweet().user.screen_name search = twitterBuffers.conversationBufferController(self.view.nb, "search", "%s-searchterm" % (id,), buffer.session, buffer.session.db["user_name"], bufferType="searchPanel", sound="search_updated.ogg", since_id=id, q="@{0}".format(user,)) search.tweet = buffer.get_right_tweet() search.start_stream(start=True)