libcoverart  1.0.0
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Macros Pages
CoverArtArchive::CCoverArt Class Reference

Object for making cover art requests. More...

Public Types

enum  tImageSize { eSize_Full =0, eSize_250 =250, eSize_500 =500 }
 Enumerated type for image size. More...
 
enum  tCoverArtResult {
  eCoverArt_Success =0, eCoverArt_ConnectionError, eCoverArt_Timeout, eCoverArt_AuthenticationError,
  eCoverArt_FetchError, eCoverArt_RequestError, eCoverArt_ResourceNotFound
}
 Enumerated type for query status. More...
 

Public Member Functions

 CCoverArt (const std::string &UserAgent)
 Constructor. More...
 
 ~CCoverArt ()
 
void SetProxyHost (const std::string &ProxyHost)
 Set the proxy server to use. More...
 
void SetProxyPort (int ProxyPort)
 Set the proxy port to use. More...
 
void SetProxyUserName (const std::string &ProxyUserName)
 Set the proxy user name to use. More...
 
void SetProxyPassword (const std::string &ProxyPassword)
 Set the proxy password to use. More...
 
std::vector< unsigned char > FetchFront (const std::string &ReleaseID) const
 Request the front image for a release. More...
 
std::vector< unsigned char > FetchBack (const std::string &ReleaseID) const
 Request the back image for a release. More...
 
std::vector< unsigned char > FetchImage (const std::string &ReleaseID, const std::string &ImageID, tImageSize ImageSize=eSize_Full) const
 Fetch a specific image for a release. More...
 
CReleaseInfo ReleaseInfo (const std::string &ReleaseID) const
 Return release information for a release. More...
 
tCoverArtResult LastResult () const
 Return result of the last query. More...
 
int LastHTTPCode () const
 Return HTTP code of the last query. More...
 
std::string LastErrorMessage () const
 Return error message from the last query. More...
 
std::string Version () const
 Return the library version. More...
 

Detailed Description

Object to be used to make cover art requests

Member Enumeration Documentation

Enumerated type for query status

Enumerator
eCoverArt_Success 
eCoverArt_ConnectionError 
eCoverArt_Timeout 
eCoverArt_AuthenticationError 
eCoverArt_FetchError 
eCoverArt_RequestError 
eCoverArt_ResourceNotFound 

Enumerated type for image size

Enumerator
eSize_Full 
eSize_250 
eSize_500 

Constructor & Destructor Documentation

CoverArtArchive::CCoverArt::CCoverArt ( const std::string &  UserAgent)

Constructor

Parameters
UserAgentUser agent to use in any queries and submissions. The format is "application-version", where application is your application's name and version is a version number which may not contain a '-' character.
CoverArtArchive::CCoverArt::~CCoverArt ( )

Member Function Documentation

std::vector<unsigned char> CoverArtArchive::CCoverArt::FetchBack ( const std::string &  ReleaseID) const

Request the back image for a release

Parameters
ReleaseIDThe release ID
Returns
The downloaded image
Exceptions
CConnectionErrorAn error occurred connecting to the web server
CTimeoutErrorA timeout occurred when connecting to the web server
CAuthenticationErrorAn authentication error occurred
CFetchErrorAn error occurred fetching data
CRequestErrorThe request was invalid
CResourceNotFoundErrorThe requested resource was not found
std::vector<unsigned char> CoverArtArchive::CCoverArt::FetchFront ( const std::string &  ReleaseID) const

Request the front image for a release

Parameters
ReleaseIDThe release ID
Returns
The downloaded image
Exceptions
CConnectionErrorAn error occurred connecting to the web server
CTimeoutErrorA timeout occurred when connecting to the web server
CAuthenticationErrorAn authentication error occurred
CFetchErrorAn error occurred fetching data
CRequestErrorThe request was invalid
CResourceNotFoundErrorThe requested resource was not found
std::vector<unsigned char> CoverArtArchive::CCoverArt::FetchImage ( const std::string &  ReleaseID,
const std::string &  ImageID,
tImageSize  ImageSize = eSize_Full 
) const

Request a specific image for a release

Parameters
ReleaseIDThe release ID
ImageIDThe image ID
ImageSizeThe image size
Returns
The downloaded image
Exceptions
CConnectionErrorAn error occurred connecting to the web server
CTimeoutErrorA timeout occurred when connecting to the web server
CAuthenticationErrorAn authentication error occurred
CFetchErrorAn error occurred fetching data
CRequestErrorThe request was invalid
CResourceNotFoundErrorThe requested resource was not found
std::string CoverArtArchive::CCoverArt::LastErrorMessage ( ) const

Return the error message from the last query

Returns
Error message from last query
int CoverArtArchive::CCoverArt::LastHTTPCode ( ) const

Return the HTTP code of the last query

Returns
HTTP code of last query
tCoverArtResult CoverArtArchive::CCoverArt::LastResult ( ) const

Return the result of the last query

Returns
Result of last query
CReleaseInfo CoverArtArchive::CCoverArt::ReleaseInfo ( const std::string &  ReleaseID) const

Return release information for a release

Parameters
ReleaseIDThe release ID
Returns
Release information
Exceptions
CConnectionErrorAn error occurred connecting to the web server
CTimeoutErrorA timeout occurred when connecting to the web server
CAuthenticationErrorAn authentication error occurred
CFetchErrorAn error occurred fetching data
CRequestErrorThe request was invalid
CResourceNotFoundErrorThe requested resource was not found
void CoverArtArchive::CCoverArt::SetProxyHost ( const std::string &  ProxyHost)

Set the proxy server to use when connecting with the web server

Parameters
ProxyHostProxy server to use
void CoverArtArchive::CCoverArt::SetProxyPassword ( const std::string &  ProxyPassword)

Set the password to use when authenticating with the proxy server

Parameters
ProxyPasswordProxy server password to use
void CoverArtArchive::CCoverArt::SetProxyPort ( int  ProxyPort)

Set the proxy server port to use when connecting to the web server

Parameters
ProxyPortProxy server port to use
void CoverArtArchive::CCoverArt::SetProxyUserName ( const std::string &  ProxyUserName)

Set the user name to use when authenticating with the proxy server

Parameters
ProxyUserNameProxy user name to use
std::string CoverArtArchive::CCoverArt::Version ( ) const

Return the library version

Returns
Library version