def do_songs_page(self, line): """ Display a given page of the songs library Usage: songs_page page """ logger.debug('call function do_songs_page') page = int(line) songids = self.songs.keys()[(page - 1) * DISPLAY_NB_LINES:page * DISPLAY_NB_LINES] pkd.songs_index(songids, self.songs) print
def do_songs_search(self, line): """ Search into the songs Usage: songs_search string List all songs containing the string in the title or artist. """ logger.debug('call function do_songs_search') search_string = line.lower() songids = pk.songs_search(self.songs, search_string) pkd.songs_index(songids, self.songs) print
def do_songs_random(self, line): """ Display a set of random songs Usage: songs_random Select random songs and display them. """ logger.debug('call function do_songs_random') indexes = random.sample(xrange(len(self.songs)), DISPLAY_NB_LINES) songids = [self.songs.keys()[index] for index in indexes] pkd.songs_index(songids, self.songs) print
def do_playlist_tasteprofile(self, line): """ Create a playlist from echonest taste profile Usage: playlist_tasteprofile Generate a new playlist based on echonest taste profile. The current playlist is removed before. """ logger.debug('call function do_playlist_tasteprofile') profile_id = pk.en_profile_id(self.params['echonest_key']) songids = pk.en_playlist(self.params['echonest_key'], profile_id) pk.playlist_clear(self.params) pk.playlist_add_songs(self.params, songids) pkd.songs_index(songids, self.songs) print
def do_playlist_taste_seed_type(self, line): """ Create a playlist from echonest taste profile seeded by a song type Usage: playlist_taste_seed christmas|live|studio Generate a new playlist based on your echonest taste, profile seeded by a song type. The current playlist is removed before. """ logger.debug('call function do_playlist_taste_seed_type') song_type = line profile_id = pk.en_profile_id(self.params['echonest_key']) songids = pk.en_playlist_seed_song_type(self.params['echonest_key'], profile_id, song_type) pk.playlist_clear(self.params) pk.playlist_add_songs(self.params, songids) pkd.songs_index(songids, self.songs) print