def set_banner_channels(self): self.banner_thread_id += 1 banner_thread_id = copy.deepcopy(self.banner_thread_id) utils.ThreadFetch( fetch_funcs=(self.fetch_banner_channels, ()), success_funcs=(self.load_banner_channels, (banner_thread_id,)), ).start()
def start_fetch_channels(self): if self.is_finish: return self.__fetch_thread_id += 1 fetch_thread_id = copy.deepcopy(self.__fetch_thread_id) utils.ThreadFetch(fetch_funcs=(self.fetch_channels, (self.__start, )), success_funcs=(self.load_channels, (fetch_thread_id, self.__start)), fail_funcs=(self.fetch_failed, ())).start()
def load_online_lists(self): if not bplayer.is_login: return self.online_thread_id += 1 thread_id = copy.deepcopy(self.online_thread_id) utils.ThreadFetch(fetch_funcs=(bplayer.get_playlists, ()), success_funcs=(self.render_online_lists, (thread_id, ))).start()
def request_song(self, song, play=True): if self.adjust_uri_expired(song): self.request_thread_id += 1 thread_id = copy.deepcopy(self.request_thread_id) utils.ThreadFetch( fetch_funcs=(nplayer.song_detail, (song['sid'],)), success_funcs=(self.render_play_song, (play, thread_id)) ).start() else: self.play_song(song, play=True)
def load_online_playlists(self, clear=False): if clear: self.clear() if not nplayer.is_login: return self.collect_thread_id += 1 thread_id = copy.deepcopy(self.collect_thread_id) utils.ThreadFetch( fetch_funcs=(nplayer.get_collect_songs, (self.collect_page,)), success_funcs=(self.render_collect_songs, (thread_id,)) ).start()
def load_online_lists(self, args, *kwargs): try: self.category_list.delete_items([ item for item in self.items if item.list_type != MusicListItem.PLAYING_LIST_TYPE ]) except: pass self.online_thread_id += 1 thread_id = copy.deepcopy(self.online_thread_id) utils.ThreadFetch(fetch_funcs=(nplayer.user_playlist, (nplayer.uid, )), success_funcs=(self.render_online_lists, (thread_id, ))).start()
def load_onlinelist_songs(self, clear=False): if clear: self.clear() if not bplayer.is_login: return if not self.view_data: return playlist_id = self.list_id self.onlinelist_thread_id += 1 thread_id = copy.deepcopy(self.onlinelist_thread_id) utils.ThreadFetch( fetch_funcs=(bplayer.get_playlist_songs, (playlist_id,)), success_funcs=(self.render_onlinelist_songs, (thread_id,)) ).start()
def start_fetch_cover(self, channel_info): utils.ThreadFetch(fetch_funcs=(self.fetch_channel_cover, (channel_info, ))).start()
def bplayer_new_list(name): self.new_list_thread_id += 1 thread_id = copy.deepcopy(self.new_list_thread_id) utils.ThreadFetch(fetch_funcs=(bplayer.new_list, (name, )), success_funcs=(self.render_new_online_list, (thread_id, ))).start()
def login(self, args=None, *kwargs): username = self.login_box.username_entry.get_text() password = self.login_box.password_entry.get_text() utils.ThreadFetch(fetch_funcs=(nplayer.login_and_get_cookie, (username, password)), success_funcs=(self.login_success, ())).start()
def asyncSuggest(self, suggestFunc, args): self.suggestThreadId += 1 thread_id = copy.deepcopy(self.suggestThreadId) utils.ThreadFetch(fetch_funcs=(suggestFunc, args), success_funcs=(self.emitSuggestResult, (thread_id, ))).start()