library.py
def build_albums_store(self, store, list_filter=None):
        """
        list_filter type
        ------------------------------
        None              No filter
        function          The album object is passed as a parameter for each album. Returns True if the album should be included.
        string (1 char)   Albums beginning with that letter are filtered
        string (2+ chars) Albums by that artist are shown
        """
        artist_filter = False
        
        if list_filter == None:
            filter_fun = lambda x: True
        elif callable(list_filter):
            filter_fun = list_filter
        elif type(list_filter) is str or type(list_filter) is unicode:
            if len(list_filter) == 1:
                filter_fun = lambda x: x.title[0].upper() == list_filter.upper()
            else:
                artist_filter = True
                filter_fun = lambda x: x.artist.upper() == list_filter.upper()
        else:
            filter_fun = None
        
        self.albums_store = [x for x in
                        functools.reduce(lambda acc, val: ([] if acc == None else acc) + dict_to_list(val.albums),
                               dict_to_list(self.artists),
                               []) if filter_fun(x)]
        self.albums_store.sort(key=lambda x: x.year)

        if artist_filter:
            self.albums_store = [AllAlbums(list_filter)] + self.albums_store
        
        store.clear()
        for album in self.albums_store:
            store.append(None, self.create_album(album))

        list_filter type
        ------------------------------
        None              No filter
        function          The album object is passed as a parameter for each album. Returns True if the album should be included.
        string (1 char)   Albums beginning with that letter are filtered
        string (2+ chars) Albums by that artist are shown
        
list_filter type
None              No filter
function          The album object is passed as a parameter for each album. Returns True if the album should be included.
string (1 char)   Albums beginning with that letter are filtered
string (2+ chars) Albums by that artist are shown
list_filter type None No filter function The album object is passed as a parameter for each album . Returns True if the album should be included . string ( 1 char ) Albums beginning with that letter are filtered string ( 2 + chars ) Albums by that artist are shown
def build_albums_store(self, store, list_filter=None):
        artist_filter = False
        if list_filter == None:
            filter_fun = lambda x: True
        elif callable(list_filter):
            filter_fun = list_filter
        elif type(list_filter) is str or type(list_filter) is unicode:
            if len(list_filter) == 1:
                filter_fun = lambda x: x.title[0].upper() == list_filter.upper()
            else:
                artist_filter = True
                filter_fun = lambda x: x.artist.upper() == list_filter.upper()
        else:
            filter_fun = None
        self.albums_store = [x for x in
                        functools.reduce(lambda acc, val: ([] if acc == None else acc) + dict_to_list(val.albums),
                               dict_to_list(self.artists),
                               []) if filter_fun(x)]
        self.albums_store.sort(key=lambda x: x.year)
        if artist_filter:
            self.albums_store = [AllAlbums(list_filter)] + self.albums_store
        store.clear()
        for album in self.albums_store:
            store.append(None, self.create_album(album))
def build_albums_store ( self , store , list_filter = None ) : artist_filter = False if list_filter == None : filter_fun = lambda x : True elif callable ( list_filter ) : filter_fun = list_filter elif type ( list_filter ) is str or type ( list_filter ) is unicode : if len ( list_filter ) == 1 : filter_fun = lambda x : x . title [ 0 ] . upper ( ) == list_filter . upper ( ) else : artist_filter = True filter_fun = lambda x : x . artist . upper ( ) == list_filter . upper ( ) else : filter_fun = None self . albums_store = [ x for x in functools . reduce ( lambda acc , val : ( [ ] if acc == None else acc ) + dict_to_list ( val . albums ) , dict_to_list ( self . artists ) , [ ] ) if filter_fun ( x ) ] self . albums_store . sort ( key = lambda x : x . year ) if artist_filter : self . albums_store = [ AllAlbums ( list_filter ) ] + self . albums_store store . clear ( ) for album in self . albums_store : store . append ( None , self . create_album ( album ) )
list_filter type
None              No filter
function          The album object is passed as a parameter for each album.
list_filter type None No filter function The album object is passed as a parameter for each album .
"""
        list_filter type
        ------------------------------
        None              No filter
        function          The album object is passed as a parameter for each album. Returns True if the album should be included.
        string (1 char)   Albums beginning with that letter are filtered
        string (2+ chars) Albums by that artist are shown
        """
self
store
list_filter