def get_user_playlist(self): data = self.ne.user_playlist(self.uid) for i, brief_playlist in enumerate(data): brief_playlist['uid'] = brief_playlist['userId'] brief_playlist['type'] = brief_playlist['specialType'] if brief_playlist['type'] == 5: self.favorite_pid = brief_playlist['id'] data[i] = BriefPlaylistModel(brief_playlist).get_model() return data
def get_user_playlist(self): data = self.ne.user_playlist(self.uid) if not self.is_data_avaible(data): return data playlist = data['playlist'] result_playlist = [] for i, brief_playlist in enumerate(playlist): brief_playlist['uid'] = brief_playlist['userId'] brief_playlist['type'] = brief_playlist['specialType'] if brief_playlist['type'] == 5: self.favorite_pid = brief_playlist['id'] result_playlist.append(BriefPlaylistModel(brief_playlist).get_dict()) return result_playlist
def get_user_playlist(self): user = UserDb.get_user(self.uid) if user.playlists is not None: self._set_favorite_pid(user.playlists) return user.playlists data = self.ne.user_playlist(self.uid) if not self.is_response_avaible(data): return data playlist = data['playlist'] result_playlists = [] for i, brief_playlist in enumerate(playlist): brief_playlist['uid'] = brief_playlist['userId'] brief_playlist['type'] = brief_playlist['specialType'] result_playlists.append( BriefPlaylistModel(brief_playlist).get_dict()) self._set_favorite_pid(result_playlists) user.update(_playlists=pickle.dumps(result_playlists)) return result_playlists