added popular and recommendations for audios

This commit is contained in:
Manuel Cortez 2016-03-22 02:59:31 -06:00
parent 70148b2145
commit 821423844f
2 changed files with 10 additions and 2 deletions

View File

@ -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) 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.buffers.append(audio)
self.window.add_buffer(audio.tab, _(u"My audios")) 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): def connect_events(self):
pub.subscribe(self.in_post, "posted") pub.subscribe(self.in_post, "posted")

View File

@ -207,8 +207,10 @@ class vkSession(object):
p = getattr(self.vk.client, p) p = getattr(self.vk.client, p)
data = getattr(p, endpoint)(*args, **kwargs) data = getattr(p, endpoint)(*args, **kwargs)
if data != None: if data != None:
num = self.order_buffer(name, data["items"], show_nextpage) if type(data) == dict:
ids = "" num = self.order_buffer(name, data["items"], show_nextpage)
else:
num = self.order_buffer(name, data, show_nextpage)
return num return num
def get_user_name(self, user_id): def get_user_name(self, user_id):