application.integrations.subsonic.objects package#

Submodules#

application.integrations.subsonic.objects.album module#

Subsonic API Album Object

class application.integrations.subsonic.objects.album.Album(id, isDir, title, album, playCount, created, _query, _stream, artist=None, year=None, genre=None, coverArt=None, averageRating=None, parent=None)#

Bases: object

Represents a music album with metadata and related operations.

id#

Unique identifier for the album.

Type:

str

isDir#

Indicates if the album is a directory.

Type:

bool

title#

Title of the album.

Type:

str

album#

Album name.

Type:

str

playCount#

Number of times the album has been played.

Type:

int

created#

Creation date of the album.

Type:

str

artist#

Name of the artist.

Type:

Optional[str]

year#

Release year of the album.

Type:

Optional[int]

genre#

Genre of the album.

Type:

Optional[str]

coverArt#

Identifier for the album’s cover art.

Type:

Optional[str]

averageRating#

Average user rating of the album.

Type:

Optional[float]

parent#

Identifier of the parent directory or album.

Type:

Optional[str]

songs(list[Song])#

Returns a list of Song objects in the album, fetched via API.

cover(str)#

Returns the base64-encoded cover art for the album, caching results for efficiency.

album: str#
artist: Optional[str] = None#
averageRating: Optional[float] = None#
property cover: str#

Retrieves the album cover art as a base64-encoded string.

If the cover art is not already cached, it queries for the cover art data, encodes it in base64, and stores it in the cache. Returns the cached base64-encoded cover art string, or an empty string if not available.

Returns:

The base64-encoded cover art string, or an empty string if not found.

Return type:

str

coverArt: Optional[str] = None#
created: str#
genre: Optional[str] = None#
id: str#
isDir: bool#
parent: Optional[str] = None#
playCount: int#
property songs: list[Song]#

Retrieves a list of Song objects associated with the album.

Returns:

A list of Song instances representing the songs in the album.

Return type:

list[Song]

title: str#
year: Optional[int] = None#

application.integrations.subsonic.objects.artist module#

Subsonic API Artist Object

class application.integrations.subsonic.objects.artist.Artist(id, name)#

Bases: object

Represents a musical artist.

id#

Unique identifier for the artist.

Type:

str

name#

Name of the artist.

Type:

str

id: str#
name: str#

application.integrations.subsonic.objects.ping module#

Subsonic API Ping Object

class application.integrations.subsonic.objects.ping.Ping(status, version, type)#

Bases: object

Represents a ping response object with status, version, and type attributes.

status#

The status of the ping response (e.g., ‘ok’).

Type:

str

version#

The version of the ping response.

Type:

str

type#

The type of the ping response.

Type:

str

Properties:

ok (bool): Returns True if the status is ‘ok’, otherwise False.

property ok: bool#

Check if the status of the object is ‘ok’.

Returns:

True if the status is ‘ok’, False otherwise.

Return type:

bool

status: str#
type: str#
version: str#

application.integrations.subsonic.objects.playlist module#

Subsonic API Playlist Object

class application.integrations.subsonic.objects.playlist.Playlist(id, name, comment, owner, public, songCount, duration, created, coverArt, _query, _stream, changed=None, entry=None)#

Bases: object

Represents a music playlist with metadata and song entries.

id#

Unique identifier for the playlist.

Type:

str

name#

Name of the playlist.

Type:

str

comment#

Optional comment or description.

Type:

str

owner#

Username of the playlist owner.

Type:

str

public#

Indicates if the playlist is public.

Type:

bool

songCount#

Number of songs in the playlist.

Type:

int

duration#

Total duration of the playlist in seconds.

Type:

int

created#

Creation timestamp of the playlist.

Type:

str

coverArt#

Identifier for the playlist’s cover art.

Type:

str

changed#

Timestamp of the last modification.

Type:

Optional[str]

entry#

Raw song entry data for the playlist.

Type:

Optional[list]

songs -> list[Song]

Returns a list of Song objects in the playlist. If entries are not cached, fetches them using the provided query callable.

changed: Optional[str] = None#
comment: str#
coverArt: str#
created: str#
duration: int#
entry: Optional[list] = None#
id: str#
name: str#
owner: str#
public: bool#
songCount: int#
property songs: list[Song]#

