mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 04:48:09 -06:00
Searches improvements in inverted buffers
This commit is contained in:
parent
f2bb173ddb
commit
2e70cbc298
@ -19,8 +19,6 @@ right = string(default="control+win+right")
|
||||
next_account = string(default="control+win+shift+right")
|
||||
previous_account = string(default="control+win+shift+left")
|
||||
open_conversation = string(default="control+win+c")
|
||||
conversation_up = string(default="control+win+shift+up")
|
||||
conversation_down = string(default="control+win+shift+down")
|
||||
show_hide = string(default="control+win+m")
|
||||
post_tweet = string(default="control+win+n")
|
||||
post_reply = string(default="control+win+r")
|
||||
|
@ -580,14 +580,13 @@ class searchBufferController(baseBufferController):
|
||||
log.debug("Starting stream for %s buffer, %s account and %s type" % (self.name, self.account, self.type))
|
||||
log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
|
||||
log.debug("Function: %s" % (self.function,))
|
||||
try:
|
||||
val = getattr(self.session.twitter.twitter, self.function)(*self.args, **self.kwargs)
|
||||
except:
|
||||
return None
|
||||
number_of_items = self.session.order_buffer(self.name, val["statuses"])
|
||||
log.debug("Number of items retrieved: %d" % (number_of_items,))
|
||||
self.put_items_on_list(number_of_items)
|
||||
if number_of_items > 0:
|
||||
# try:
|
||||
val = self.session.search(self.name, *self.args, **self.kwargs)
|
||||
# except:
|
||||
# return None
|
||||
num = self.session.order_buffer(self.name, val)
|
||||
self.put_items_on_list(num)
|
||||
if num > 0:
|
||||
self.session.sound.play("search_updated.ogg")
|
||||
|
||||
def remove_buffer(self):
|
||||
@ -616,7 +615,7 @@ class searchPeopleBufferController(peopleBufferController):
|
||||
log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
|
||||
log.debug("Function: %s" % (self.function,))
|
||||
try:
|
||||
val = getattr(self.session.twitter.twitter, self.function)(*self.args, **self.kwargs)
|
||||
val = self.session.call_paged(self.function, *self.args, **self.kwargs)
|
||||
except:
|
||||
return
|
||||
number_of_items = self.session.order_cursored_buffer(self.name, val)
|
||||
@ -655,7 +654,7 @@ class trendsBufferController(bufferController):
|
||||
|
||||
def start_stream(self):
|
||||
try:
|
||||
data = self.session.twitter.twitter.get_place_trends(id=self.trendsFor)
|
||||
data = self.session.call_paged("get_place_trends", id=self.trendsFor)
|
||||
except:
|
||||
return
|
||||
if not hasattr(self, "name_"):
|
||||
@ -715,7 +714,7 @@ class conversationBufferController(searchBufferController):
|
||||
if tweet["in_reply_to_status_id"] == None:
|
||||
self.kwargs["since_id"] = tweet["id"]
|
||||
self.ids.append(tweet["id"])
|
||||
val2 = getattr(self.session.twitter.twitter, self.function)(*self.args, **self.kwargs)
|
||||
val2 = self.session.call_paged(self.function, *self.args, **self.kwargs)
|
||||
for i in val2["statuses"]:
|
||||
if i["in_reply_to_status_id"] in self.ids:
|
||||
self.statuses.append(i)
|
||||
|
@ -662,7 +662,7 @@ class Controller(object):
|
||||
buffer = self.get_current_buffer()
|
||||
id = buffer.get_right_tweet()["id_str"]
|
||||
user = buffer.get_right_tweet()["user"]["screen_name"]
|
||||
search = buffersController.conversationBufferController(self.view.nb, "search", "%s-searchterm" % (id,), buffer.session, buffer.session.db["user_name"], bufferType="searchPanel", since_id=id, q="@{0}".format(user,), count=100)
|
||||
search = buffersController.conversationBufferController(self.view.nb, "search", "%s-searchterm" % (id,), buffer.session, buffer.session.db["user_name"], bufferType="searchPanel", since_id=id, q="@{0}".format(user,))
|
||||
search.tweet = buffer.get_right_tweet()
|
||||
search.start_stream(start=True)
|
||||
self.buffers.append(search)
|
||||
|
@ -7,8 +7,6 @@ actions = {
|
||||
"right": _(u"Go to the next tab"),
|
||||
"next_account": _(u"Changes to the next account"),
|
||||
"previous_account": _(u"Changes to the previous account"),
|
||||
"conversation_up": _(u"Move up one tweet in the conversation"),
|
||||
"conversation_down": _(u"Move down one tweet in the conversation"),
|
||||
"show_hide": _(u"Show the graphical interface"),
|
||||
"post_tweet": _(u"New tweet"),
|
||||
"post_reply": _(u"Reply to a tweet"),
|
||||
|
@ -186,6 +186,11 @@ class Session(object):
|
||||
output.speak(_("%s succeeded.") % action)
|
||||
if _sound != None: self.sound.play(_sound)
|
||||
|
||||
def search(self, name, *args, **kwargs):
|
||||
tl = self.twitter.twitter.search(*args, **kwargs)
|
||||
tl["statuses"].reverse()
|
||||
return tl["statuses"]
|
||||
|
||||
@_require_login
|
||||
def get_favourites_timeline(self, name, *args, **kwargs):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user