7#ifndef ALBUM_ART_PROVIDER_H
8#define ALBUM_ART_PROVIDER_H
14#include <curlpp/Easy.hpp>
15#include <curlpp/Options.hpp>
16#include <curlpp/cURLpp.hpp>
19#include <giomm/memoryinputstream.h>
20#include <gdkmm/pixbuf.h>
28 const char*
what()
const throw() {
29 return "Album art provider could not initialize. Please check your environment variables.";
35 const char*
what()
const throw() {
36 return "Resource could not be found.";
42 Glib::RefPtr<Gdk::Pixbuf>
art;
66 virtual std::vector<AlbumArt>
album_art(
const std::string& artist,
const std::string& title,
const int width,
const int height) = 0;
79 static std::string
url_with_params(
const std::string& url,
const std::map<std::string, std::string>& params);
84 static std::string
url_encode(
const std::string& input);
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.
virtual void init()
Initializes the AlbumArtProvider (i.e. retrieve an API key).
static AlbumArtProvider * _instance
The global AlbumArtProvider instance.
static std::string url_encode(const std::string &input)
Encodes an arbitrary string into a query parameter value.
static void destroy()
Destroys the AlbumArtProvider.
AlbumArtProvider()
AlbumArtProvider constructor.
static AlbumArtProvider * instance()
Factory method to return the album art provider. It may be called one or more times....
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.
virtual ~AlbumArtProvider()
AlbumArtProvider destructor.
An album art image and its URL.
Glib::RefPtr< Gdk::Pixbuf > art
Thrown when the provider cannot be reached.
const char * what() const
Thrown when the provider cannot find album art images.
const char * what() const