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 #include "JamendoInfoParser.h" 0018 0019 #include "core/support/Debug.h" 0020 #include "JamendoMeta.h" 0021 0022 #include <KLocalizedString> 0023 0024 using namespace Meta; 0025 0026 JamendoInfoParser::JamendoInfoParser() 0027 : InfoParserBase() 0028 { 0029 } 0030 0031 JamendoInfoParser::~JamendoInfoParser() 0032 { 0033 } 0034 0035 void 0036 JamendoInfoParser::getInfo(ArtistPtr artist) 0037 { 0038 DEBUG_BLOCK 0039 JamendoArtist * jamendoArtist = dynamic_cast<JamendoArtist *> ( artist.data() ); 0040 if ( jamendoArtist == 0) 0041 return; 0042 0043 QString description = jamendoArtist->description(); 0044 0045 if ( description.isEmpty() ) 0046 description = i18n( "No description available..." ); 0047 0048 QString infoHtml = "<HTML><HEAD><META HTTP-EQUIV=\"Content-Type\" " 0049 "CONTENT=\"text/html; charset=utf-8\"></HEAD><BODY>"; 0050 infoHtml += "<div align=\"center\">"; 0051 infoHtml += i18n( "Artist" ) + "<br><br>"; 0052 infoHtml += "<strong>"; 0053 infoHtml += jamendoArtist->prettyName(); 0054 infoHtml += "</strong><br><br><em>"; 0055 0056 if ( !jamendoArtist->photoURL().isEmpty() ) 0057 infoHtml += "<img src=\"" + jamendoArtist->photoURL() + 0058 "\" align=\"middle\" border=\"1\"><br><br>"; 0059 0060 infoHtml += description; 0061 infoHtml += "<br><br>" + i18n( "From Jamendo.com" ) + "</div>"; 0062 infoHtml += "</BODY></HTML>"; 0063 0064 emit( info( infoHtml ) ); 0065 } 0066 0067 void 0068 JamendoInfoParser::getInfo(AlbumPtr album) 0069 { 0070 DEBUG_BLOCK 0071 JamendoAlbum * jamendoAlbum = dynamic_cast<JamendoAlbum *> ( album.data() ); 0072 if ( jamendoAlbum == 0) return; 0073 0074 QString description = jamendoAlbum->description(); 0075 0076 if ( description.isEmpty() ) 0077 description = i18n( "No description available..." ); 0078 0079 0080 QString infoHtml = "<HTML><HEAD><META HTTP-EQUIV=\"Content-Type\" " 0081 "CONTENT=\"text/html; charset=utf-8\"></HEAD><BODY>"; 0082 infoHtml += "<div align=\"center\">"; 0083 infoHtml += i18n( "Album" ) + "<br><br>"; 0084 infoHtml += "<strong>"; 0085 infoHtml += jamendoAlbum->prettyName(); 0086 infoHtml += "</strong><br><br><em>"; 0087 0088 if ( !jamendoAlbum->coverUrl().isEmpty() ) 0089 infoHtml += "<img src=\"" + jamendoAlbum->coverUrl() + 0090 "\" align=\"middle\" border=\"1\"><br><br>"; 0091 0092 infoHtml += description; 0093 infoHtml += "<br><br>" + i18n( "From Jamendo.com" ) + "</div>"; 0094 infoHtml += "</BODY></HTML>"; 0095 0096 emit( info( infoHtml ) ); 0097 } 0098 0099 void 0100 JamendoInfoParser::getInfo(TrackPtr track) 0101 { 0102 DEBUG_BLOCK 0103 JamendoTrack * jamendoTrack = dynamic_cast<JamendoTrack *> ( track.data() ); 0104 if ( jamendoTrack == 0) return; 0105 0106 QString infoHtml = "<HTML><HEAD><META HTTP-EQUIV=\"Content-Type\" " 0107 "CONTENT=\"text/html; charset=utf-8\"></HEAD><BODY>"; 0108 infoHtml += "<div align=\"center\">"; 0109 infoHtml += i18n( "Track" ) + "<br><br>"; 0110 infoHtml += "<strong>"; 0111 infoHtml += jamendoTrack->prettyName(); 0112 infoHtml += "</strong><br><br><em>"; 0113 infoHtml += "<br><br>" + i18n( "From Jamendo.com" ) + "</div>"; 0114 infoHtml += "</BODY></HTML>"; 0115 0116 emit( info( infoHtml ) ); 0117 } 0118 0119