Cover
Provides the base for obtaining and storing covers, also known as album art.
Cover Manager
- xl.covers.MANAGER = <xl.covers.CoverManager object>
The singleton
CoverManagerinstance
- class xl.covers.CoverManager(location)[source]
Handles finding covers from various sources.
- find_covers(track, limit=-1, local_only=False)[source]
Find all covers for a track
- Parameters:
track – The track to find covers for
limit – maximum number of covers to return. -1=unlimited.
local_only – If True, will only return results from local sources.
- get_cover(track, save_cover=True, set_only=False, use_default=False)[source]
get the cover for a given track. if the track has no set cover, backends are searched until a cover is found or we run out of backends.
- Parameters:
track – the Track to get the cover for.
save_cover – if True, a set_cover call will be made to store the cover for later use.
set_only – Only retrieve covers that have been set in the db.
use_default – If True, returns the default cover instead of None when no covers are found.
- get_cover_data(db_string, use_default=False)[source]
Get the raw image data for a cover.
- Parameters:
db_string – The db_string identifying the cover to get.
use_default – If True, returns the default cover instead of None when no covers are found.
- get_cover_for_tracks(tracks, db_strings_to_ignore)[source]
For tracks, try to find a cover Basically returns the first cover found :param tracks: list of tracks [xl.trax.Track] :param db_strings_to_ignore: list [str] :return: GdkPixbuf.Pixbuf or None if no cover found
- get_db_string(track: Track) str | None[source]
Returns the internal string used to map the cover to a track
- Parameters:
track (
xl.trax.Track) – the track to retrieve the string for- Returns:
the internal identifier string
- get_default_cover()[source]
Get the raw image data for the cover to show if there is no cover to display.
- on_provider_added(provider)[source]
Called when a new provider is added
- Parameters:
provider (object) – the new provider
- on_provider_removed(provider)[source]
Called when a provider is removed
- Parameters:
provider (object) – the removed provider
- set_cover(track, db_string, data=None)[source]
Sets the cover for a track. This will overwrite any existing entry.
- Parameters:
track – The track to set the cover for
db_string – the string identifying the source of the cover, in “method:key” format.
data – The raw cover data to store for the track. Will only be stored if the method has use_cache=True
Cover Search Methods
- class xl.covers.CoverSearchMethod[source]
Base class for creating cover search methods.
Search methods do not have to inherit from this class, it’s intended more as a template to demonstrate the needed interface.
- find_covers(track, limit=-1)[source]
Find the covers for a given track.
- Parameters:
track – The track to find covers for.
limit – Maximal number of covers to return.
- Returns:
A list of strings that can be passed to get_cover_data.
- get_cover_data(db_string)[source]
Get the image data for a cover
- Parameters:
db_string – A method-dependent string that identifies the cover to get.
- name = 'base'
A name uniquely identifying the search method.
- use_cache = True
If true, cover results will be cached for faster lookup