def click(self, view_manager, control_id): if control_id == SearchTracksView.button_did_you_mean: if self.__search.did_you_mean(): self._do_search(self.__search.did_you_mean()) view_manager.show() elif control_id == SearchTracksView.button_new_search: term = ask_search_term() if term: self._do_search(term) view_manager.show() elif control_id == SearchTracksView.list_id: item = self.get_list(view_manager).getSelectedItem() pos = int(item.getProperty('ListIndex')) session = view_manager.get_var('session') playlist_manager = view_manager.get_var('playlist_manager') playlist_manager.play(self.__search.tracks(), session, pos) elif control_id == SearchTracksView.context_browse_artist_button: current_track = self._get_current_track(view_manager) artist_list = [artist for artist in current_track.artists()] open_artistbrowse_albums(view_manager, artist_list) elif control_id == SearchTracksView.context_browse_album_button: album = self._get_current_track(view_manager).album() session = view_manager.get_var('session') v = AlbumTracksView(session, album) view_manager.add_view(v) elif control_id == SearchTracksView.context_toggle_star: item = self.get_list(view_manager).getSelectedItem() current_track = self._get_current_track(view_manager) if current_track is not None: if item.getProperty('IsStarred') == 'true': item.setProperty('IsStarred', 'false') track.set_starred(self.__session, [current_track], False) else: item.setProperty('IsStarred', 'true') track.set_starred(self.__session, [current_track], True)
def click(self, view_manager, control_id): if control_id == SearchTracksView.button_did_you_mean: if self.__search.did_you_mean(): self._do_search(self.__search.did_you_mean()) view_manager.show() elif control_id == SearchTracksView.button_new_search: term = ask_search_term() if term: self._do_search(term) view_manager.show() elif control_id == SearchTracksView.list_id: self._play_selected_track(view_manager) elif control_id == SearchTracksView.context_browse_artist_button: current_track = self._get_current_track(view_manager) artist_list = [artist for artist in current_track.artists()] open_artistbrowse_albums(view_manager, artist_list) elif control_id == SearchTracksView.context_browse_album_button: album = self._get_current_track(view_manager).album() session = view_manager.get_var('session') v = AlbumTracksView(session, album) view_manager.add_view(v) elif control_id == SearchTracksView.context_toggle_star: item = self.get_list(view_manager).getSelectedItem() current_track = self._get_current_track(view_manager) if current_track is not None: if item.getProperty('IsStarred') == 'true': item.setProperty('IsStarred', 'false') track.set_starred(self.__session, [current_track], False) else: item.setProperty('IsStarred', 'true') track.set_starred(self.__session, [current_track], True)
def click(self, view_manager, control_id): if control_id == SearchTracksView.button_did_you_mean: if self.__search.did_you_mean(): self._do_search(self.__search.did_you_mean) view_manager.show() elif control_id == SearchTracksView.button_new_search: term = ask_search_term() if term: self._do_search(term) view_manager.show() elif control_id == SearchTracksView.list_id: self._play_selected_track(view_manager) elif control_id == SearchTracksView.context_browse_artist_button: current_track = self._get_current_track(view_manager) artist_list = [artist for artist in current_track.artists] open_artistbrowse_albums(view_manager, artist_list) elif control_id == SearchTracksView.context_browse_album_button: album = self._get_current_track(view_manager).album session = view_manager.get_var('session') v = AlbumTracksView(session, album) view_manager.add_view(v) elif control_id == SearchTracksView.context_toggle_star: item = self.get_list(view_manager).getSelectedItem() current_track = self._get_current_track(view_manager) if current_track is not None: if item.getProperty('IsStarred') == 'true': item.setProperty('IsStarred', 'false') current_track.starred = False else: item.setProperty('IsStarred', 'true') current_track.starred = True
def _browse_artist(self, view_manager): item = self.get_list(view_manager).getSelectedItem() pos = int(item.getProperty('ListIndex')) track = self.__loader.get_track(pos) artist_list = [artist for artist in track.artists()] open_artistbrowse_albums(view_manager, artist_list)
def _do_browse_artist(self, view_manager): track = self._get_current_track(view_manager) artist_list = [artist for artist in track.artists()] open_artistbrowse_albums(view_manager, artist_list)