File indexing completed on 2024-05-19 04:50:13
0001 /**************************************************************************************** 0002 * Copyright (c) 2007 Nikolaj Hald Nielsen <nhn@kde.org> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify it under * 0005 * the terms of the GNU General Public License as published by the Free Software * 0006 * Foundation; either version 2 of the License, or (at your option) any later * 0007 * version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0012 * * 0013 * You should have received a copy of the GNU General Public License along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #ifndef JAMENDOMETA_H 0018 #define JAMENDOMETA_H 0019 0020 0021 #include "../ServiceMetaBase.h" 0022 #include "../ServiceAlbumCoverDownloader.h" 0023 0024 #include <QDateTime> 0025 #include <QString> 0026 #include <QStringList> 0027 #include <QList> 0028 0029 class JamendoService; 0030 0031 class JamendoMetaFactory : public ServiceMetaFactory 0032 { 0033 0034 public: 0035 JamendoMetaFactory( const QString &dbPrefix, JamendoService * service ); 0036 virtual ~JamendoMetaFactory() {} 0037 0038 //virtual int getTrackSqlRowCount(); 0039 //virtual QString getTrackSqlRows(); 0040 virtual Meta::TrackPtr createTrack( const QStringList &rows ); 0041 0042 virtual int getAlbumSqlRowCount(); 0043 virtual QString getAlbumSqlRows(); 0044 virtual Meta::AlbumPtr createAlbum( const QStringList &rows ); 0045 0046 virtual int getArtistSqlRowCount(); 0047 virtual QString getArtistSqlRows(); 0048 virtual Meta::ArtistPtr createArtist( const QStringList &rows ); 0049 0050 //virtual int getGenreSqlRowCount(); 0051 //virtual QString getGenreSqlRows(); 0052 virtual Meta::GenrePtr createGenre( const QStringList &rows ); 0053 0054 private: 0055 0056 JamendoService * m_service; 0057 0058 }; 0059 0060 0061 namespace Meta 0062 { 0063 0064 class JamendoTrack : public ServiceTrack 0065 { 0066 public: 0067 explicit JamendoTrack( const QString &name ); 0068 explicit JamendoTrack( const QStringList &resultRow ); 0069 0070 void setService( JamendoService * service ); 0071 0072 virtual QString sourceName(); 0073 virtual QString sourceDescription(); 0074 virtual QPixmap emblem(); 0075 virtual QString scalableEmblem(); 0076 0077 /** 0078 * Get the file type. 0079 * Since jamendo uses interesting redirects, we cannot use the base implementation 0080 * which relies on getting the file type from the url. 0081 */ 0082 virtual QString type() const; 0083 0084 virtual bool isBookmarkable() const { return true; } 0085 virtual QString collectionName() const { return "Jamendo.com"; } 0086 virtual bool simpleFiltering() const { return false; } 0087 0088 private: 0089 JamendoService * m_service; 0090 }; 0091 0092 0093 class JamendoArtist : public ServiceArtist 0094 { 0095 private: 0096 0097 QString m_country; 0098 QString m_photoURL; 0099 QString m_jamendoURL; 0100 QString m_homeURL; 0101 0102 public: 0103 explicit JamendoArtist( const QString &name ); 0104 explicit JamendoArtist( const QStringList &resultRow ); 0105 0106 void setPhotoURL( const QString &photoURL ); 0107 QString photoURL() const; 0108 0109 void setCountry( const QString &country ); 0110 QString country() const; 0111 0112 void setHomeURL( const QString &homeURL ); 0113 QString homeURL() const; 0114 0115 void setJamendoURL( const QString &jamendoURL ); 0116 QString jamendoURL() const; 0117 0118 virtual bool isBookmarkable() const { return true; } 0119 virtual QString collectionName() const { return "Jamendo.com"; } 0120 virtual bool simpleFiltering() const { return false; } 0121 }; 0122 0123 0124 class JamendoAlbum : public ServiceAlbumWithCover 0125 { 0126 private: 0127 float m_popularity; 0128 QString m_coverURL; 0129 int m_launchYear; 0130 QString m_genre; 0131 0132 0133 public: 0134 explicit JamendoAlbum( const QString &name ); 0135 explicit JamendoAlbum( const QStringList &resultRow ); 0136 0137 0138 virtual QString downloadPrefix() const { return "jamendo"; } 0139 0140 void setPopularity( float popularity ); 0141 float popularity() const; 0142 0143 virtual void setCoverUrl( const QString &coverURL ); 0144 virtual QString coverUrl() const; 0145 0146 virtual QUrl imageLocation( int size = 1 ) { Q_UNUSED( size ); return QUrl( coverUrl() ); } 0147 0148 void setLaunchYear( int launchYear ); 0149 int launchYear() const; 0150 0151 void setGenre( const QString &genre ); 0152 QString genre() const; 0153 0154 void setService( JamendoService * store ); 0155 JamendoService * service(); 0156 0157 virtual bool isBookmarkable() const { return true; } 0158 virtual QString collectionName() const { return "Jamendo.com"; } 0159 virtual bool simpleFiltering() const { return false; } 0160 0161 private: 0162 JamendoService * m_service; 0163 0164 0165 }; 0166 0167 class JamendoGenre : public ServiceGenre 0168 { 0169 0170 public: 0171 explicit JamendoGenre( const QString &name ); 0172 explicit JamendoGenre( const QStringList &resultRow ); 0173 0174 virtual bool isBookmarkable() const { return true; } 0175 virtual QString collectionName() const { return "Jamendo.com"; } 0176 virtual bool simpleFiltering() const { return false; } 0177 0178 }; 0179 0180 } 0181 0182 #endif