From 821423844f02f824aa46f940a92e8585257471be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Tue, 22 Mar 2016 02:59:31 -0600 Subject: [PATCH] added popular and recommendations for audios --- src/controller/mainController.py | 6 ++++++ src/sessionmanager/session.py | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/controller/mainController.py b/src/controller/mainController.py index a94121a..cdcfff7 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -51,6 +51,12 @@ class Controller(object): 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")) + p_audio = buffers.audioBuffer(parent=self.window.tb, name="popular_audio", composefunc="compose_audio", session=self.session, endpoint="getPopular", parent_endpoint="audio", full_list=True) + self.buffers.append(p_audio) + self.window.add_buffer(p_audio.tab, _(u"Popular audios")) + r_audio = buffers.audioBuffer(parent=self.window.tb, name="recommended_audio", composefunc="compose_audio", session=self.session, endpoint="getRecommendations", parent_endpoint="audio", full_list=True) + self.buffers.append(r_audio) + self.window.add_buffer(r_audio.tab, _(u"Recommendations")) def connect_events(self): pub.subscribe(self.in_post, "posted") diff --git a/src/sessionmanager/session.py b/src/sessionmanager/session.py index bc837f3..fd51f9a 100644 --- a/src/sessionmanager/session.py +++ b/src/sessionmanager/session.py @@ -207,8 +207,10 @@ class vkSession(object): p = getattr(self.vk.client, p) data = getattr(p, endpoint)(*args, **kwargs) if data != None: - num = self.order_buffer(name, data["items"], show_nextpage) - ids = "" + if type(data) == dict: + num = self.order_buffer(name, data["items"], show_nextpage) + else: + num = self.order_buffer(name, data, show_nextpage) return num def get_user_name(self, user_id):