Abstracts web services that provide album art images.
More...
#include <album_art_provider.h>
|
| virtual void | init () |
| | Initializes the AlbumArtProvider (i.e. retrieve an API key).
|
| |
| virtual std::vector< AlbumArt > | album_art (const std::string &artist, const std::string &title, const int width, const int height)=0 |
| | Return all album art matching the criteria, at a specific width and height.
|
| |
| AlbumArt | album_art (const std::string &url, const int width, const int height) |
| | Retrieves the album art image at a given URL.
|
| |
|
| static AlbumArtProvider * | instance () |
| | Factory method to return the album art provider. It may be called one or more times. Be sure to destroy() the instance in order to avoid leaks. It is suggested to do so in the teardown of the first caller.
|
| |
| static void | destroy () |
| | Destroys the AlbumArtProvider.
|
| |
| static std::string | url_with_params (const std::string &url, const std::map< std::string, std::string > ¶ms) |
| | Returns the URL of the API endpoint with the given parameters encoded as query parameters.
|
| |
| static std::string | url_encode (const std::string &input) |
| | Encodes an arbitrary string into a query parameter value.
|
| |
Abstracts web services that provide album art images.
Definition at line 23 of file album_art_provider.h.
◆ AlbumArtProvider()
| AlbumArtProvider::AlbumArtProvider |
( |
| ) |
|
|
inlineprotected |
◆ ~AlbumArtProvider()
| virtual AlbumArtProvider::~AlbumArtProvider |
( |
| ) |
|
|
inlineprotectedvirtual |
◆ album_art() [1/2]
| virtual std::vector< AlbumArt > AlbumArtProvider::album_art |
( |
const std::string & | artist, |
|
|
const std::string & | title, |
|
|
const int | width, |
|
|
const int | height ) |
|
pure virtual |
Return all album art matching the criteria, at a specific width and height.
- Parameters
-
| [in] | artist | Album artist. |
| [in] | title | Album title. |
| [in] | width | Album art image width. |
| [in] | height | Album art image height. |
- Returns
- A list of album art images.
Implemented in LastFM, and Spotify.
◆ album_art() [2/2]
Retrieves the album art image at a given URL.
- Parameters
-
| [in] | url | URL of the album art image to retrieve. |
| [in] | width | Width of the returned image. |
| [in] | height | Height of the returned image. |
- Returns
- An album art image.
Definition at line 64 of file album_art_provider.cc.
◆ destroy()
| void AlbumArtProvider::destroy |
( |
| ) |
|
|
static |
◆ init()
| void AlbumArtProvider::init |
( |
| ) |
|
|
virtual |
◆ instance()
Factory method to return the album art provider. It may be called one or more times. Be sure to destroy() the instance in order to avoid leaks. It is suggested to do so in the teardown of the first caller.
- Returns
- The provider that has been selected via configuration file.
Definition at line 13 of file album_art_provider.cc.
◆ url_encode()
| std::string AlbumArtProvider::url_encode |
( |
const std::string & | input | ) |
|
|
static |
Encodes an arbitrary string into a query parameter value.
- Parameters
-
| [in] | input | An arbitrary string. |
- Returns
- The URL encoded input.
Definition at line 101 of file album_art_provider.cc.
◆ url_with_params()
| std::string AlbumArtProvider::url_with_params |
( |
const std::string & | url, |
|
|
const std::map< std::string, std::string > & | params ) |
|
static |
Returns the URL of the API endpoint with the given parameters encoded as query parameters.
- Parameters
-
| [in] | url | An API endpoint. This usually corresponds to an API method. |
| [in] | params | The method parameters as key-value pairs. |
- Returns
- An API endpoint URL.
Definition at line 86 of file album_art_provider.cc.
◆ _instance
The documentation for this class was generated from the following files: