File indexing completed on 2024-05-19 04:50:22
0001 /**************************************************************************************** 0002 * Copyright (c) 2007 Casey Link <unnamedrambler@gmail.com> * 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 "Mp3tunesLockerMeta.h" 0018 #include "core/support/Debug.h" 0019 0020 //////////////////////////////////////////////////////////////////////// 0021 //ARTIST 0022 Mp3tunesLockerArtist::Mp3tunesLockerArtist( mp3tunes_locker_artist_t *artist ) 0023 : m_artistId( 0 ) 0024 , m_artistName() 0025 , m_artistSize( 0 ) 0026 , m_albumCount( 0 ) 0027 , m_trackCount( 0 ) 0028 { 0029 if( !artist ) return; 0030 0031 m_artistId = artist->artistId; 0032 m_artistName = artist->artistName; 0033 m_artistSize = artist->artistSize; 0034 m_albumCount = artist->albumCount; 0035 m_trackCount = artist->trackCount; 0036 } 0037 0038 Mp3tunesLockerArtist::~Mp3tunesLockerArtist() 0039 {} 0040 0041 int Mp3tunesLockerArtist::artistId() const 0042 { 0043 return m_artistId; 0044 } 0045 0046 QString Mp3tunesLockerArtist::artistName() const 0047 { 0048 return m_artistName; 0049 } 0050 0051 int Mp3tunesLockerArtist::artistSize() const 0052 { 0053 return m_artistSize; 0054 } 0055 0056 int Mp3tunesLockerArtist::albumCount() const 0057 { 0058 return m_albumCount; 0059 } 0060 0061 int Mp3tunesLockerArtist::trackCount() const 0062 { 0063 return m_trackCount; 0064 } 0065 //////////////////////////////////////////////////////////////////////// 0066 //ALBUM 0067 Mp3tunesLockerAlbum::Mp3tunesLockerAlbum( mp3tunes_locker_album_t *album ) 0068 : m_albumId( 0 ) 0069 , m_albumTitle() 0070 , m_artistId( 0 ) 0071 , m_artistName() 0072 , m_trackCount( 0 ) 0073 , m_albumSize( 0 ) 0074 , m_hasArt( false ) 0075 { 0076 if( !album ) return; 0077 0078 m_albumId = album->albumId; 0079 m_albumTitle = album->albumTitle; 0080 m_artistId = album->artistId; 0081 m_artistName = album->artistName; 0082 m_trackCount = album->trackCount; 0083 m_albumSize = album->albumSize; 0084 m_hasArt = album->hasArt; 0085 } 0086 0087 Mp3tunesLockerAlbum::~Mp3tunesLockerAlbum() 0088 {} 0089 0090 int Mp3tunesLockerAlbum::albumId() const 0091 { 0092 return m_albumId; 0093 } 0094 0095 QString Mp3tunesLockerAlbum::albumTitle() const 0096 { 0097 return m_albumTitle; 0098 } 0099 0100 int Mp3tunesLockerAlbum::artistId() const 0101 { 0102 return m_artistId; 0103 } 0104 0105 QString Mp3tunesLockerAlbum::artistName() const 0106 { 0107 return m_artistName; 0108 } 0109 0110 int Mp3tunesLockerAlbum::trackCount() const 0111 { 0112 return m_trackCount; 0113 } 0114 0115 int Mp3tunesLockerAlbum::albumSize() const 0116 { 0117 return m_albumSize; 0118 } 0119 0120 bool Mp3tunesLockerAlbum::hasArt() const 0121 { 0122 return m_hasArt; 0123 } 0124 //////////////////////////////////////////////////////////////////////// 0125 //TRACK 0126 Mp3tunesLockerTrack::Mp3tunesLockerTrack( mp3tunes_locker_track_t *track ) 0127 : m_trackId( 0 ) 0128 , m_trackTitle() 0129 , m_trackNumber( 0 ) 0130 , m_trackLength( 0.0 ) 0131 , m_trackFileName() 0132 , m_trackFileKey() 0133 , m_trackFileSize( 0 ) 0134 , m_downloadUrl() 0135 , m_playUrl() 0136 , m_albumId( 0 ) 0137 , m_albumTitle() 0138 , m_albumYear( 0 ) 0139 , m_artistName() 0140 , m_artistId( 0 ) 0141 { 0142 if ( !track ) return; 0143 0144 m_trackTitle = track->trackTitle; 0145 m_trackNumber = track->trackNumber; 0146 m_trackLength = track->trackLength; 0147 m_trackFileName = track->trackFileName; 0148 m_trackFileKey = track->trackFileKey; 0149 m_trackFileSize = track->trackFileSize; 0150 m_downloadUrl = track->downloadURL; 0151 m_playUrl = track->playURL; 0152 m_albumId = track->albumId; 0153 m_albumTitle = track->albumTitle; 0154 m_albumYear = track->albumYear; 0155 m_artistName = track->artistName; 0156 m_artistId = track->artistId; 0157 } 0158 0159 Mp3tunesLockerTrack::~Mp3tunesLockerTrack() 0160 {} 0161 0162 int Mp3tunesLockerTrack::trackId() const 0163 { 0164 return m_trackId; 0165 } 0166 0167 QString Mp3tunesLockerTrack::trackTitle() const 0168 { 0169 return m_trackTitle; 0170 } 0171 0172 int Mp3tunesLockerTrack::trackNumber() const 0173 { 0174 return m_trackNumber; 0175 } 0176 0177 float Mp3tunesLockerTrack::trackLength() const 0178 { 0179 return m_trackLength; 0180 } 0181 0182 QString Mp3tunesLockerTrack::trackFileName() const 0183 { 0184 return m_trackFileName; 0185 } 0186 0187 QString Mp3tunesLockerTrack::trackFileKey() const 0188 { 0189 return m_trackFileKey; 0190 } 0191 0192 int Mp3tunesLockerTrack::trackFileSize() const 0193 { 0194 return m_trackFileSize; 0195 } 0196 0197 QString Mp3tunesLockerTrack::downloadUrl() const 0198 { 0199 return m_downloadUrl; 0200 } 0201 0202 QString Mp3tunesLockerTrack::playUrl() const 0203 { 0204 return m_playUrl; 0205 } 0206 0207 int Mp3tunesLockerTrack::albumId() const 0208 { 0209 return m_albumId; 0210 } 0211 0212 QString Mp3tunesLockerTrack::albumTitle() const 0213 { 0214 return m_albumTitle; 0215 } 0216 0217 int Mp3tunesLockerTrack::albumYear() const 0218 { 0219 return m_albumYear; 0220 } 0221 0222 QString Mp3tunesLockerTrack::artistName() const 0223 { 0224 return m_artistName; 0225 } 0226 0227 int Mp3tunesLockerTrack::artistId() const 0228 { 0229 return m_artistId; 0230 } 0231 //////////////////////////////////////////////////////////////////////// 0232 //PLAYLIST 0233 Mp3tunesLockerPlaylist::Mp3tunesLockerPlaylist( mp3tunes_locker_playlist_t *playlist ) 0234 { 0235 m_playlist = ( mp3tunes_locker_playlist_t * ) malloc( sizeof( *playlist ) ); 0236 memcpy( m_playlist, playlist, sizeof( *playlist ) ); 0237 0238 m_playlist->playlistId = ( char * ) malloc( strlen( playlist->playlistId ) + 1 ); 0239 strcpy( m_playlist->playlistId, playlist->playlistId ); 0240 0241 m_playlist->playlistTitle = ( char * ) malloc( strlen( playlist->playlistTitle ) + 1 ); 0242 strcpy( m_playlist->playlistTitle, playlist->playlistTitle ); 0243 0244 m_playlist->title = ( char * ) malloc( strlen( playlist->title ) + 1 ); 0245 strcpy( m_playlist->title, playlist->title ); 0246 0247 m_playlist->fileName = ( char * ) malloc( strlen( playlist->fileName ) + 1 ); 0248 strcpy( m_playlist->fileName, playlist->fileName ); 0249 } 0250 Mp3tunesLockerPlaylist::~Mp3tunesLockerPlaylist() 0251 { 0252 free(m_playlist->fileName); 0253 free(m_playlist->title); 0254 free(m_playlist->playlistTitle); 0255 free(m_playlist->playlistId); 0256 free(m_playlist); 0257 } 0258 0259 QString Mp3tunesLockerPlaylist::playlistId() const 0260 { 0261 return QString( m_playlist->playlistId ); 0262 } 0263 0264 QString Mp3tunesLockerPlaylist::playlistTitle() const{ 0265 return QString( m_playlist->playlistTitle ); 0266 } 0267 0268 QString Mp3tunesLockerPlaylist::title() const 0269 { 0270 return QString( m_playlist->title ); 0271 } 0272 0273 QString Mp3tunesLockerPlaylist::fileName() const 0274 { 0275 return QString( m_playlist->fileName ); 0276 } 0277 0278 int Mp3tunesLockerPlaylist::fileCount() const 0279 { 0280 return m_playlist->fileCount; 0281 } 0282 0283 int Mp3tunesLockerPlaylist::playlistSize() const 0284 { 0285 return m_playlist->playlistSize; 0286 }