1 /***************************************************************************
2 * Copyright (C) 2008-2012 by Andrzej Rybczak *
3 * electricityispower@gmail.com *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
21 #ifndef _LASTFM_SERVICE_H
22 #define _LASTFM_SERVICE_H
26 #ifdef HAVE_CURL_CURL_H
31 #include "scrollpad.h"
35 typedef std::map
<std::string
, std::string
> Args
;
36 typedef std::pair
<bool, std::string
> Result
;
38 virtual const char *name() = 0;
39 virtual Result
fetch(Args
&args
);
41 virtual bool checkArgs(const Args
&args
) = 0;
42 virtual void colorizeOutput(NC::Scrollpad
&w
) = 0;
45 virtual bool actionFailed(const std::string
&data
);
47 virtual bool parse(std::string
&data
) = 0;
48 virtual void postProcess(std::string
&data
);
50 virtual const char *methodName() = 0;
52 static const char *baseURL
;
53 static const char *msgParseFailed
;
56 struct ArtistInfo
: public LastfmService
58 virtual const char *name() { return "Artist info"; }
60 virtual bool checkArgs(const Args
&args
);
61 virtual void colorizeOutput(NC::Scrollpad
&w
);
64 virtual bool parse(std::string
&data
);
66 virtual const char *methodName() { return "artist.getinfo"; }
69 #endif // HAVE_CURL_CURL_H