diff --git a/src/controller/buffers.py b/src/controller/buffers.py index f52f992..b529111 100644 --- a/src/controller/buffers.py +++ b/src/controller/buffers.py @@ -118,6 +118,8 @@ class feedBuffer(baseBuffer): else: [self.insert(i) for i in self.session.db[self.name]["items"][:num]] + def update(self): + output.speak(_(u"Wall buffers can't get up to 100 items.")) class audioBuffer(feedBuffer): def create_tab(self, parent): diff --git a/src/controller/mainController.py b/src/controller/mainController.py index c5b0594..4248bac 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -38,15 +38,15 @@ class Controller(object): self.connect_events() def create_controls(self): - home = buffers.baseBuffer(parent=self.window.tb, name="home_timeline", session=self.session, composefunc="compose_new", endpoint="newsfeed", identifier="id") + home = buffers.baseBuffer(parent=self.window.tb, name="home_timeline", session=self.session, composefunc="compose_new", endpoint="newsfeed") self.buffers.append(home) self.window.add_buffer(home.tab, _(u"Home")) self.repeatedUpdate = RepeatingTimer(180, self.update_all_buffers) self.repeatedUpdate.start() - feed = buffers.feedBuffer(parent=self.window.tb, name="me_feed", composefunc="compose_status", session=self.session, endpoint="get", parent_endpoint="wall", identifier="id") + feed = buffers.feedBuffer(parent=self.window.tb, name="me_feed", composefunc="compose_status", session=self.session, endpoint="get", parent_endpoint="wall") self.buffers.append(feed) self.window.add_buffer(feed.tab, _(u"My wall")) - audio = buffers.audioBuffer(parent=self.window.tb, name="me_audio", composefunc="compose_audio", session=self.session, endpoint="get", parent_endpoint="audio", full_list=True, identifier="aid") + audio = buffers.audioBuffer(parent=self.window.tb, name="me_audio", composefunc="compose_audio", session=self.session, endpoint="get", parent_endpoint="audio", full_list=True) self.buffers.append(audio) self.window.add_buffer(audio.tab, _(u"My audios")) @@ -93,7 +93,6 @@ class Controller(object): call_threaded(player.player.play, audio_object) def view_post(self, post_object, controller_): - print controller_ p = getattr(posts, controller_)(self.session, post_object) p.dialog.get_response() p.dialog.Destroy() @@ -105,5 +104,4 @@ class Controller(object): def update_buffer(self, *args, **kwargs): b = self.get_current_buffer() - b.update() - print "updated" \ No newline at end of file + b.get_items() diff --git a/src/sessionmanager/session.py b/src/sessionmanager/session.py index ed7dadb..4cf7ac8 100644 --- a/src/sessionmanager/session.py +++ b/src/sessionmanager/session.py @@ -14,16 +14,17 @@ sessions = {} # Saves possible set of identifier keys for VK'S data types # see https://vk.com/dev/datatypes for more information. # I've added the Date identifier (this is a field in unix time format), for special objects (like friendships indicators) because these objects doesn't have an own identifier. -identifiers = ["aid", "gid", "uid", "pid", "id", "post_id", "nid", "date"] +identifiers = ["date", "aid", "gid", "uid", "pid", "id", "post_id", "nid", "date"] def find_item(list, item): """ Finds an item in a list by taking an identifier""" # determines the kind of identifier that we are using global identifiers - identifier = None - for i in identifiers: - if item.has_key(i): - identifier = i + identifier = "date" +# for i in identifiers: +# if item.has_key(i): +# identifier = i +# break if identifier == None: # if there are objects that can't be processed by lack of identifier, let's print keys for finding one. print item.keys() @@ -125,14 +126,14 @@ class vkSession(object): if i.has_key("type") and i["type"] == "wall_photo": continue if find_item(self.db[name]["items"], i) == False: # if i not in self.db[name]["items"]: - if first_addition or show_nextpage == True: + if first_addition == True or show_nextpage == True: if self.settings["general"]["reverse_timelines"] == False: self.db[name]["items"].append(i) else: self.db[name]["items"].insert(0, i) else: if self.settings["general"]["reverse_timelines"] == False: self.db[name]["items"].insert(0, i) else: self.db[name]["items"].append(i) num = num+1 - + print len(self.db[name]["items"]) return num def __init__(self, session_id): @@ -186,14 +187,14 @@ class vkSession(object): def get_newsfeed(self, name="newsfeed", show_nextpage=False, endpoint="", *args, **kwargs): if show_nextpage == True: kwargs["start_from"] = self.db[name]["cursor"] - kwargs["v"] = "5.21" + print kwargs data = getattr(self.vk.client.newsfeed, "get")(*args, **kwargs) if data != None: if show_nextpage == False: self.process_usernames(data) - else: - print data.keys() - num = self.order_buffer(name, data["items"][:-1], show_nextpage) +# else: +# print data.keys(), len(data["items"]), data["next_from"] + num = self.order_buffer(name, data["items"], show_nextpage) print data.keys() self.db[name]["cursor"] = data["next_from"] return num