Developers How we display covers

fossfreedom edited this page Feb 3, 2013 · 2 revisions

Some highlights:

Album loading is done in 3 phases: 
  1. Load the albums from the query model.

  2. Build the albums and add them to the model.

  3. Load all the covers, taking into account the order of the albums.

    Sorting and filtering are now done on python structures instead of the liststore. That way we have more control over the process, including the possibility to manage filters more tidily (e.g. use multiple filters).

    All interaction with it is done through the AlbumsModel object that the AlbumsManager creates. That way we can encapsulate a lot of things there without worrying on how it should be accessed from outside.

    Album class - it just takes care of those things that it definitely haves (no more searching covers or filling models with entries).

    A class for the entries themselves exists and encapsulate the access to it's properties from the DB. That way there are no more entry.get_string(...) and stuff like that all over the place.

    Another thing related to the entries: when an entry gets changed (doesn't matter what changes), a signal is emitted on the Track and the responsible Album gets notified and updates itself accordingly. At the same time, the album informs it got updated and the AlbumModel takes care of updating the model itself. This way all the parts are really decoupled and is easy to add new functionality to any part of the process.


[artist['album'] for artist in self._iters[name].values()]

That syntax is for List Comprehensions. Basically is a oneliner for:

a_list = []
for artist in self._iters[name].values():
    a_list.append(artist['album'])

The _iters object is a dictionary of dictionaries. Each _iter's key points to another dict keyed by all the artists that have an album named by that key. Then, each key of this sub-dictionary points to another dictionary that contains things related to the specific album that goes by that name an artist. The album key of this last dictionary holds a reference to the actual album object. Then basically, what that line of code does is create a new list containing only the albums with the given album name, disregarding the artist. It optimizes the search since it cuts down the search domain to the relevant albums.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.