예제 #1
0
 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()
     songs_pos = get_songs_search(search_string, self.songs)
     fancy_disp.songs_index(songs_pos, self.songs)
예제 #2
0
 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()
     songs_pos = get_songs_search(search_string, self.songs)
     fancy_disp.songs_index(songs_pos, self.songs)
예제 #3
0
 def do_songs_page(self, line):
     '''
     Display a given page of the songs library
     Usage: songss_page [page]
         The page is optional, a random page is displayed without it.
     '''
     logger.debug('call function do_songs_page')
     page_nb = parse_single_int(line)
     if not page_nb:
         logger.info('no page number provided')
         page_nb = random.randrange(int(self.nb_songs / 10) + 1)
     songs_pos = range((page_nb - 1) * DISPLAY_NB_LINES + 1,
                       page_nb * DISPLAY_NB_LINES + 1)
     fancy_disp.songs_index(songs_pos, self.songs)
예제 #4
0
 def do_songs_page(self, line):
     '''
     Display a given page of the songs library
     Usage: songss_page [page]
         The page is optional, a random page is displayed without it.
     '''
     logger.debug('call function do_songs_page')
     page_nb = parse_single_int(line)
     if not page_nb:
         logger.info('no page number provided')
         page_nb = random.randrange(int(self.nb_songs / 10) + 1)
     songs_pos = range(
             (page_nb - 1) * DISPLAY_NB_LINES + 1,
             page_nb * DISPLAY_NB_LINES + 1)
     fancy_disp.songs_index(songs_pos, self.songs)
예제 #5
0
 def do_playlist_tasteprofile(self, line):
     '''
     Create a playlist from echonest taste profile
     Usage: playlist_tasteprofile
         Generate and play a new playlist based on
         echonest taste profile. The current playlist
         is removed before.
     '''
     logger.debug('call function do_playlist_tasteprofile')
     profile_id = get_profile_id(self.api_key)
     while True:
         song_ids = echonest_playlist(self.api_key, profile_id)
         fancy_disp.songs_index(song_ids, self.songs)
         action = fancy_disp.validate_playlist()
         if action <> 'r':
             break
     if action == 'p':
         playback_stop(self.kodi_params)
         kodi_api.playlist_clear(self.kodi_params)
         populate_playlist(song_ids, self.kodi_params) 
         kodi_api.player_open(self.kodi_params)
     print
예제 #6
0
 def do_playlist_tasteprofile(self, line):
     '''
     Create a playlist from echonest taste profile
     Usage: playlist_tasteprofile
         Generate and play a new playlist based on
         echonest taste profile. The current playlist
         is removed before.
     '''
     logger.debug('call function do_playlist_tasteprofile')
     profile_id = get_profile_id(self.api_key)
     while True:
         song_ids = echonest_playlist(self.api_key, profile_id)
         fancy_disp.songs_index(song_ids, self.songs)
         action = fancy_disp.validate_playlist()
         if action <> 'r':
             break
     if action == 'p':
         playback_stop(self.kodi_params)
         kodi_api.playlist_clear(self.kodi_params)
         populate_playlist(song_ids, self.kodi_params)
         kodi_api.player_open(self.kodi_params)
     print
예제 #7
0
 def do_playlist_taste_seed(self, line):
     '''
     Create a playlist from echonest taste profile and seeded by a song
     Usage: playlist_tasteprofile song_id
         Generate and play a new playlist based on
         echonest taste profile. The current playlist
         is removed before.
     '''
     #TODO: function for a single logic and several pl methods
     logger.debug('call function do_playlist_tasteprofile')
     song_id = parse_single_int(line)
     profile_id = get_profile_id(self.api_key)
     while True:
         song_ids = echonest_pl_seed(self.api_key, profile_id, song_id)
         fancy_disp.songs_index(song_ids, self.songs)
         action = fancy_disp.validate_playlist()
         if action <> 'r':
             break
     if action == 'p':
         playback_stop(self.kodi_params)
         kodi_api.playlist_clear(self.kodi_params)
         populate_playlist(song_ids, self.kodi_params) 
         kodi_api.player_open(self.kodi_params)
     print
예제 #8
0
 def do_playlist_taste_seed(self, line):
     '''
     Create a playlist from echonest taste profile and seeded by a song
     Usage: playlist_tasteprofile song_id
         Generate and play a new playlist based on
         echonest taste profile. The current playlist
         is removed before.
     '''
     #TODO: function for a single logic and several pl methods
     logger.debug('call function do_playlist_tasteprofile')
     song_id = parse_single_int(line)
     profile_id = get_profile_id(self.api_key)
     while True:
         song_ids = echonest_pl_seed(self.api_key, profile_id, song_id)
         fancy_disp.songs_index(song_ids, self.songs)
         action = fancy_disp.validate_playlist()
         if action <> 'r':
             break
     if action == 'p':
         playback_stop(self.kodi_params)
         kodi_api.playlist_clear(self.kodi_params)
         populate_playlist(song_ids, self.kodi_params)
         kodi_api.player_open(self.kodi_params)
     print