2
Copyright 2009 Last.fm Ltd.
3
- Primarily authored by Max Howell, Jono Cole and Doug Mansell
5
This file is part of liblastfm.
7
liblastfm is free software: you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation, either version 3 of the License, or
10
(at your option) any later version.
12
liblastfm is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with liblastfm. If not, see <http://www.gnu.org/licenses/>.
20
#ifndef LASTFM_ARTIST_H
21
#define LASTFM_ARTIST_H
23
#include <lastfm/global.h>
30
class LASTFM_DLLEXPORT Artist
39
Artist( const QString& name ) : m_name( name )
42
/** will be QUrl() unless you got this back from a getInfo or something call */
43
QUrl imageUrl( ImageSize size = Large ) const { return m_images.value( size ); }
45
bool isNull() const { return m_name.isEmpty(); }
47
/** the url for this artist's page at www.last.fm */
50
bool operator==( const Artist& that ) const { return m_name == that.m_name; }
51
bool operator!=( const Artist& that ) const { return m_name != that.m_name; }
53
operator QString() const
55
/** if no artist name is set, return the musicbrainz unknown identifier
56
* in case some part of the GUI tries to display it anyway. Note isNull
57
* returns false still. So you should have queried that! */
58
return m_name.isEmpty() ? "[unknown]" : m_name;
60
QString name() const { return QString(*this); }
62
QNetworkReply* share( const class User& recipient, const QString& message = "" );
64
QNetworkReply* getInfo() const;
65
static Artist getInfo( QNetworkReply* );
67
QNetworkReply* getSimilar() const;
68
/** The match percentage is returned from last.fm as a 4 significant
69
* figure floating point value. So we multply it by 100 to make an
70
* integer in the range of 0 to 10,000. This is possible confusing
71
* for you, but I felt it best not to lose any precision, and floats
73
static QMap<int, QString> getSimilar( QNetworkReply* );
75
/** use Tag::list to get the tag list out of the finished reply */
76
QNetworkReply* getTags() const;
77
QNetworkReply* getTopTags() const;
79
/** Last.fm dictates that you may submit at most 10 of these */
80
QNetworkReply* addTags( const QStringList& ) const;
82
QNetworkReply* search( int limit = -1 ) const;
83
static QList<Artist> list( QNetworkReply* );
85
QMap<QString, QString> params( const QString& method ) const;