Skip to content

API Interface Reference

0x4B1D edited this page Feb 4, 2026 · 1 revision

API Interface Reference

The App uses a middleware module to connect the API to the main app code based on the config file entry and a set of interface objects to hold the data about the tracks.

Every API type exposes common functions that returns this kind of objects, this way the logic for a new API only needs to take care of the conversion from the raw response to the interface needed for the data type.

The interface objects inside models.py are:

  • CandidateTrack
  • TrackItemSlot
  • AlbumItemSlot
  • ArtistSubSlot
  • AlbumSubSlot
  • TrackInfoSlot

Common API functions at the moment:

for the MetaAPI:

The MetaAPI retrieves the suggestion list.

get_candidates(playlist_config) -> list(CandidateTracks)
	
Takes care of retrieving a list of suggestions from config entry.
returns a list of candidate tracks for matching with audioAPI as a list of CandidateTracks

for the AudioAPI:

The AudioAPI retrieves the audio files and the main metadata for the tracks.

search_track(f"{CandidateTrack.title} - {CandidateTrack.artist}") -> list(TrackItemSlot)

Gets a list of tracks and their info from a given prompt.
returns a list of TrackItemSlot
get_album_info(TrackItemSlot.album.id) -> AlbumItemSlot

gets info for a given album id.
returns an AlbumItemSlot to be added to TrackItemSlot
get_track_manifes(TrackItemSlot.id, TrackItemSlot.AudioQuality) -> TrackInfoSlot

gets clear mpd/manifest and file info.
returns a TrackSlotInfo
get_track_file(TrackInfoSlot.url) -> bytes

gets an audio file given the url.
return bytes (response.content)
get_album_art(TrackItemSlot.album.cover) -> bytes

get the album art from the given identifier.
return bytes (response.content)