libcoverart  1.0.0
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Macros Pages
CoverArt.h
Go to the documentation of this file.
1 /* --------------------------------------------------------------------------
2 
3  libcoverart - Client library to access CoverArtArchive
4 
5  Copyright (C) 2012 Andrew Hawkins
6 
7  This file is part of libcoverart.
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13 
14  libcoverart is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this library. If not, see <http://www.gnu.org/licenses/>.
21 
22  $Id$
23 
24 ----------------------------------------------------------------------------*/
25 
26 #ifndef _COVERARTARCHIVE_COVER_ART_
27 #define _COVERARTARCHIVE_COVER_ART_
28 
29 #include <string>
30 #include <vector>
31 
32 #include "coverart/ReleaseInfo.h"
33 
135 namespace CoverArtArchive
136 {
137  class CCoverArtPrivate;
138 
145  class CCoverArt
146  {
147  public:
154  {
158  };
159 
166  {
174  };
175 
186  CCoverArt(const std::string& UserAgent);
187  ~CCoverArt();
188 
197  void SetProxyHost(const std::string& ProxyHost);
198 
207  void SetProxyPort(int ProxyPort);
208 
217  void SetProxyUserName(const std::string& ProxyUserName);
218 
227  void SetProxyPassword(const std::string& ProxyPassword);
228 
246  std::vector<unsigned char> FetchFront(const std::string& ReleaseID) const;
247 
265  std::vector<unsigned char> FetchBack(const std::string& ReleaseID) const;
266 
286  std::vector<unsigned char> FetchImage(const std::string& ReleaseID, const std::string& ImageID, tImageSize ImageSize=eSize_Full) const;
287 
305  CReleaseInfo ReleaseInfo(const std::string& ReleaseID) const;
306 
315  tCoverArtResult LastResult() const;
316 
324  int LastHTTPCode() const;
325 
333  std::string LastErrorMessage() const;
334 
342  std::string Version() const;
343 
344  private:
345  CCoverArtPrivate * const m_d;
346 
347  std::vector<unsigned char> MakeRequest(const std::string& URL) const;
348  };
349 }
350 
351 #endif
void SetProxyPort(int ProxyPort)
Set the proxy port to use.
tCoverArtResult LastResult() const
Return result of the last query.
tImageSize
Definition: caa_c.h:216
std::vector< unsigned char > FetchBack(const std::string &ReleaseID) const
Request the back image for a release.
CReleaseInfo ReleaseInfo(const std::string &ReleaseID) const
Return release information for a release.
tImageSize
Enumerated type for image size.
Definition: CoverArt.h:153
Definition: CoverArt.h:156
std::string Version() const
Return the library version.
tCoverArtResult
Enumerated type for query status.
Definition: CoverArt.h:165
void SetProxyPassword(const std::string &ProxyPassword)
Set the proxy password to use.
Definition: CoverArt.h:157
int LastHTTPCode() const
Return HTTP code of the last query.
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.
void SetProxyHost(const std::string &ProxyHost)
Set the proxy server to use.
Definition: ReleaseInfo.h:36
tCoverArtResult
Definition: caa_c.h:255
Object for making cover art requests.
Definition: CoverArt.h:145
std::vector< unsigned char > FetchFront(const std::string &ReleaseID) const
Request the front image for a release.
Definition: CoverArt.h:155
std::string LastErrorMessage() const
Return error message from the last query.
void SetProxyUserName(const std::string &ProxyUserName)
Set the proxy user name to use.
CCoverArt(const std::string &UserAgent)
Constructor.