sublime_music.adapters.api_objects module

Defines the objects that are returned by adapter methods.

class sublime_music.adapters.api_objects.Album[source]

Bases: abc.ABC

The id field is optional, because there are some situations where an adapter (such as Subsonic) sends an album name, but not an album ID.

artist: Optional[sublime_music.adapters.api_objects.Artist]
cover_art: Optional[str]
created: Optional[datetime.datetime]
duration: Optional[datetime.timedelta]
genre: Optional[sublime_music.adapters.api_objects.Genre]
id: Optional[str]
name: str
play_count: Optional[int]
song_count: Optional[int]
songs: Optional[Sequence[sublime_music.adapters.api_objects.Song]]
starred: Optional[datetime.datetime]
year: Optional[int]
class sublime_music.adapters.api_objects.Artist[source]

Bases: abc.ABC

The id field is optional, because there are some situations where an adapter (such as Subsonic) sends an artist name, but not an artist ID. This especially happens when there are multiple artists.

album_count: Optional[int]
albums: Optional[Sequence[sublime_music.adapters.api_objects.Album]]
artist_image_url: Optional[str]
biography: Optional[str] = None
id: Optional[str]
last_fm_url: Optional[str] = None
music_brainz_id: Optional[str] = None
name: str
similar_artists: Optional[Sequence[sublime_music.adapters.api_objects.Artist]] = None
starred: Optional[datetime.datetime]
class sublime_music.adapters.api_objects.Directory[source]

Bases: abc.ABC

The special directory with name and id should be used to indicate the top-level directory.

children: Sequence[Union[sublime_music.adapters.api_objects.Directory, sublime_music.adapters.api_objects.Song]]
id: str
name: Optional[str]
parent_id: Optional[str]
class sublime_music.adapters.api_objects.Genre[source]

Bases: abc.ABC

album_count: Optional[int]
name: str
song_count: Optional[int]
class sublime_music.adapters.api_objects.PlayQueue[source]

Bases: abc.ABC

changed: Optional[datetime.datetime]
changed_by: Optional[str]
current_index: Optional[int]
position: datetime.timedelta
songs: Sequence[sublime_music.adapters.api_objects.Song]
username: Optional[str]
value: Optional[str]
class sublime_music.adapters.api_objects.Playlist[source]

Bases: abc.ABC

changed: Optional[datetime.datetime]
comment: Optional[str]
cover_art: Optional[str]
created: Optional[datetime.datetime]
duration: Optional[datetime.timedelta]
id: str
name: str
owner: Optional[str]
public: Optional[bool]
song_count: Optional[int]
songs: Sequence[sublime_music.adapters.api_objects.Song]
class sublime_music.adapters.api_objects.SearchResult(query=None)[source]

Bases: object

An object representing the aggregate results of a search which can include both server and local results.

Parameters

query (Optional[str]) –

__init__(query=None)[source]
Parameters

query (Optional[str]) –

add_results(result_type, results)[source]

Adds the results to the _result_type set.

Parameters
property albums: List[sublime_music.adapters.api_objects.Album]
property artists: List[sublime_music.adapters.api_objects.Artist]
property playlists: List[sublime_music.adapters.api_objects.Playlist]
property songs: List[sublime_music.adapters.api_objects.Song]
update(other)[source]
Parameters

other (sublime_music.adapters.api_objects.SearchResult) –

class sublime_music.adapters.api_objects.Song[source]

Bases: abc.ABC

album: Optional[sublime_music.adapters.api_objects.Album]
artist: Optional[sublime_music.adapters.api_objects.Artist]
cover_art: Optional[str]
disc_number: Optional[int]
duration: Optional[datetime.timedelta]
genre: Optional[sublime_music.adapters.api_objects.Genre]
id: str
parent_id: Optional[str]
path: Optional[str]
size: Optional[int]
starred: Optional[datetime.datetime]
title: str
track: Optional[int]
user_rating: Optional[int]
year: Optional[int]
sublime_music.adapters.api_objects.similarity_ratio(query, string)[source]

Return the thefuzz.fuzz.partial_ratio between the query and the given string.

This ends up being called quite a lot, so the result is cached in an LRU cache using functools.lru_cache.

Parameters
  • query (str) – the query string

  • string (str) – the string to compare to the query string

Return type

int