Retrieves a list of Song objects associated with the playlist.

If the playlist entries are not already loaded, it queries the backend for the playlist data using the playlist ID and extracts the entries. Otherwise, it uses the existing entries.

Returns:

A list of Song objects representing the songs in the playlist.

Return type:

list[Song]

application.integrations.subsonic.objects.search_results module#

Subsonic API Search Results Object

class application.integrations.subsonic.objects.search_results.SearchResults(artist, album, song, *, query, stream)#

Bases: object

Represents the results of a search, containing lists of artists, albums, and songs.

Parameters:
  • artist (list[dict]) – List of dictionaries representing artist data.

  • album (list[dict]) – List of dictionaries representing album data.

  • song (list[dict]) – List of dictionaries representing song data.

  • query (Callable) – A callable used for querying additional data (passed to Album).

  • stream (Callable) – A callable used for streaming data (passed to Album and Song).

artists#

List of Artist objects created from the input data.

Type:

list[Artist]

albums#

List of Album objects created from the input data, with query and stream callables.

Type:

list[Album]

songs#

List of Song objects created from the input data, with stream callable.

Type:

list[Song]

__repr__()#

Returns a string representation of the SearchResults object, showing counts of artists, albums, and songs.

application.integrations.subsonic.objects.song module#

Subsonic API Song Object

class application.integrations.subsonic.objects.song.Song(id, parent, isDir, title, album, playCount, created, _stream, size=0, contentType='', suffix='', duration=0, bitRate=0, path='', isVideo=False, albumId='0', type='music', coverArt=None, artist=None, artistId=None, track=None, year=None, genre=None, discNumber=None, transcodedContentType=None, transcodedSuffix=None, averageRating=None)#

Bases: object

Represents a song object with metadata and streaming capabilities.

id#

Unique identifier for the song.

Type:

str

parent#

Identifier of the parent directory or collection.

Type:

str

isDir#

Indicates if the object is a directory.

Type:

bool

title#

Title of the song.

Type:

str

album#

Album name the song belongs to.

Type:

str

playCount#

Number of times the song has been played.

Type:

int

created#

Date and time when the song was created.

Type:

datetime

size#

Size of the song file in bytes.

Type:

int

contentType#

MIME type of the song file.

Type:

str

suffix#

File extension of the song.

Type:

str

duration#

Duration of the song in seconds.

Type:

int

bitRate#

Bitrate of the song in kbps.

Type:

int

path#

Filesystem path to the song.

Type:

str

isVideo#

Indicates if the file is a video.

Type:

bool

albumId#

Identifier for the album.

Type:

str

type#

Type of media (default is ‘music’).

Type:

str

coverArt#

Identifier or path to the cover art image.

Type:

Optional[str]

artist#

Name of the artist.

Type:

Optional[str]

artistId#

Identifier for the artist.

Type:

Optional[str]

track#

Track number in the album.

Type:

Optional[int]

year#

Year of release.

Type:

Optional[int]

genre#

Genre of the song.

Type:

Optional[str]

discNumber#

Disc number in a multi-disc album.

Type:

Optional[int]

transcodedContentType#

MIME type of the transcoded file.

Type:

Optional[str]

transcodedSuffix#

File extension of the transcoded file.

Type:

Optional[str]

averageRating#

Average user rating for the song.

Type:

Optional[str]

Properties:

uri (str): Returns the streaming URI for the song using the provided stream function.

Private Attributes:

_stream (Callable[[str], str]): Function to generate a streaming URI for the song.

album: str#
albumId: str = '0'#
artist: Optional[str] = None#
artistId: Optional[str] = None#
averageRating: Optional[str] = None#
bitRate: int = 0#
contentType: str = ''#
coverArt: Optional[str] = None#
created: datetime#
discNumber: Optional[int] = None#
duration: int = 0#
genre: Optional[str] = None#
id: str#
isDir: bool#
isVideo: bool = False#
parent: str#
path: str = ''#
playCount: int#
size: int = 0#
suffix: str = ''#
title: str#
track: Optional[int] = None#
transcodedContentType: Optional[str] = None#
transcodedSuffix: Optional[str] = None#
type: str = 'music'#
property uri: str#
year: Optional[int] = None#

Module contents#

Subsonic API Objects