/thirdparty/liblastfm2/src/types/Artist.h

http://github.com/tomahawk-player/tomahawk · C Header · 105 lines · 51 code · 23 blank · 31 comment · 2 complexity · 7c839e1c3ad299b195aa1b1aa2083473 MD5 · raw file

  1. /*
  2. Copyright 2009-2010 Last.fm Ltd.
  3. - Primarily authored by Max Howell, Jono Cole, Doug Mansell and Michael Coffey
  4. This file is part of liblastfm.
  5. liblastfm 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 3 of the License, or
  8. (at your option) any later version.
  9. liblastfm is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with liblastfm. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef LASTFM_ARTIST_H
  17. #define LASTFM_ARTIST_H
  18. #include <QMap>
  19. #include <QString>
  20. #include <QUrl>
  21. #include <lastfm/AbstractType>
  22. #include <lastfm/global.h>
  23. namespace lastfm
  24. {
  25. class LASTFM_DLLEXPORT Artist : public AbstractType
  26. {
  27. private:
  28. QString m_name;
  29. QList<QUrl> m_images;
  30. public:
  31. Artist() : AbstractType()
  32. {}
  33. Artist( const QString& name ) : AbstractType(), m_name( name )
  34. {}
  35. Artist( const class XmlQuery& xml );
  36. /** will be QUrl() unless you got this back from a getInfo or something call */
  37. QUrl imageUrl( ImageSize size = Large, bool square = false ) const;
  38. bool isNull() const { return m_name.isEmpty(); }
  39. /** the url for this artist's page at www.last.fm */
  40. QUrl www() const;
  41. Artist& operator=( const Artist& that ) { m_name = that.name(); m_images = that.m_images; return *this; }
  42. bool operator==( const Artist& that ) const { return m_name == that.m_name; }
  43. bool operator!=( const Artist& that ) const { return m_name != that.m_name; }
  44. bool operator<( const Artist& that ) const { return m_name < that.m_name; }
  45. operator QString() const
  46. {
  47. /** if no artist name is set, return the musicbrainz unknown identifier
  48. * in case some part of the GUI tries to display it anyway. Note isNull
  49. * returns false still. So you should have queried that! */
  50. return m_name.isEmpty() ? "[unknown]" : m_name;
  51. }
  52. QString toString() const { return name(); }
  53. QString name() const { return QString(*this); }
  54. QDomElement toDomElement( QDomDocument& ) const { return QDomElement(); }
  55. QNetworkReply* share( const QStringList& recipients, const QString& message = "", bool isPublic = true ) const;
  56. QNetworkReply* getEvents(int limit = 0) const;
  57. QNetworkReply* getInfo() const;
  58. static Artist getInfo( QNetworkReply* );
  59. QNetworkReply* getSimilar( int limit = -1 ) const;
  60. /** The match percentage is returned from last.fm as a 4 significant
  61. * figure floating point value. So we multply it by 100 to make an
  62. * integer in the range of 0 to 10,000. This is possible confusing
  63. * for you, but I felt it best not to lose any precision, and floats
  64. * aren't much fun. */
  65. static QMap<int, QString> getSimilar( QNetworkReply* );
  66. /** use Tag::list to get the tag list out of the finished reply */
  67. QNetworkReply* getTags() const;
  68. QNetworkReply* getTopTags() const;
  69. QNetworkReply* getTopTracks() const;
  70. static QStringList getTopTracks( QNetworkReply* );
  71. /** Last.fm dictates that you may submit at most 10 of these */
  72. QNetworkReply* addTags( const QStringList& ) const;
  73. QNetworkReply* search( int limit = -1 ) const;
  74. static QList<Artist> list( QNetworkReply* );
  75. QMap<QString, QString> params( const QString& method ) const;
  76. };
  77. }
  78. #endif