• Jean Felder's avatar
    mpris: Untangle MPRIS and playertoolbar · 9ba2d6bf
    Jean Felder authored
    MPRIS is tied with PlayerToolbar because the thumbnail updating logic
    takes place in the CoverStack from PlayerToolbar.
    In fact, on every song change the following thing happens:
    * PlayerToolbar looks up for the song's thumbnail (via its
      cover_stack) and emits a "thumbnail-updated" signal once the
      operation is finished.
    * MPRIS sends the song's metadata without the thumbnail url (it has
      not been updated yet). A bit later, once the "thumbnail-updated"
      signal is received, the metadata are sent again with the correct
      thumbnail url.
    This can result in a glitter on some MPRIS clients: the client is
    updated with an empty thumbnail, and then, very quickly, with the
    correct one.
    Fix that issue by factoring out the thumbnail cache lookup and
    directly looking up the song thumbnail from MPRIS. The disadvantage of
    this solution is that the lookup_art_file_from_cache function is
    called two times on a song change. One call from PlayerToolbar and the
    other one from mpris. However, this function call is less costy than
    sending two times the song's metadata.
    Related: #43, #172
    Closes: #101
playertoolbar.py 6.23 KB