calliope.localsearch

Export data from the LocalSearch desktop search engine, formerly known as Tracker.

See also: cpe localsearch command.

Attributes

LOCALSEARCH_INDEXER

Classes

ContentResolver

Interface for modules that can resolve playable tracks.

LocalSearchClient

Helper functions for querying from the user's LocalSearch database.

Functions

annotate_images(localsearch, playlist)

Resolve images from local media-art cache.

resolve_content(localsearch, playlist, *args, **kwargs)

Resolve content locations from the local filesystem.

resolve_image(localsearch, playlist)

Resolve image from local media-art cache.

expand_tracks(localsearch, playlist)

Expand an album item into a list of the album's tracks.

Package Contents

class calliope.localsearch.ContentResolver

Interface for modules that can resolve playable tracks.

abstractmethod authenticate()
abstractmethod resolve_content(playlist)
Parameters:

playlist (calliope.playlist.Playlist)

Return type:

calliope.playlist.Playlist

calliope.localsearch.LOCALSEARCH_INDEXER = 'org.freedesktop.LocalSearch3'
class calliope.localsearch.LocalSearchClient(http_endpoint=None)

Bases: calliope.interface.ContentResolver

Helper functions for querying from the user’s LocalSearch database.

This class caches a LocalSearchSparqlConnection and prepared SPARQL statements. For that reason it should only be used from a single thread. Create multiple instances if you need to use this from multiple threads.

QUERIES_PATH
MAX_ROW_COUNT = 9223372036854775808
authenticate()

No-op as this is a local service.

query(query)

Run a single SPARQL query.

Parameters:

query (str)

Return type:

gi.repository.Tsparql.SparqlCursor

artist_id(artist_name)

Return the LocalSearch URN for a given artist.

Parameters:

artist_name (str)

Return type:

str

artist_name(artist_id)

Return the name of a given artist.

Parameters:

artist_id (str)

Return type:

str

artists_by_number_of_songs(limit=None)

Return a list of artists by number of songs known.

Parameters:

limit (int)

albums(filter_artist_name=None, filter_album_name=None)

Return a list of releases.

Parameters:
  • filter_artist_name (str)

  • filter_album_name (str)

track(artist_name, track_name)

Find a specific track by name.

Tries to find a track matching the given artist and title.

Returns a playlist entry, or None.

Parameters:
  • artist_name (str)

  • track_name (str)

Return type:

calliope.playlist.Item

tracks(filter_artist_name=None, filter_album_name=None)

Return a list of tracks.

Parameters:
  • filter_artist_name (str)

  • filter_album_name (str)

Return type:

calliope.playlist.Playlist

tracks_grouped_by_album(filter_artist_name=None, filter_album_name=None, filter_track_name=None)

Return all songs matching specific search criteria.

These are grouped into their respective releases. Any tracks that aren’t present on any releases will appear last. Any tracks that appear on multiple releases will appear multiple times.

Parameters:
  • filter_artist_name (str)

  • filter_album_name (str)

  • filter_track_name (str)

Return type:

calliope.playlist.Playlist

artists()

Return all artists who have at least one track available locally.

Return type:

calliope.playlist.Playlist

search(search_text)

Return a list of tracks which match ‘search_text’.

The text may be matched in the artist name, track title or album name.

Parameters:

search_text (str)

Return type:

calliope.playlist.Playlist

resolve_content(playlist)

Resolve content locations from the local filesystem.

Parameters:

playlist (calliope.playlist.Playlist)

Return type:

calliope.playlist.Playlist

calliope.localsearch.annotate_images(localsearch, playlist)

Resolve images from local media-art cache.

Parameters:
Return type:

calliope.playlist.Playlist

calliope.localsearch.resolve_content(localsearch, playlist, *args, **kwargs)

Resolve content locations from the local filesystem.

Parameters:

localsearch (LocalSearchClient)

Return type:

calliope.playlist.Playlist

calliope.localsearch.resolve_image(localsearch, playlist)

Resolve image from local media-art cache.

Parameters:
Return type:

calliope.playlist.Playlist

calliope.localsearch.expand_tracks(localsearch, playlist)

Expand an album item into a list of the album’s tracks.

Parameters:
Return type:

calliope.playlist.Playlist