def get_recommendation_tmp(self, os_type, pack_id):
recommendation = {'code': 0}
#??????
res = self.categories_human_recommend(os_type, pack_id)
for item in res:
#print "===>> category:", item['category_name'].encode("utf-8"), item['id']
if item['id'] != 8:
continue
category_id = item['id']
category_name = item['category_name']
print "====>>>> categor name, id:", category_name, category_id
#log.info("category_name:%s, category_id:%d"%(category_name, category_id))
#????tag
res = self.tags_list(os_type, pack_id, 0, category_id)
tag_names = []
for item in res:
tag_names.append(item['tag_name'])
# category + tag ????
recommendation['recommendation'] = []
recommendation['code'] = 0
cnt = 0
for item in tag_names:
"""
if cmp(item, u"????"):
#print "===>>> tag_name:", item.encode('utf-8')
print "===>>> tag_name:", item
continue
"""
print "===>>> tag_name:", item
res = self.albums_list(os_type, pack_id, category_id, item, 3)
if res.has_key('albums'):
tmp_list = res['albums']
for track in tmp_list:
print "==>>>album: ", track['album_title']
else:
pass
else:
recommendation = {'code': 0}
recommendation['error'] = 'no data'
return json.dumps(recommendation, ensure_ascii = False).encode('utf-8')
评论列表
文章目录