Esempio n. 1
0
 def do_albums_random(self, line):
     '''
     Display a random selection of albums
     Usage: albums_random
     '''
     logger.debug('call function do_albums_random')
     albums_pos = random.sample(xrange(self.nb_albums), DISPLAY_NB_LINES)
     fancy_disp.albums_index(albums_pos, self.albums)
Esempio n. 2
0
 def do_albums_random(self, line):
     '''
     Display a random selection of albums
     Usage: albums_random
     '''
     logger.debug('call function do_albums_random')
     albums_pos = random.sample(xrange(self.nb_albums), DISPLAY_NB_LINES)
     fancy_disp.albums_index(albums_pos, self.albums)
Esempio n. 3
0
 def do_albums_recent(self, line):
     '''
     Display recently added albums
     Usage: albums_recent
     '''
     logger.debug('call function do_albums_recent')
     albums_pos = range(self.nb_albums + 1 - DISPLAY_NB_LINES,
                        self.nb_albums + 1)
     fancy_disp.albums_index(albums_pos, self.albums)
Esempio n. 4
0
 def do_albums_recent(self, line):
     '''
     Display recently added albums
     Usage: albums_recent
     '''
     logger.debug('call function do_albums_recent')
     albums_pos = range(
             self.nb_albums + 1 - DISPLAY_NB_LINES, 
             self.nb_albums + 1)
     fancy_disp.albums_index(albums_pos, self.albums)
Esempio n. 5
0
 def do_albums_search(self, line):
     '''
     Search into the albums
     Usage: albums_search string
         List all albums containing the string in the title or artist.
     '''
     logger.debug('call function do_albums_search')
     search_string = line.lower()
     #TODO: general refactor to album_ids (pos should not be used)
     albums_pos = get_albums_search(search_string, self.albums)
     fancy_disp.albums_index(albums_pos, self.albums)
Esempio n. 6
0
 def do_albums_search(self, line):
     '''
     Search into the albums
     Usage: albums_search string
         List all albums containing the string in the title or artist.
     '''
     logger.debug('call function do_albums_search')
     search_string = line.lower()
     #TODO: general refactor to album_ids (pos should not be used)
     albums_pos = get_albums_search(search_string, self.albums)
     fancy_disp.albums_index(albums_pos, self.albums)
Esempio n. 7
0
 def do_albums_page(self, line):
     '''
     Display a given page of the albums library
     Usage: albums_page [page]
         The page is optional, a random page is displayed without it.
     '''
     logger.debug('call function do_albums_page')
     page_nb = parse_single_int(line)
     if not page_nb:
         logger.info('no page number provided')
         page_nb = random.randrange(int(self.nb_albums / 10) + 1)
     albums_pos = range((page_nb - 1) * DISPLAY_NB_LINES,
                        page_nb * DISPLAY_NB_LINES)
     logger.debug('albums index range: %s', albums_pos)
     # clean this conversion
     album_ids = []
     for album_pos in albums_pos:
         album_ids.append(self.albums.keys()[album_pos])
     logger.debug('albums id range: %s', album_ids)
     fancy_disp.albums_index(album_ids, self.albums)
Esempio n. 8
0
 def do_albums_page(self, line):
     '''
     Display a given page of the albums library
     Usage: albums_page [page]
         The page is optional, a random page is displayed without it.
     '''
     logger.debug('call function do_albums_page')
     page_nb = parse_single_int(line)
     if not page_nb:
         logger.info('no page number provided')
         page_nb = random.randrange(int(self.nb_albums / 10) + 1)
     albums_pos = range(
             (page_nb - 1) * DISPLAY_NB_LINES,
             page_nb * DISPLAY_NB_LINES)
     logger.debug('albums index range: %s', albums_pos)
     # clean this conversion
     album_ids = []
     for album_pos in albums_pos:
         album_ids.append(self.albums.keys()[album_pos])
     logger.debug('albums id range: %s', album_ids)
     fancy_disp.albums_index(album_ids, self.albums)