mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 19:28: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")
|
next_account = string(default="control+win+shift+right")
|
||||||
previous_account = string(default="control+win+shift+left")
|
previous_account = string(default="control+win+shift+left")
|
||||||
open_conversation = string(default="control+win+c")
|
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")
|
show_hide = string(default="control+win+m")
|
||||||
post_tweet = string(default="control+win+n")
|
post_tweet = string(default="control+win+n")
|
||||||
post_reply = string(default="control+win+r")
|
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("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("args: %s, kwargs: %s" % (self.args, self.kwargs))
|
||||||
log.debug("Function: %s" % (self.function,))
|
log.debug("Function: %s" % (self.function,))
|
||||||
try:
|
# try:
|
||||||
val = getattr(self.session.twitter.twitter, self.function)(*self.args, **self.kwargs)
|
val = self.session.search(self.name, *self.args, **self.kwargs)
|
||||||
except:
|
# except:
|
||||||
return None
|
# return None
|
||||||
number_of_items = self.session.order_buffer(self.name, val["statuses"])
|
num = self.session.order_buffer(self.name, val)
|
||||||
log.debug("Number of items retrieved: %d" % (number_of_items,))
|
self.put_items_on_list(num)
|
||||||
self.put_items_on_list(number_of_items)
|
if num > 0:
|
||||||
if number_of_items > 0:
|
|
||||||
self.session.sound.play("search_updated.ogg")
|
self.session.sound.play("search_updated.ogg")
|
||||||
|
|
||||||
def remove_buffer(self):
|
def remove_buffer(self):
|
||||||
@ -616,7 +615,7 @@ class searchPeopleBufferController(peopleBufferController):
|
|||||||
log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
|
log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
|
||||||
log.debug("Function: %s" % (self.function,))
|
log.debug("Function: %s" % (self.function,))
|
||||||
try:
|
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:
|
except:
|
||||||
return
|
return
|
||||||
number_of_items = self.session.order_cursored_buffer(self.name, val)
|
number_of_items = self.session.order_cursored_buffer(self.name, val)
|
||||||
@ -655,7 +654,7 @@ class trendsBufferController(bufferController):
|
|||||||
|
|
||||||
def start_stream(self):
|
def start_stream(self):
|
||||||
try:
|
try:
|
||||||
data = self.session.twitter.twitter.get_place_trends(id=self.trendsFor)
|
data = self.session.call_paged("get_place_trends", id=self.trendsFor)
|
||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
if not hasattr(self, "name_"):
|
if not hasattr(self, "name_"):
|
||||||
@ -715,7 +714,7 @@ class conversationBufferController(searchBufferController):
|
|||||||
if tweet["in_reply_to_status_id"] == None:
|
if tweet["in_reply_to_status_id"] == None:
|
||||||
self.kwargs["since_id"] = tweet["id"]
|
self.kwargs["since_id"] = tweet["id"]
|
||||||
self.ids.append(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"]:
|
for i in val2["statuses"]:
|
||||||
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.statuses.append(i)
|
||||||
|
@ -662,7 +662,7 @@ class Controller(object):
|
|||||||
buffer = self.get_current_buffer()
|
buffer = self.get_current_buffer()
|
||||||
id = buffer.get_right_tweet()["id_str"]
|
id = buffer.get_right_tweet()["id_str"]
|
||||||
user = buffer.get_right_tweet()["user"]["screen_name"]
|
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.tweet = buffer.get_right_tweet()
|
||||||
search.start_stream(start=True)
|
search.start_stream(start=True)
|
||||||
self.buffers.append(search)
|
self.buffers.append(search)
|
||||||
|
@ -7,8 +7,6 @@ actions = {
|
|||||||
"right": _(u"Go to the next tab"),
|
"right": _(u"Go to the next tab"),
|
||||||
"next_account": _(u"Changes to the next account"),
|
"next_account": _(u"Changes to the next account"),
|
||||||
"previous_account": _(u"Changes to the previous 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"),
|
"show_hide": _(u"Show the graphical interface"),
|
||||||
"post_tweet": _(u"New tweet"),
|
"post_tweet": _(u"New tweet"),
|
||||||
"post_reply": _(u"Reply to a tweet"),
|
"post_reply": _(u"Reply to a tweet"),
|
||||||
|
@ -186,6 +186,11 @@ class Session(object):
|
|||||||
output.speak(_("%s succeeded.") % action)
|
output.speak(_("%s succeeded.") % action)
|
||||||
if _sound != None: self.sound.play(_sound)
|
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
|
@_require_login
|
||||||
def get_favourites_timeline(self, name, *args, **kwargs):
|
def get_favourites_timeline(self, name, *args, **kwargs):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user