mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 19:28:09 -06:00
Mastodon: Added reverse timeline ordering to buffers
This commit is contained in:
parent
ffbb67765d
commit
a3bc684721
@ -93,7 +93,10 @@ class BaseBuffer(base.Buffer):
|
|||||||
min_id = None
|
min_id = None
|
||||||
# toDo: Implement reverse timelines properly here.
|
# toDo: Implement reverse timelines properly here.
|
||||||
if (self.name != "favorites" and self.name != "bookmarks") and self.name in self.session.db and len(self.session.db[self.name]) > 0:
|
if (self.name != "favorites" and self.name != "bookmarks") and self.name in self.session.db and len(self.session.db[self.name]) > 0:
|
||||||
min_id = self.session.db[self.name][-1].id
|
if self.session.settings["general"]["reverse_timelines"]:
|
||||||
|
min_id = self.session.db[self.name][0].id
|
||||||
|
else:
|
||||||
|
min_id = self.session.db[self.name][-1].id
|
||||||
try:
|
try:
|
||||||
results = getattr(self.session.api, self.function)(min_id=min_id, limit=count, *self.args, **self.kwargs)
|
results = getattr(self.session.api, self.function)(min_id=min_id, limit=count, *self.args, **self.kwargs)
|
||||||
results.reverse()
|
results.reverse()
|
||||||
@ -152,7 +155,7 @@ class BaseBuffer(base.Buffer):
|
|||||||
post = self.compose_function(i, self.session.db, self.session.settings["general"]["relative_times"], self.session.settings["general"]["show_screen_names"])
|
post = self.compose_function(i, self.session.db, self.session.settings["general"]["relative_times"], self.session.settings["general"]["show_screen_names"])
|
||||||
self.buffer.list.insert_item(True, *post)
|
self.buffer.list.insert_item(True, *post)
|
||||||
else:
|
else:
|
||||||
for i in items:
|
for i in elements:
|
||||||
post = self.compose_function(i, self.session.db, self.session.settings["general"]["relative_times"], self.session.settings["general"]["show_screen_names"])
|
post = self.compose_function(i, self.session.db, self.session.settings["general"]["relative_times"], self.session.settings["general"]["show_screen_names"])
|
||||||
self.buffer.list.insert_item(False, *post)
|
self.buffer.list.insert_item(False, *post)
|
||||||
self.buffer.list.select_item(selection)
|
self.buffer.list.select_item(selection)
|
||||||
|
@ -46,9 +46,6 @@ class ConversationListBuffer(BaseBuffer):
|
|||||||
log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
|
log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
|
||||||
count = self.session.settings["general"]["max_posts_per_call"]
|
count = self.session.settings["general"]["max_posts_per_call"]
|
||||||
min_id = None
|
min_id = None
|
||||||
# toDo: Implement reverse timelines properly here.
|
|
||||||
# if (self.name != "favorites" and self.name != "bookmarks") and self.name in self.session.db and len(self.session.db[self.name]) > 0:
|
|
||||||
# min_id = self.session.db[self.name][-1].id
|
|
||||||
try:
|
try:
|
||||||
results = getattr(self.session.api, self.function)(min_id=min_id, limit=count, *self.args, **self.kwargs)
|
results = getattr(self.session.api, self.function)(min_id=min_id, limit=count, *self.args, **self.kwargs)
|
||||||
results.reverse()
|
results.reverse()
|
||||||
@ -94,7 +91,7 @@ class ConversationListBuffer(BaseBuffer):
|
|||||||
conversation = self.compose_function(i, self.session.db, self.session.settings["general"]["relative_times"], self.session.settings["general"]["show_screen_names"])
|
conversation = self.compose_function(i, self.session.db, self.session.settings["general"]["relative_times"], self.session.settings["general"]["show_screen_names"])
|
||||||
self.buffer.list.insert_item(True, *conversation)
|
self.buffer.list.insert_item(True, *conversation)
|
||||||
else:
|
else:
|
||||||
for i in items:
|
for i in elements:
|
||||||
conversation = self.compose_function(i, self.session.db, self.session.settings["general"]["relative_times"], self.session.settings["general"]["show_screen_names"])
|
conversation = self.compose_function(i, self.session.db, self.session.settings["general"]["relative_times"], self.session.settings["general"]["show_screen_names"])
|
||||||
self.buffer.list.insert_item(False, *conversation)
|
self.buffer.list.insert_item(False, *conversation)
|
||||||
self.buffer.list.select_item(selection)
|
self.buffer.list.select_item(selection)
|
||||||
|
@ -16,9 +16,6 @@ class MentionsBuffer(BaseBuffer):
|
|||||||
log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
|
log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
|
||||||
count = self.session.settings["general"]["max_posts_per_call"]
|
count = self.session.settings["general"]["max_posts_per_call"]
|
||||||
min_id = None
|
min_id = None
|
||||||
# toDo: Implement reverse timelines properly here.
|
|
||||||
# if self.name != "favorites" and self.name in self.session.db and len(self.session.db[self.name]) > 0:
|
|
||||||
# min_id = self.session.db[self.name][-1].id
|
|
||||||
try:
|
try:
|
||||||
items = getattr(self.session.api, self.function)(min_id=min_id, limit=count, exclude_types=["follow", "favourite", "reblog", "poll", "follow_request"], *self.args, **self.kwargs)
|
items = getattr(self.session.api, self.function)(min_id=min_id, limit=count, exclude_types=["follow", "favourite", "reblog", "poll", "follow_request"], *self.args, **self.kwargs)
|
||||||
items.reverse()
|
items.reverse()
|
||||||
@ -64,7 +61,7 @@ class MentionsBuffer(BaseBuffer):
|
|||||||
post = self.compose_function(i, self.session.db, self.session.settings["general"]["relative_times"], self.session.settings["general"]["show_screen_names"])
|
post = self.compose_function(i, self.session.db, self.session.settings["general"]["relative_times"], self.session.settings["general"]["show_screen_names"])
|
||||||
self.buffer.list.insert_item(True, *post)
|
self.buffer.list.insert_item(True, *post)
|
||||||
else:
|
else:
|
||||||
for i in items:
|
for i in elements:
|
||||||
post = self.compose_function(i, self.session.db, self.session.settings["general"]["relative_times"], self.session.settings["general"]["show_screen_names"])
|
post = self.compose_function(i, self.session.db, self.session.settings["general"]["relative_times"], self.session.settings["general"]["show_screen_names"])
|
||||||
self.buffer.list.insert_item(False, *post)
|
self.buffer.list.insert_item(False, *post)
|
||||||
self.buffer.list.select_item(selection)
|
self.buffer.list.select_item(selection)
|
||||||
|
@ -75,7 +75,6 @@ class UserBuffer(BaseBuffer):
|
|||||||
log.debug("Starting stream for buffer %s, account %s and type %s" % (self.name, self.account, self.type))
|
log.debug("Starting stream for buffer %s, account %s and type %s" % (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))
|
||||||
count = self.session.settings["general"]["max_posts_per_call"]
|
count = self.session.settings["general"]["max_posts_per_call"]
|
||||||
# toDo: Implement reverse timelines properly here.
|
|
||||||
try:
|
try:
|
||||||
results = getattr(self.session.api, self.function)(limit=count, *self.args, **self.kwargs)
|
results = getattr(self.session.api, self.function)(limit=count, *self.args, **self.kwargs)
|
||||||
if hasattr(results, "_pagination_next") and self.name not in self.session.db["pagination_info"]:
|
if hasattr(results, "_pagination_next") and self.name not in self.session.db["pagination_info"]:
|
||||||
@ -127,7 +126,7 @@ class UserBuffer(BaseBuffer):
|
|||||||
post = self.compose_function(i, self.session.db, self.session.settings["general"]["relative_times"], self.session.settings["general"]["show_screen_names"])
|
post = self.compose_function(i, self.session.db, self.session.settings["general"]["relative_times"], self.session.settings["general"]["show_screen_names"])
|
||||||
self.buffer.list.insert_item(True, *post)
|
self.buffer.list.insert_item(True, *post)
|
||||||
else:
|
else:
|
||||||
for i in items:
|
for i in elements:
|
||||||
post = self.compose_function(i, self.session.db, self.session.settings["general"]["relative_times"], self.session.settings["general"]["show_screen_names"])
|
post = self.compose_function(i, self.session.db, self.session.settings["general"]["relative_times"], self.session.settings["general"]["show_screen_names"])
|
||||||
self.buffer.list.insert_item(False, *post)
|
self.buffer.list.insert_item(False, *post)
|
||||||
self.buffer.list.select_item(selection)
|
self.buffer.list.select_item(selection)
|
||||||
|
Loading…
Reference in New Issue
Block a user