Artwork URL API
The following .cgi's exist. getArtistArtwork, getTrackArtwork, getAlbumArtwork, getPlaylistArtwork, getGenreArtwork and getRadioStationArt. They all follow the same pattern and below is an example URL to retrieve a piece of Album Artwork:
http://localhost:60000/getAlbumArt.cgi/?fm=jpeg&w=1000&h=1000&id=ad85ea347feef2c8d232aca6e1831edf&df=true&cp=95
The IP Address and Port will need to be the correct values for the server. The Port number is 60000 and is unencrypted to minimise latency.
Although a URL with default values is returned whenever we use protocol methods that return media objects, a developer can ignore these and create their own URLs to manipulate the image that is returned. A URL contains a number of parameters of which the parameter names are case-insensitive, but the values are not. If a value is not supplied, then the default will be used. The parameters of a URL are explained below:
fm - Format: Either JPEG or PNG. Defaults to JPEG.
w - Width: Given in Pixels) and defaults to the artwork's actual width if height is also not given. Otherwise it will be scaled to match the given height correctly and maintain the aspect ratio.
h - Height: Given in Pixels). Defaults to the artwork's actual height if width is also not given. Otherwise it will be scaled to match the given width correctly and maintain the aspect ratio.
id - ID: The Identification Number of the item you are trying to receive artwork for. i.e. album id etc. In the case of getRadioStationArt it is the player id as radio tracks are transient
df - Default Picture: Boolean value that defaults to False. Whether we want the default picture to be returned if no Artwork is found. The default image will be formatted to the parameters given in the URL.
cp - Compression: The compression rate of the image from 0 - 100 with 100 being no compression and 0 being maximum. Defaults to 95 and only applies to JPEGs, it is ignored for other format types
It is possible to receive HTML Exceptions. An example of this would be if we requested an image that did not exist and set Default Image (df) to false. In this case there would be nothing to return and a '404: File Not Found' Exception would be thrown.
With the introduction of streaming services, additional parameters have been introduced for obtaining artwork from the corresponding streaming artwork service:
uid - User ID: A user account identifier. Necessary to use the correct user session when requesting artwork from a streaming service. This is required for streaming service artwork requests.
deezer - Boolean value that defaults to False. Whether we want to retrieve artwork from the Deezer artwork service. E.g for a Deezer track.
tidal - Boolean value that defaults to False. Whether we want to retrieve artwork from the TIDAL artwork service. E.g for a TIDAL track.