Skip to content

Artwork API ​

English API reference for the artwork family.

This page is the primary owner for the namespaces listed below. Method names, parameter keys, and return fields follow the C++ RegisterApi handlers.

artwork ​

artwork.getAvailableArtwork ​

ParameterTypeRequiredDescription
pathstringYesTrack path. Accepts path|subsong:N.

Returns: {"artworks":"...","available":"...","error":"...","sources":"...","success":true}

js
const { artworks, sources } = await fb2k.invoke('artwork.getAvailableArtwork', {
	path: 'C:\\Music\\song.flac',
});

artwork.getAvailableTypes ​

ParameterTypeRequiredDescription
pathstringNoFalls back to the now-playing track.

Returns: {"error":"...","success":true,"types":"..."}

js
const { types } = await fb2k.invoke('artwork.getAvailableTypes', {
	path: 'C:\\Music\\song.flac',
});

artwork.getBatch ​

ParameterTypeRequiredDefaultDescription
pathsarrayYes—File path list.
typestringNofront

Returns: {"artworks":"...","error":"...","success":true}

js
const { artworks } = await fb2k.invoke('artwork.getBatch', {
	paths: ['C:\\Music\\a.flac', 'C:\\Music\\b.flac'],
});

artwork.getByPath ​

ParameterTypeRequiredDefaultDescription
pathstringYes—Track path. Accepts native paths, file://, and path|subsong:N.
typestringNofront

Returns: {"available":"...","dataUrl":"...","error":"...","mimeType":"...","path":"...","size":"...","type":"..."}

js
const { available, dataUrl } = await fb2k.invoke('artwork.getByPath', {
	path: 'C:\\Music\\song.flac',
});

artwork.getByPlaylistItem ​

ParameterTypeRequiredDefaultDescription
playlistintegerNo-1-1 selects the active playlist.
indexintegerNo-1-1 selects item 0.
typestringNofront

Returns: {"available":"...","dataUrl":"...","error":"...","index":"...","mimeType":"...","playlist":"...","size":"...","type":"..."}

js
const { available, dataUrl } = await fb2k.invoke('artwork.getByPlaylistItem', {
	index: 3,
});

artwork.getCurrent ​

ParameterTypeRequiredDefaultDescription
typestringNofront

Returns: {"available":"...","dataUrl":"...","error":"...","mimeType":"...","path":"...","reason":"...","size":"...","source":"...","type":"..."}

source valueMeaning
now_playing_managerCached current front-cover artwork.
album_art_manager_v2Artwork resolved by the album-art manager fallback.
extractorArtwork resolved directly by the file extractor fallback.
js
const { available, dataUrl, source } = await fb2k.invoke('artwork.getCurrent');

artwork.getFb2kUrl ​

ParameterTypeRequiredDefaultDescription
typestringNofront
maxSizeintegerNo00 means no downscaling.

Returns: {"available":"...","dataUrl":"...","error":"...","reason":"...","type":"..."}

js
const { available, dataUrl } = await fb2k.invoke('artwork.getFb2kUrl', {
	maxSize: 300,
});

artwork.getFb2kUrlByPath ​

ParameterTypeRequiredDefaultDescription
pathstringYes—Track path.
typestringNofront
maxSizeintegerNo00 means no downscaling.

Returns: {"available":"...","dataUrl":"...","error":"...","path":"...","type":"..."}

js
const { available, dataUrl } = await fb2k.invoke('artwork.getFb2kUrlByPath', {
	path: 'C:\\Music\\song.flac',
	maxSize: 300,
});

artwork.getFb2kUrlByPathBatch ​

ParameterTypeRequiredDefaultDescription
pathsarrayNo—Path array; provide exactly one of paths or items.
itemsarrayNo—Entries are objects with a path member; use paths for plain strings. Provide exactly one of the two.
typestringNofront
maxSizeintegerNo00 means no downscaling.

Returns: {"artworks":"...","error":"...","success":true}

js
const result = await fb2k.invoke('artwork.getFb2kUrlByPathBatch', {
    paths: ['C:\\Music\\a.flac', 'C:\\Music\\b.flac'],
    type: 'front',
});

artwork.getFolderImages ​

ParameterTypeRequiredDescription
directorystringYesDirectory to scan for image files.

Returns: {"error":"...","images":"...","success":true}

js
const { images } = await fb2k.invoke('artwork.getFolderImages', {
	directory: 'C:\\Music\\Album',
});

artwork.getForTrack ​

ParameterTypeRequiredDefaultDescription
pathstringYes—Track path. Accepts native paths, file://, and path|subsong:N.
typestringNofront

Returns: {"available":"...","dataUrl":"...","error":"...","height":"...","mimeType":"...","path":"...","size":"...","type":"...","width":"..."}

js
const { available, dataUrl } = await fb2k.invoke('artwork.getForTrack', {
	path: 'C:\\Music\\song.flac',
	type: 'back',
});

artwork.getLyrics ​

ParameterTypeRequiredDescription
pathstringNoFalls back to the now-playing track.

Returns: {"available":"...","error":"...","lyrics":"...","synced":"...","tag":"..."}

js
const { available, lyrics } = await fb2k.invoke('artwork.getLyrics');

artwork.getMetadata ​

ParameterTypeRequiredDescription
pathstringNoFalls back to the now-playing track.

Returns: {"album":"...","albumArtist":"...","artist":"...","available":true,"discNumber":"...","error":"...","genre":"...","hasEmbedded":true,"hasLyrics":true,"title":"...","trackNumber":"...","year":"..."}

Multi-value tags in artist / albumArtist / genre / composer (only the fields this API actually returns) are joined with , in their original order, without de-duplication.

js
const { title, album, hasEmbedded } = await fb2k.invoke('artwork.getMetadata', {
	path: 'C:\\Music\\song.flac',
});

Usage notes ​

  • Valid artwork type values are front (also cover_front), back (also cover_back), disc, icon, and artist. Omitted type means front; an unknown value returns INVALID_PARAMS.
  • artwork.getByPath and artwork.getForTrack accept native paths, file:// paths, and path|subsong:N. They reject file-relative:// because an extractor has no playlist context; use artwork.getByPlaylistItem for those items.
  • Direct artwork reads return a standard data:image/...;base64,... URL. artwork.getFb2kUrl and its path variants instead return a fb2k://artwork/ URL in the dataUrl field. Despite the field name, that value is not a Data URL or image bytes: it is resolved only by this component's WebView2 resource handler and is intended for immediate <img src> rendering. Do not persist it, pass it to file.write, or treat it as a system-wide URL. maxSize is applied only when it is greater than 0.
  • To save a direct-read Data URL with file.write, split it at the first comma, keep the Base64 payload after the comma, and write content: 'base64:' + payload with encoding: 'binary'. To pass the same artwork to metadata.embedArtwork, pass only the raw Base64 payload without the Data URL header and without the base64: marker.
  • artwork.getFb2kUrlByPathBatch requires exactly one array input named paths or items. Array entries may be strings or objects with a path member. It has no top-level path parameter. The result is { success, artworks }, with one available/error result for each supplied entry.
  • artwork.getAvailableArtwork reports embedded items and external source labels such as folder:cover.jpg. The implementation opens files through album_art_extractor; absence of artwork is represented by available: false, not necessarily an error.
  • artwork.getFolderImages reads a directory and returns matching .jpg, .jpeg, .png, .gif, .bmp, and .webp files. Its directory argument is subject to the runtime Read security level.