|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Responsible for interation with the music table. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <mpxlog.h> |
|
21 #include <mpxmedia.h> |
|
22 #include <mpxmediaarray.h> |
|
23 #include <mpxcollectionpath.h> |
|
24 #include <mpxmediageneraldefs.h> |
|
25 #include <mpxmediamusicdefs.h> |
|
26 #include <mpxmediaaudiodefs.h> |
|
27 #include <mpxmediadrmdefs.h> |
|
28 #include <mpxmediamtpdefs.h> |
|
29 #include <mpxcollectiondbhgres.rsg> |
|
30 |
|
31 #include "mpxdbcommondef.h" |
|
32 #include "mpxdbcommonstd.h" |
|
33 #include "mpxdbcommonutil.h" |
|
34 #include "mpxresource.h" |
|
35 |
|
36 #include "mpxcollectiondbdef.h" |
|
37 #include "mpxcollectiondbstd.h" |
|
38 #include "mpxdbpluginqueries.h" |
|
39 #include "mpxdbutil.h" |
|
40 #include "mpxdbmanager.h" |
|
41 #include "mpxdbmusic.h" |
|
42 |
|
43 // CONSTANTS |
|
44 |
|
45 // This is what KNullDesC album computes to for the hash |
|
46 // to-do: generate this Id through |
|
47 // MPXDbUtil::GenerateUniqueIdL(EMPXAlbum, KNullDesC, EFalse) |
|
48 // instead of hard-coding the number so if GenerateUniqueIdL |
|
49 // is modified, this constant doesn't need to be redefined |
|
50 const TInt KUnknownAlbumID = 1770790356; |
|
51 // UniqueID column in Uris requests |
|
52 const TInt KColUniqueID = 0; |
|
53 // URI column in Uris requests |
|
54 const TInt KColUri = 1; |
|
55 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
56 _LIT( KAbstractAlbumExt, ".alb" ); |
|
57 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
58 |
|
59 const TInt KAllSongsQueryResultGranularity = 250; |
|
60 |
|
61 // ============================ MEMBER FUNCTIONS ============================== |
|
62 |
|
63 // ---------------------------------------------------------------------------- |
|
64 // Two-phased constructor. |
|
65 // ---------------------------------------------------------------------------- |
|
66 // |
|
67 CMPXDbMusic* CMPXDbMusic::NewL( |
|
68 CMPXDbManager& aDbManager, |
|
69 CMPXResource& aResource, |
|
70 MMPXDbMusicObserver& aObserver) |
|
71 { |
|
72 MPX_FUNC("CMPXDbMusic::NewL"); |
|
73 CMPXDbMusic* self = CMPXDbMusic::NewLC(aDbManager, aResource, aObserver); |
|
74 CleanupStack::Pop(self); |
|
75 return self; |
|
76 } |
|
77 |
|
78 // ---------------------------------------------------------------------------- |
|
79 // Two-phased constructor. |
|
80 // ---------------------------------------------------------------------------- |
|
81 // |
|
82 CMPXDbMusic* CMPXDbMusic::NewLC( |
|
83 CMPXDbManager& aDbManager, |
|
84 CMPXResource& aResource, |
|
85 MMPXDbMusicObserver& aObserver) |
|
86 { |
|
87 MPX_FUNC("CMPXDbMusic::NewLC"); |
|
88 |
|
89 CMPXDbMusic* self = new (ELeave) CMPXDbMusic(aDbManager, aObserver); |
|
90 CleanupStack::PushL(self); |
|
91 self->ConstructL(aResource); |
|
92 return self; |
|
93 } |
|
94 |
|
95 // ---------------------------------------------------------------------------- |
|
96 // Destructor |
|
97 // ---------------------------------------------------------------------------- |
|
98 // |
|
99 CMPXDbMusic::~CMPXDbMusic() |
|
100 { |
|
101 MPX_FUNC("CMPXDbMusic::~CMPXDbMusic"); |
|
102 delete iExtensionsDrm; |
|
103 iAllSongsQueryResult.ResetAndDestroy(); |
|
104 } |
|
105 |
|
106 // ---------------------------------------------------------------------------- |
|
107 // Constructor |
|
108 // ---------------------------------------------------------------------------- |
|
109 // |
|
110 CMPXDbMusic::CMPXDbMusic( |
|
111 CMPXDbManager& aDbManager, |
|
112 MMPXDbMusicObserver& aObserver) : |
|
113 CMPXDbTable(aDbManager), |
|
114 iObserver(aObserver) |
|
115 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
116 ,iArtNeedUpdated(ETrue) |
|
117 #endif |
|
118 ,iAllSongsQueryResult(KAllSongsQueryResultGranularity) |
|
119 { |
|
120 MPX_FUNC("CMPXDbMusic::CMPXDbMusic"); |
|
121 } |
|
122 |
|
123 // ---------------------------------------------------------------------------- |
|
124 // Second phase constructor. |
|
125 // ---------------------------------------------------------------------------- |
|
126 // |
|
127 void CMPXDbMusic::ConstructL( |
|
128 CMPXResource& aResource) |
|
129 { |
|
130 MPX_FUNC("CMPXDbMusic::ConstructL"); |
|
131 |
|
132 BaseConstructL(); |
|
133 iExtensionsDrm = aResource.ReadDesCArrayL(R_MC_FILE_EXTENSIONS_DRM); |
|
134 } |
|
135 |
|
136 // ---------------------------------------------------------------------------- |
|
137 // CMPXDbMusic::AddSongL |
|
138 // ---------------------------------------------------------------------------- |
|
139 // |
|
140 TUint32 CMPXDbMusic::AddSongL( |
|
141 const CMPXMedia& aMedia, |
|
142 TInt aDrive, |
|
143 CMPXMessageArray* aMessageArray) |
|
144 { |
|
145 MPX_FUNC("CMPXDbMusic::AddSongL"); |
|
146 |
|
147 TUint32 songId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXCollection, |
|
148 aMedia.ValueText(KMPXMediaGeneralUri), EFalse)); |
|
149 |
|
150 if (SongExistsL(songId)) |
|
151 { |
|
152 // Delete the existing record first and start from scratch |
|
153 DeleteSongL(songId, aDrive, ETrue); |
|
154 } |
|
155 // add the song |
|
156 DoAddSongL(songId, aMedia, aDrive, aMessageArray); |
|
157 |
|
158 return songId; |
|
159 } |
|
160 |
|
161 // ---------------------------------------------------------------------------- |
|
162 // CMPXDbMusic::DoAddSongL |
|
163 // ---------------------------------------------------------------------------- |
|
164 // |
|
165 TBool CMPXDbMusic::DoAddSongL( |
|
166 TUint32 aSongId, |
|
167 const CMPXMedia& aMedia, |
|
168 TInt aDrive, |
|
169 CMPXMessageArray* aItemChangedMessages) |
|
170 { |
|
171 MPX_FUNC("CMPXDbMusic::DoAddSongL"); |
|
172 |
|
173 CDesCArrayFlat* fields = new (ELeave) CDesCArrayFlat(EMusicFieldCount); |
|
174 CleanupStack::PushL(fields); |
|
175 CDesCArrayFlat* values = new (ELeave) CDesCArrayFlat(EMusicFieldCount); |
|
176 CleanupStack::PushL(values); |
|
177 |
|
178 // add known fields |
|
179 MPXDbCommonUtil::AppendValueL(*fields, *values, KMCMusicUniqueId, aSongId); |
|
180 MPXDbCommonUtil::AppendValueL(*fields, *values, KMCMusicDel, 0); |
|
181 |
|
182 TTime time; |
|
183 time.HomeTime(); |
|
184 HBufC* timeAdded = MPXDbCommonUtil::TTimeToDesLC(time); |
|
185 MPXDbCommonUtil::AppendValueL(*fields, *values, KMCMusicTimeAdded, *timeAdded); |
|
186 CleanupStack::PopAndDestroy(timeAdded); |
|
187 |
|
188 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
189 //update ContainEmbeddedArt |
|
190 const TDesC& albumArtFilename = aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen); |
|
191 if (albumArtFilename.Length() > 0) |
|
192 { |
|
193 MPXDbCommonUtil::AppendValueL(*fields, *values, KMCMusicContainEmbeddedArt, 1); |
|
194 } |
|
195 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
196 // process the media parameter and construct the fields and values array |
|
197 TBool visible(GenerateMusicFieldsValuesL(aSongId, aMedia, aItemChangedMessages, |
|
198 NULL, *fields, *values, aDrive)); |
|
199 |
|
200 // create the fields and values strings |
|
201 HBufC* fieldStr = MPXDbCommonUtil::StringFromArrayLC(*fields, KMCCommaSign); |
|
202 HBufC* valueStr = MPXDbCommonUtil::StringFromArrayLC(*values, KMCCommaSign); |
|
203 |
|
204 // execute the query |
|
205 iDbManager.ExecuteQueryL(aDrive, KQueryMusicInsert, fieldStr, valueStr); |
|
206 |
|
207 CleanupStack::PopAndDestroy(valueStr); |
|
208 CleanupStack::PopAndDestroy(fieldStr); |
|
209 CleanupStack::PopAndDestroy(values); |
|
210 CleanupStack::PopAndDestroy(fields); |
|
211 |
|
212 return visible; |
|
213 } |
|
214 |
|
215 // ---------------------------------------------------------------------------- |
|
216 // CMPXDbMusic::UpdateSongL |
|
217 // ---------------------------------------------------------------------------- |
|
218 // |
|
219 CMPXDbActiveTask::TChangeVisibility CMPXDbMusic::UpdateSongL( |
|
220 TUint32 aSongId, |
|
221 const CMPXMedia& aMedia, |
|
222 CMPXMessageArray& aItemChangedMessages) |
|
223 { |
|
224 MPX_FUNC("CMPXDbMusic::UpdateSongL"); |
|
225 return DoUpdateSongL(aSongId, aMedia, &aItemChangedMessages); |
|
226 } |
|
227 |
|
228 // ---------------------------------------------------------------------------- |
|
229 // CMPXDbMusic::DoUpdateSongL |
|
230 // ---------------------------------------------------------------------------- |
|
231 // |
|
232 CMPXDbActiveTask::TChangeVisibility CMPXDbMusic::DoUpdateSongL( |
|
233 TUint32 aSongId, |
|
234 const CMPXMedia& aMedia, |
|
235 CMPXMessageArray* aItemChangedMessages) |
|
236 { |
|
237 MPX_FUNC("CMPXDbMusic::DoUpdateSongL"); |
|
238 |
|
239 CMPXDbActiveTask::TChangeVisibility visible(CMPXDbActiveTask::ENotVisibile); |
|
240 if (IsSupported(aMedia)) |
|
241 { |
|
242 // retrieve the existing record |
|
243 TInt oldSongId(0); |
|
244 oldSongId = (aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2; |
|
245 if ( oldSongId <= 0 ) |
|
246 { |
|
247 oldSongId = aSongId; |
|
248 } |
|
249 RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicGetSong, oldSongId)); |
|
250 CleanupClosePushL(recordset); |
|
251 |
|
252 if (recordset.Next() != KSqlAtRow) |
|
253 { |
|
254 User::Leave(KErrNotFound); |
|
255 } |
|
256 |
|
257 TDriveUnit driveUnit(MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), |
|
258 recordset.ColumnInt64(EMusicVolumeId))); |
|
259 visible = DoUpdateSongL(aSongId, aMedia, driveUnit, aItemChangedMessages, |
|
260 recordset); |
|
261 |
|
262 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
263 if(iArtNeedUpdated) |
|
264 { |
|
265 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
266 // Update Album table |
|
267 if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName) || aMedia.IsSupported(KMPXMediaMusicArtist)) |
|
268 { |
|
269 TUint32 albumId = recordset.ColumnInt64(EMusicAlbum); |
|
270 iObserver.UpdateCategoryItemL(EMPXAlbum, albumId, aMedia, driveUnit, aItemChangedMessages); |
|
271 } |
|
272 |
|
273 // Update Artist table |
|
274 if ( aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName) ) |
|
275 { |
|
276 TUint32 artistId = recordset.ColumnInt64(EMusicArtist); |
|
277 iObserver.UpdateCategoryItemL(EMPXArtist, artistId, aMedia, driveUnit, aItemChangedMessages); |
|
278 } |
|
279 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
280 } |
|
281 iArtNeedUpdated = ETrue; //reset flag |
|
282 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
283 CleanupStack::PopAndDestroy(&recordset); |
|
284 } |
|
285 |
|
286 return visible; |
|
287 } |
|
288 |
|
289 // ---------------------------------------------------------------------------- |
|
290 // CMPXDbMusic::DoUpdateSongL |
|
291 // ---------------------------------------------------------------------------- |
|
292 // |
|
293 CMPXDbActiveTask::TChangeVisibility CMPXDbMusic::DoUpdateSongL( |
|
294 TUint32 aSongId, |
|
295 const CMPXMedia& aMedia, |
|
296 TInt aDrive, |
|
297 CMPXMessageArray* aItemChangedMessages, |
|
298 RSqlStatement& aRecordset) |
|
299 { |
|
300 MPX_FUNC("CMPXDbMusic::DoUpdateSongL"); |
|
301 |
|
302 CDesCArrayFlat* fields = new (ELeave) CDesCArrayFlat(EMusicFieldCount); |
|
303 CleanupStack::PushL(fields); |
|
304 CDesCArrayFlat* values = new (ELeave) CDesCArrayFlat(EMusicFieldCount); |
|
305 CleanupStack::PushL(values); |
|
306 |
|
307 TInt oldSongId(0); |
|
308 oldSongId = (aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2; |
|
309 if ( oldSongId <= 0 ) |
|
310 { |
|
311 oldSongId = aSongId; |
|
312 } |
|
313 // process the media parameter and construct the fields and values array |
|
314 CMPXDbActiveTask::TChangeVisibility visible(GenerateMusicFieldsValuesL(oldSongId, aMedia, aItemChangedMessages, |
|
315 &aRecordset, *fields, *values, aDrive)); |
|
316 |
|
317 // construct the SET string |
|
318 HBufC* setStr = MPXDbCommonUtil::StringFromArraysLC(*fields, *values, KMCEqualSign, KMCCommaSign); |
|
319 if (setStr->Length()) |
|
320 { |
|
321 // execute the query |
|
322 iDbManager.ExecuteQueryL(aDrive, KQueryMusicUpdate, setStr, oldSongId); |
|
323 } |
|
324 |
|
325 CleanupStack::PopAndDestroy(setStr); |
|
326 CleanupStack::PopAndDestroy(values); |
|
327 CleanupStack::PopAndDestroy(fields); |
|
328 |
|
329 return visible; |
|
330 } |
|
331 |
|
332 // ---------------------------------------------------------------------------- |
|
333 // CMPXDbMusic::DeleteSongL |
|
334 // ---------------------------------------------------------------------------- |
|
335 // |
|
336 void CMPXDbMusic::DeleteSongL( |
|
337 TUint32 aSongId, |
|
338 TInt aDrive, |
|
339 TBool aDeleteRecord /* = EFalse */) |
|
340 { |
|
341 MPX_FUNC("CMPXDbMusic::DeleteSongL"); |
|
342 |
|
343 TPtrC query(aDeleteRecord ? KQueryMusicDelete() : KQueryMusicDeleteUpdate()); |
|
344 iDbManager.ExecuteQueryL(aDrive, query, aSongId); |
|
345 } |
|
346 |
|
347 // ---------------------------------------------------------------------------- |
|
348 // CMPXDbMusic::DeleteCategoryL |
|
349 // ---------------------------------------------------------------------------- |
|
350 // |
|
351 void CMPXDbMusic::DeleteCategoryL( |
|
352 TMPXGeneralCategory aCategory, |
|
353 TUint32 aCategoryId, |
|
354 CDesCArray& /* aUriArray */, |
|
355 CMPXMessageArray& /* aItemChangedMessages */, |
|
356 TInt aDrive) |
|
357 { |
|
358 MPX_FUNC("CMPXDbMusic::DeleteCategoryL"); |
|
359 TPtrC ptr(MPXDbUtil::MusicFieldNameForCategoryL(aCategory)); |
|
360 iDbManager.ExecuteQueryL(aDrive, KQueryMusicDeleteForCategory, &ptr, aCategoryId); |
|
361 } |
|
362 |
|
363 // ---------------------------------------------------------------------------- |
|
364 // CMPXDbMusic::CleanupL |
|
365 // ---------------------------------------------------------------------------- |
|
366 // |
|
367 void CMPXDbMusic::CleanupL() |
|
368 { |
|
369 MPX_FUNC("CMPXDbMusic::CleanupL"); |
|
370 iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryMusicCleanup); |
|
371 } |
|
372 |
|
373 // ---------------------------------------------------------------------------- |
|
374 // CMPXDbMusic::GetNameL |
|
375 // ---------------------------------------------------------------------------- |
|
376 // |
|
377 HBufC* CMPXDbMusic::GetNameL( |
|
378 TUint32 aSongId) |
|
379 { |
|
380 MPX_FUNC("CMPXDbMusic::GetNameL"); |
|
381 RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicGetTitle, aSongId)); |
|
382 CleanupClosePushL(recordset); |
|
383 |
|
384 if (recordset.Next() != KSqlAtRow) |
|
385 { |
|
386 User::LeaveIfError(KErrNotFound); |
|
387 } |
|
388 |
|
389 HBufC* title = MPXDbCommonUtil::GetColumnTextL(recordset, KMPXTableDefaultIndex).AllocL(); |
|
390 CleanupStack::PopAndDestroy(&recordset); |
|
391 |
|
392 return title; |
|
393 } |
|
394 |
|
395 // ---------------------------------------------------------------------------- |
|
396 // CMPXDbMusic::GetUriL |
|
397 // ---------------------------------------------------------------------------- |
|
398 // |
|
399 HBufC* CMPXDbMusic::GetUriL( |
|
400 TUint32 aSongId) |
|
401 { |
|
402 MPX_FUNC("CMPXDbMusic::GetUriL"); |
|
403 |
|
404 RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicGetUri, aSongId)); |
|
405 CleanupClosePushL(recordset); |
|
406 |
|
407 if (recordset.Next() != KSqlAtRow) |
|
408 { |
|
409 User::LeaveIfError(KErrNotFound); |
|
410 } |
|
411 |
|
412 // query fields |
|
413 enum |
|
414 { |
|
415 EMusicUriLocation = 0, |
|
416 EMusicUriVolId |
|
417 }; |
|
418 |
|
419 TUint volId(recordset.ColumnInt64(EMusicUriVolId)); |
|
420 HBufC* fullUri = MPXDbCommonUtil::CreateFullPathL( |
|
421 MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), volId), |
|
422 MPXDbCommonUtil::GetColumnTextL(recordset, EMusicUriLocation)); |
|
423 |
|
424 CleanupStack::PopAndDestroy(&recordset); |
|
425 |
|
426 return fullUri; |
|
427 } |
|
428 |
|
429 // ---------------------------------------------------------------------------- |
|
430 // CMPXDbMusic::GetDriveL |
|
431 // ---------------------------------------------------------------------------- |
|
432 // |
|
433 TInt CMPXDbMusic::GetDriveL( |
|
434 TUint32 aSongId) |
|
435 { |
|
436 MPX_FUNC("CMPXDbMusic::GetDriveL"); |
|
437 return MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), |
|
438 ExecuteIntQueryL(KQueryMusicVolume, aSongId)); |
|
439 } |
|
440 |
|
441 // ---------------------------------------------------------------------------- |
|
442 // CMPXDbMusic::GetSongInfoL |
|
443 // ---------------------------------------------------------------------------- |
|
444 // |
|
445 HBufC* CMPXDbMusic::GetSongInfoL( |
|
446 TUint32 aSongId, |
|
447 TUint32& aArtistId, |
|
448 TUint32& aAlbumId, |
|
449 TUint32& aGenreId, |
|
450 TUint32& aComposerId, |
|
451 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
452 TUint32& aAbstractAlbumId, |
|
453 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
454 TInt& aDriveId, |
|
455 HBufC*& aArt) |
|
456 { |
|
457 MPX_FUNC("CMPXDbMusic::GetSongInfoL"); |
|
458 |
|
459 RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicInfo, aSongId)); |
|
460 CleanupClosePushL(recordset); |
|
461 |
|
462 if (recordset.Next() != KSqlAtRow) |
|
463 { |
|
464 User::Leave(KErrNotFound); |
|
465 } |
|
466 |
|
467 aDriveId = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), |
|
468 recordset.ColumnInt64(EMusicVolumeId)); |
|
469 aArtistId = recordset.ColumnInt64(EMusicArtist); |
|
470 aAlbumId = recordset.ColumnInt64(EMusicAlbum); |
|
471 aGenreId = recordset.ColumnInt64(EMusicGenre); |
|
472 aComposerId = recordset.ColumnInt64(EMusicComposer); |
|
473 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
474 aAbstractAlbumId = recordset.ColumnInt64(EMusicAbstractAlbum); |
|
475 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
476 aArt = MPXDbCommonUtil::GetColumnTextL(recordset, EMusicArt).AllocL(); |
|
477 HBufC* uri = ConstructUriL(recordset); |
|
478 |
|
479 CleanupStack::PopAndDestroy(&recordset); |
|
480 |
|
481 return uri; |
|
482 } |
|
483 |
|
484 // ---------------------------------------------------------------------------- |
|
485 // CMPXDbMusic::GetSongL |
|
486 // ---------------------------------------------------------------------------- |
|
487 // |
|
488 TInt CMPXDbMusic::GetSongL( |
|
489 const CMPXMedia& aCriteria, |
|
490 CMPXMedia*& aMedia) |
|
491 { |
|
492 MPX_FUNC("CMPXDbMusic::GetSongL"); |
|
493 |
|
494 TUint32 songId(0); |
|
495 |
|
496 // find song Id, title, URI, and general flags from its Id and/or URI. Do not use "aCriteria" |
|
497 // because it may contain attributes other than Id and URI. We don't want to search the |
|
498 // song by fields other than the ID and URI because other attributes for the song may have |
|
499 // been changed in the collection since the song was added |
|
500 CMPXMedia* criteria = CMPXMedia::NewL(); |
|
501 CleanupStack::PushL(criteria); |
|
502 if (aCriteria.IsSupported(KMPXMediaGeneralId)) |
|
503 { |
|
504 songId = (aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2; |
|
505 criteria->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, songId); |
|
506 } |
|
507 else if (aCriteria.IsSupported(KMPXMediaGeneralUri)) |
|
508 { |
|
509 criteria->SetTextValueL(KMPXMediaGeneralUri, |
|
510 aCriteria.ValueText(KMPXMediaGeneralUri)); |
|
511 } |
|
512 |
|
513 // get the criteria string |
|
514 HBufC* criteriaStr = GenerateMusicMatchingCriteriaLC(songId, 0, EMPXItem, *criteria); |
|
515 |
|
516 // execute the query |
|
517 RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicSong, criteriaStr)); |
|
518 CleanupClosePushL(recordset); |
|
519 |
|
520 TInt err(KErrNone); |
|
521 if ((err = recordset.Next()) == KSqlAtRow) |
|
522 { |
|
523 RArray<TMPXAttribute> attributes; |
|
524 CleanupClosePushL(attributes); |
|
525 attributes.AppendL(TMPXAttribute(KMPXMediaIdGeneral, |
|
526 EMPXMediaGeneralId | EMPXMediaGeneralTitle | EMPXMediaGeneralUri | EMPXMediaGeneralFlags)); |
|
527 |
|
528 aMedia = CMPXMedia::NewL(); |
|
529 CleanupStack::PushL(aMedia); |
|
530 |
|
531 UpdateMediaL(recordset, attributes.Array(), *aMedia); |
|
532 |
|
533 CleanupStack::Pop(aMedia); |
|
534 CleanupStack::PopAndDestroy(&attributes); |
|
535 |
|
536 err = KErrNone; |
|
537 } |
|
538 else |
|
539 { |
|
540 err = KErrNotFound; |
|
541 } |
|
542 |
|
543 CleanupStack::PopAndDestroy(&recordset); |
|
544 CleanupStack::PopAndDestroy(criteriaStr); |
|
545 CleanupStack::PopAndDestroy(criteria); |
|
546 |
|
547 return err; |
|
548 } |
|
549 |
|
550 // ---------------------------------------------------------------------------- |
|
551 // CMPXDbMusic::GetRecentlyPlayedSongsL |
|
552 // ---------------------------------------------------------------------------- |
|
553 // |
|
554 void CMPXDbMusic::GetRecentlyPlayedSongsL( |
|
555 const TArray<TMPXAttribute>& aAttrs, |
|
556 CMPXMediaArray& aMediaArray) |
|
557 { |
|
558 MPX_FUNC("CMPXDbMusic::GetRecentlyPlayedSongsL"); |
|
559 ExecuteMediaQueryL(aAttrs, aMediaArray, KQueryMusicGetRecentlyPlayed, |
|
560 KMPXMaxRecentlyPlayedSongs); |
|
561 } |
|
562 |
|
563 // ---------------------------------------------------------------------------- |
|
564 // CMPXDbMusic::GetMostPlayedSongsL |
|
565 // ---------------------------------------------------------------------------- |
|
566 // |
|
567 void CMPXDbMusic::GetMostPlayedSongsL( |
|
568 const TArray<TMPXAttribute>& aAttrs, |
|
569 CMPXMediaArray& aMediaArray) |
|
570 { |
|
571 MPX_FUNC("CMPXDbMusic::GetMostPlayedSongsL"); |
|
572 ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ? |
|
573 KQueryMusicGetMostPlayed() : KQueryMusicGetMostPlayedNoCategories(), |
|
574 KMPXMaxMostPlayedSongs); |
|
575 } |
|
576 |
|
577 // ---------------------------------------------------------------------------- |
|
578 // CMPXDbMusic::GetRecentlyAddedSongsL |
|
579 // ---------------------------------------------------------------------------- |
|
580 // |
|
581 void CMPXDbMusic::GetRecentlyAddedSongsL( |
|
582 const TArray<TMPXAttribute>& aAttrs, |
|
583 CMPXMediaArray& aMediaArray) |
|
584 { |
|
585 MPX_FUNC("CMPXDbMusic::GetRecentlyAddedSongsL"); |
|
586 ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ? |
|
587 KQueryMusicGetRecentlyAdded() : KQueryMusicGetRecentlyAddedNoCategories()); |
|
588 } |
|
589 |
|
590 // ---------------------------------------------------------------------------- |
|
591 // CMPXDbMusic::CountL |
|
592 // ---------------------------------------------------------------------------- |
|
593 // |
|
594 TInt CMPXDbMusic::CountL() |
|
595 { |
|
596 MPX_FUNC("CMPXDbMusic::CountL"); |
|
597 return ExecuteSumQueryL(KQueryMusicCount); |
|
598 } |
|
599 |
|
600 // ---------------------------------------------------------------------------- |
|
601 // CMPXDbMusic::GetAlbumsForArtistL |
|
602 // ---------------------------------------------------------------------------- |
|
603 // |
|
604 void CMPXDbMusic::GetAlbumsForArtistL( |
|
605 TUint32 aArtistId, |
|
606 CMPXMediaArray& aMediaArray) |
|
607 { |
|
608 MPX_FUNC("CMPXDbMusic::GetAlbumsForArtistL"); |
|
609 |
|
610 RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicAlbum, aArtistId)); |
|
611 CleanupClosePushL(recordset); |
|
612 |
|
613 TInt err(KErrNone); |
|
614 while ((err = recordset.Next()) == KSqlAtRow) |
|
615 { |
|
616 TUint32 albumId(recordset.ColumnInt64(KMPXTableDefaultIndex)); |
|
617 |
|
618 CMPXMedia* media = CMPXMedia::NewL(); |
|
619 CleanupStack::PushL(media); |
|
620 |
|
621 media->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, albumId); |
|
622 media->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem); |
|
623 media->SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, EMPXAlbum); |
|
624 |
|
625 aMediaArray.AppendL(*media); |
|
626 CleanupStack::PopAndDestroy(media); |
|
627 } |
|
628 |
|
629 CleanupStack::PopAndDestroy(&recordset); |
|
630 if (err != KSqlAtEnd) |
|
631 { |
|
632 User::LeaveIfError(KErrCorrupt); |
|
633 } |
|
634 } |
|
635 |
|
636 // ---------------------------------------------------------------------------- |
|
637 // CMPXDbMusic::GetSongL |
|
638 // ---------------------------------------------------------------------------- |
|
639 // |
|
640 void CMPXDbMusic::GetSongL( |
|
641 TInt aSongId, |
|
642 const TArray<TMPXAttribute>& aAttrs, |
|
643 CMPXMedia& aMedia) |
|
644 { |
|
645 MPX_FUNC("CMPXDbMusic::GetSongL"); |
|
646 ExecuteMediaQueryL(aAttrs, aMedia, ExtraFieldsRequired(aAttrs) ? |
|
647 KQueryMusicGetSong() : KQueryMusicGetSongNoCategories(), aSongId); |
|
648 } |
|
649 |
|
650 // ---------------------------------------------------------------------------- |
|
651 // CMPXDbMusic::GetAllSongsL |
|
652 // ---------------------------------------------------------------------------- |
|
653 // |
|
654 void CMPXDbMusic::GetAllSongsL( |
|
655 TInt aDrive, |
|
656 TInt aPlaylistId, |
|
657 const TArray<TMPXAttribute>& aAttrs, |
|
658 CMPXMediaArray& aMediaArray) |
|
659 { |
|
660 MPX_FUNC("CMPXDbMusic::GetAllSongsL"); |
|
661 ExecuteMediaQueryL(aDrive, aAttrs, aMediaArray, KQueryMusicGetAllSongsInfobyPl(), aPlaylistId); |
|
662 } |
|
663 |
|
664 // ---------------------------------------------------------------------------- |
|
665 // CMPXDbMusic::GetAllSongsL |
|
666 // ---------------------------------------------------------------------------- |
|
667 // |
|
668 void CMPXDbMusic::GetAllSongsL( |
|
669 const TArray<TMPXAttribute>& aAttrs, |
|
670 CMPXMediaArray& aMediaArray) |
|
671 { |
|
672 MPX_FUNC("CMPXDbMusic::GetAllSongsL"); |
|
673 |
|
674 // do not execute the joins if no category name is required |
|
675 ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ? |
|
676 KQueryMusicGetAllSongs() : KQueryMusicGetAllSongsNoCategories()); |
|
677 } |
|
678 |
|
679 // ---------------------------------------------------------------------------- |
|
680 // CMPXDbMusic::GetAllSongsLimitedL |
|
681 // ---------------------------------------------------------------------------- |
|
682 // |
|
683 void CMPXDbMusic::GetAllSongsLimitedL(const TArray<TMPXAttribute>& aAttrs, |
|
684 CMPXMediaArray& aMediaArray, TInt aLimit) |
|
685 { |
|
686 MPX_FUNC("CMPXDbMusic::GetAllSongsLimitedL"); |
|
687 |
|
688 // Reset and create a cache for the query results. |
|
689 if (iAllSongsQueryResult.Count()) |
|
690 { |
|
691 iAllSongsQueryResult.ResetAndDestroy(); |
|
692 } |
|
693 |
|
694 ExecuteQueryAllSongsL(aAttrs); |
|
695 |
|
696 TInt limit = aLimit > iAllSongsQueryResult.Count() ? |
|
697 iAllSongsQueryResult.Count() : aLimit; |
|
698 |
|
699 for ( TInt i=0; i < limit; i++ ) |
|
700 { |
|
701 CMPXMedia* m = iAllSongsQueryResult[i]; |
|
702 aMediaArray.AppendL(*m); |
|
703 } |
|
704 } |
|
705 |
|
706 // ---------------------------------------------------------------------------- |
|
707 // CMPXDbMusic::ExecuteQueryAllSongsL |
|
708 // ---------------------------------------------------------------------------- |
|
709 // |
|
710 void CMPXDbMusic::ExecuteQueryAllSongsL(const TArray<TMPXAttribute>& aAttrs) |
|
711 { |
|
712 // Run query and add result media objects to the cache array. |
|
713 MPX_FUNC("CMPXDbMusic::ExecuteQueryAllSongsL"); |
|
714 |
|
715 RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicGetAllSongsMinimum)); |
|
716 CleanupClosePushL(recordset); |
|
717 |
|
718 TInt err(KErrNone); |
|
719 while ((err = recordset.Next()) == KSqlAtRow) |
|
720 { |
|
721 CMPXMedia* media = CMPXMedia::NewL(); |
|
722 CleanupStack::PushL(media); |
|
723 UpdateMediaL(recordset, aAttrs, *media); |
|
724 iAllSongsQueryResult.AppendL(media); |
|
725 CleanupStack::Pop(media); |
|
726 } |
|
727 |
|
728 CleanupStack::PopAndDestroy(&recordset); |
|
729 if (err!= KSqlAtEnd) |
|
730 { |
|
731 User::Leave(KErrCorrupt); |
|
732 } |
|
733 } |
|
734 |
|
735 |
|
736 // ---------------------------------------------------------------------------- |
|
737 // CMPXDbMusic::GetSongsInBlockL |
|
738 // ---------------------------------------------------------------------------- |
|
739 // |
|
740 void CMPXDbMusic::GetSongsInBlockL( |
|
741 const TArray<TMPXAttribute>& aAttrs, |
|
742 CMPXMediaArray& aMediaArray, |
|
743 TPtrC aTitle, |
|
744 TUint aNumOfSongs, |
|
745 TBool aAsc) |
|
746 { |
|
747 MPX_FUNC("CMPXDbMusic::GetSongsInBlockL"); |
|
748 |
|
749 if (aAsc) |
|
750 { |
|
751 ExecuteMediaQueryL(aAttrs, aMediaArray, KQueryMusicGetSongsInBlockAsc, |
|
752 aTitle, aNumOfSongs, ETrue, EAscQuery ); |
|
753 } |
|
754 else |
|
755 { |
|
756 ExecuteMediaQueryL(aAttrs, aMediaArray, KQueryMusicGetSongsInBlockDsc, |
|
757 aTitle, aNumOfSongs, EFalse, EDscQuery ); |
|
758 } |
|
759 } |
|
760 |
|
761 // ---------------------------------------------------------------------------- |
|
762 // CMPXDbMusic::GetSongsAtOffsetL |
|
763 // ---------------------------------------------------------------------------- |
|
764 // |
|
765 void CMPXDbMusic::GetSongsAtOffsetL( CMPXMediaArray& aMediaArray, |
|
766 const TArray<TMPXAttribute>& aAttrs, |
|
767 TInt aOffset, |
|
768 TInt aCount ) |
|
769 { |
|
770 MPX_DEBUG3("CMPXDbMusic::GetSongsAtOffsetL offset[%d], count[%d]", aOffset, aCount); |
|
771 |
|
772 if ( !iAllSongsQueryResult.Count() ) |
|
773 { |
|
774 // If there's no cache, create a cache for the query results. |
|
775 ExecuteQueryAllSongsL(aAttrs); |
|
776 } |
|
777 |
|
778 TInt limit = aOffset + aCount > iAllSongsQueryResult.Count() ? |
|
779 iAllSongsQueryResult.Count() : aOffset + aCount; |
|
780 for ( TInt i = aOffset; i < limit; i++ ) |
|
781 { |
|
782 CMPXMedia* m = iAllSongsQueryResult[i]; |
|
783 aMediaArray.AppendL(*m); |
|
784 } |
|
785 |
|
786 MPX_DEBUG1("CMPXDbMusic::GetSongsAtOffsetL() -->"); |
|
787 } |
|
788 |
|
789 // ---------------------------------------------------------------------------- |
|
790 // CMPXDbMusic::GetSongsForArtistL |
|
791 // ---------------------------------------------------------------------------- |
|
792 // |
|
793 void CMPXDbMusic::GetSongsForArtistL( |
|
794 TUint aArtistId, |
|
795 const TArray<TMPXAttribute>& aAttrs, |
|
796 CMPXMediaArray& aMediaArray) |
|
797 { |
|
798 MPX_FUNC("CMPXDbMusic::GetSongsForArtistL"); |
|
799 ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ? |
|
800 KQueryMusicGetSongsForArtist() : KQueryMusicGetSongsForArtistNoCategories(), |
|
801 aArtistId); |
|
802 } |
|
803 |
|
804 // ---------------------------------------------------------------------------- |
|
805 // CMPXDbMusic::GetSongsForAlbumL |
|
806 // ---------------------------------------------------------------------------- |
|
807 // |
|
808 void CMPXDbMusic::GetSongsForAlbumL( |
|
809 TUint aAlbumId, |
|
810 const TArray<TMPXAttribute>& aAttrs, |
|
811 CMPXMediaArray& aMediaArray) |
|
812 { |
|
813 MPX_FUNC("CMPXDbMusic::GetSongsForAlbumL"); |
|
814 |
|
815 TPtrC query; |
|
816 if (aAlbumId == KUnknownAlbumID) |
|
817 { |
|
818 query.Set(ExtraFieldsRequired(aAttrs) ? KQueryMusicGetSongsForUnknownAlbum() : |
|
819 KQueryMusicGetSongsForUnknownAlbumNoCategories()); |
|
820 } |
|
821 else |
|
822 { |
|
823 query.Set(ExtraFieldsRequired(aAttrs) ? KQueryMusicGetSongsForAlbum() : |
|
824 KQueryMusicGetSongsForAlbumNoCategories()); |
|
825 } |
|
826 |
|
827 ExecuteMediaQueryL(aAttrs, aMediaArray, query, aAlbumId); |
|
828 } |
|
829 |
|
830 // ---------------------------------------------------------------------------- |
|
831 // CMPXDbMusic::GetSongsForArtistAndAlbumL |
|
832 // ---------------------------------------------------------------------------- |
|
833 // |
|
834 void CMPXDbMusic::GetSongsForArtistAndAlbumL( |
|
835 TUint aArtistId, |
|
836 TUint aAlbumId, |
|
837 const TArray<TMPXAttribute>& aAttrs, |
|
838 CMPXMediaArray& aMediaArray) |
|
839 { |
|
840 MPX_FUNC("CMPXDbMusic::GetSongsForArtistAndAlbumL"); |
|
841 ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ? |
|
842 KQueryMusicGetSongsForArtistAlbum() : KQueryMusicGetSongsForArtistAlbumNoCategories(), |
|
843 aArtistId, aAlbumId); |
|
844 } |
|
845 |
|
846 // ---------------------------------------------------------------------------- |
|
847 // CMPXDbMusic::GetSongsForGenreL |
|
848 // ---------------------------------------------------------------------------- |
|
849 // |
|
850 void CMPXDbMusic::GetSongsForGenreL( |
|
851 TUint aGenreId, |
|
852 const TArray<TMPXAttribute>& aAttrs, |
|
853 CMPXMediaArray& aMediaArray) |
|
854 { |
|
855 MPX_FUNC("CMPXDbMusic::GetSongsForGenreL"); |
|
856 ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ? |
|
857 KQueryMusicGetSongsForGenre() : KQueryMusicGetSongsForGenreNoCategories(), |
|
858 aGenreId); |
|
859 } |
|
860 |
|
861 // ---------------------------------------------------------------------------- |
|
862 // CMPXDbMusic::GetSongsForComposerL |
|
863 // ---------------------------------------------------------------------------- |
|
864 // |
|
865 void CMPXDbMusic::GetSongsForComposerL( |
|
866 TUint aComposerId, |
|
867 const TArray<TMPXAttribute>& aAttrs, |
|
868 CMPXMediaArray& aMediaArray) |
|
869 { |
|
870 MPX_FUNC("CMPXDbMusic::GetSongsForComposerL"); |
|
871 ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ? |
|
872 KQueryMusicGetSongsForComposer() : KQueryMusicGetSongsForComposerNoCategories(), |
|
873 aComposerId); |
|
874 } |
|
875 |
|
876 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
877 // ---------------------------------------------------------------------------- |
|
878 // CMPXDbMusic::GetAllSongsForAbstractAlbumL |
|
879 // ---------------------------------------------------------------------------- |
|
880 // |
|
881 void CMPXDbMusic::GetAllSongsForAbstractAlbumL( |
|
882 TUint aAbstractAlbumId, |
|
883 const TArray<TMPXAttribute>& aAttrs, |
|
884 CMPXMediaArray& aMediaArray) |
|
885 { |
|
886 MPX_FUNC("CMPXDbMusic::GetAllSongsForAbstractAlbumL"); |
|
887 ExecuteMediaQueryL(aAttrs, aMediaArray, KQueryMusicGetSongsForAbstractAlbum(), aAbstractAlbumId); |
|
888 } |
|
889 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
890 |
|
891 // ---------------------------------------------------------------------------- |
|
892 // CMPXDbMusic::AllSongsDurationL |
|
893 // ---------------------------------------------------------------------------- |
|
894 // |
|
895 TInt CMPXDbMusic::AllSongsDurationL() |
|
896 { |
|
897 MPX_FUNC("CMPXDbMusic::AllSongsDurationL"); |
|
898 return ExecuteSumQueryL(KQueryMusicDurationAll); |
|
899 } |
|
900 |
|
901 // ---------------------------------------------------------------------------- |
|
902 // CMPXDbMusic::ArtistDurationL |
|
903 // ---------------------------------------------------------------------------- |
|
904 // |
|
905 TInt CMPXDbMusic::ArtistDurationL( |
|
906 TUint aArtistId) |
|
907 { |
|
908 MPX_FUNC("CMPXDbMusic::ArtistDurationL"); |
|
909 return ExecuteSumQueryL(KQueryMusicDurationArtist, aArtistId); |
|
910 } |
|
911 |
|
912 // ---------------------------------------------------------------------------- |
|
913 // CMPXDbMusic::AlbumDurationL |
|
914 // ---------------------------------------------------------------------------- |
|
915 // |
|
916 TInt CMPXDbMusic::AlbumDurationL( |
|
917 TUint aAlbumId) |
|
918 { |
|
919 MPX_FUNC("CMPXDbMusic::AlbumDurationL"); |
|
920 return ExecuteSumQueryL(KQueryMusicDurationAlbum, aAlbumId); |
|
921 } |
|
922 |
|
923 // ---------------------------------------------------------------------------- |
|
924 // CMPXDbMusic::ArtistAlbumDurationL |
|
925 // ---------------------------------------------------------------------------- |
|
926 // |
|
927 TInt CMPXDbMusic::ArtistAlbumDurationL( |
|
928 TUint aArtistId, |
|
929 TUint aAlbumId) |
|
930 { |
|
931 MPX_FUNC("CMPXDbMusic::ArtistAlbumDurationL"); |
|
932 return ExecuteSumQueryL(KQueryMusicDurationArtistAlbum, aArtistId, aAlbumId); |
|
933 } |
|
934 |
|
935 // ---------------------------------------------------------------------------- |
|
936 // CMPXDbMusic::GenreDurationL |
|
937 // ---------------------------------------------------------------------------- |
|
938 // |
|
939 TInt CMPXDbMusic::GenreDurationL( |
|
940 TUint aGenreId) |
|
941 { |
|
942 MPX_FUNC("CMPXDbMusic::GenreDurationL"); |
|
943 return ExecuteSumQueryL(KQueryMusicDurationGenre, aGenreId); |
|
944 } |
|
945 |
|
946 // ---------------------------------------------------------------------------- |
|
947 // CMPXDbMusic::ComposerDurationL |
|
948 // ---------------------------------------------------------------------------- |
|
949 // |
|
950 TInt CMPXDbMusic::ComposerDurationL( |
|
951 TUint aComposerId) |
|
952 { |
|
953 MPX_FUNC("CMPXDbMusic::ComposerDurationL"); |
|
954 return ExecuteSumQueryL(KQueryMusicDurationComposer, aComposerId); |
|
955 } |
|
956 |
|
957 // ---------------------------------------------------------------------------- |
|
958 // CMPXDbMusic::RecentlyPlayedDurationL |
|
959 // ---------------------------------------------------------------------------- |
|
960 // |
|
961 TInt CMPXDbMusic::RecentlyPlayedDurationL() |
|
962 { |
|
963 MPX_FUNC("CMPXDbMusic::RecentlyPlayedDurationL"); |
|
964 return ExecuteSumQueryL(KQueryMusicDurationRecentlyPlayed, KMPXMaxRecentlyPlayedSongs); |
|
965 } |
|
966 |
|
967 // ---------------------------------------------------------------------------- |
|
968 // CMPXDbMusic::MostPlayedDurationL |
|
969 // ---------------------------------------------------------------------------- |
|
970 // |
|
971 TInt CMPXDbMusic::MostPlayedDurationL() |
|
972 { |
|
973 MPX_FUNC("CMPXDbMusic::MostPlayedDurationL"); |
|
974 return ExecuteSumQueryL(KQueryMusicDurationMostPlayed, KMPXMaxMostPlayedSongs); |
|
975 } |
|
976 |
|
977 // ---------------------------------------------------------------------------- |
|
978 // CMPXDbMusic::RecentlyAddedDurationL |
|
979 // ---------------------------------------------------------------------------- |
|
980 // |
|
981 TInt CMPXDbMusic::RecentlyAddedDurationL() |
|
982 { |
|
983 MPX_FUNC("CMPXDbMusic::RecentlyAddedDurationL"); |
|
984 return ExecuteSumQueryL(KQueryMusicDurationRecentlyAdded); |
|
985 } |
|
986 |
|
987 // ---------------------------------------------------------------------------- |
|
988 // CMPXDbMusic::FindSongsL |
|
989 // ---------------------------------------------------------------------------- |
|
990 // |
|
991 void CMPXDbMusic::FindSongsL( |
|
992 TUint32 aGeneralId, |
|
993 TUint32 aContainerId, |
|
994 TMPXGeneralType aType, |
|
995 const CMPXMedia& aCriteria, |
|
996 const TArray<TMPXAttribute>& aAttrs, |
|
997 CMPXMediaArray& aMediaArray) |
|
998 { |
|
999 MPX_FUNC("CMPXDbMusic::FindSongsL"); |
|
1000 |
|
1001 // get the selection criteria string |
|
1002 HBufC* criteriaStr = GenerateMusicMatchingCriteriaLC(aGeneralId, aContainerId, aType, |
|
1003 aCriteria); |
|
1004 |
|
1005 // construct the sort order depending on category. Albums are always sorted by track, |
|
1006 // then name, except for unknown album. Songs are sorted by name for unknown album. |
|
1007 // NULL track number is stored as KMaxTInt so that they will be sorted to the end |
|
1008 TPtrC sortOrder; |
|
1009 if ((aType == EMPXGroup) && (MPX_ITEM_CATEGORY(aGeneralId) == EMPXAlbum) && |
|
1010 (aGeneralId != MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXAlbum, KNullDesC, EFalse))) |
|
1011 { |
|
1012 sortOrder.Set(KQueryMusicFindAllSortOrderTrack); |
|
1013 } |
|
1014 else |
|
1015 { |
|
1016 sortOrder.Set(KQueryMusicFindAllSortOrderTitle); |
|
1017 } |
|
1018 |
|
1019 // construct the query |
|
1020 HBufC* query = HBufC::NewLC(KQueryMusicFindAll().Length() + criteriaStr->Length() + |
|
1021 sortOrder.Length()); |
|
1022 query->Des().Format(KQueryMusicFindAll, criteriaStr, &sortOrder); |
|
1023 |
|
1024 // iterate the results and append media objects to the destination array |
|
1025 ExecuteMediaQueryL(aAttrs, aMediaArray, *query); |
|
1026 |
|
1027 CleanupStack::PopAndDestroy(query); |
|
1028 CleanupStack::PopAndDestroy(criteriaStr); |
|
1029 } |
|
1030 |
|
1031 // ---------------------------------------------------------------------------- |
|
1032 // CMPXDbMusic::GetDriveTrackCount |
|
1033 // ---------------------------------------------------------------------------- |
|
1034 // |
|
1035 TUint CMPXDbMusic::GetDriveTrackCountL(TInt aDrive) |
|
1036 { |
|
1037 TUint count(0); |
|
1038 |
|
1039 RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aDrive,KQueryMusicCount)); |
|
1040 CleanupClosePushL(recordset); |
|
1041 |
|
1042 if (recordset.Next() != KSqlAtRow) |
|
1043 { |
|
1044 User::Leave(KErrCorrupt); |
|
1045 } |
|
1046 |
|
1047 count = TUint(recordset.ColumnInt64(KMPXTableDefaultIndex)); |
|
1048 CleanupStack::PopAndDestroy(&recordset); |
|
1049 |
|
1050 return count; |
|
1051 } |
|
1052 |
|
1053 // ---------------------------------------------------------------------------- |
|
1054 // CMPXDbMusic::GetMusicUriArrayL |
|
1055 // ---------------------------------------------------------------------------- |
|
1056 // |
|
1057 void CMPXDbMusic::GetMusicUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords, |
|
1058 CDesCArray& aUriArr, TInt& aLastID) |
|
1059 { |
|
1060 MPX_FUNC("CMPXDbMusic::GetMusicUriArrayL"); |
|
1061 |
|
1062 HBufC* query = NULL; |
|
1063 if(aFromID == 0) |
|
1064 { |
|
1065 query = HBufC::NewLC(KQueryMusicGetMusicUris().Length() + KMCIntegerLen); |
|
1066 query->Des().Format(KQueryMusicGetMusicUris, aRecords); |
|
1067 } |
|
1068 else |
|
1069 { |
|
1070 query = HBufC::NewLC(KQueryMusicGetMusicUrisFrom().Length() + 2*KMCIntegerLen); |
|
1071 query->Des().Format(KQueryMusicGetMusicUrisFrom, aFromID, aRecords); |
|
1072 } |
|
1073 |
|
1074 RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aDrive,*query)); |
|
1075 |
|
1076 CleanupStack::PopAndDestroy(query); |
|
1077 |
|
1078 CleanupClosePushL(recordset); |
|
1079 |
|
1080 TInt lastID = 0; |
|
1081 TInt err(KErrNone); |
|
1082 while((err = recordset.Next()) == KSqlAtRow) |
|
1083 { |
|
1084 HBufC* fullPath = MPXDbCommonUtil::CreateFullPathL(aDrive, |
|
1085 MPXDbCommonUtil::GetColumnTextL(recordset, KColUri)); |
|
1086 CleanupStack::PushL(fullPath); |
|
1087 aUriArr.AppendL(*fullPath); |
|
1088 CleanupStack::PopAndDestroy(fullPath); |
|
1089 |
|
1090 lastID = recordset.ColumnInt(KColUniqueID); |
|
1091 } |
|
1092 CleanupStack::PopAndDestroy(&recordset); |
|
1093 |
|
1094 aLastID = lastID; |
|
1095 |
|
1096 if (err!= KSqlAtEnd) |
|
1097 { |
|
1098 User::Leave(KErrCorrupt); |
|
1099 } |
|
1100 } |
|
1101 |
|
1102 // ---------------------------------------------------------------------------- |
|
1103 // CMPXDbMusic::ArtistForAlbumL |
|
1104 // ---------------------------------------------------------------------------- |
|
1105 // |
|
1106 TUint32 CMPXDbMusic::ArtistForAlbumL(const TUint32 aId) |
|
1107 { |
|
1108 RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicGetArtistForAlbum, aId)); |
|
1109 |
|
1110 CleanupClosePushL(recordset); |
|
1111 if (recordset.Next() != KSqlAtRow) |
|
1112 { |
|
1113 User::Leave(KErrNotFound); |
|
1114 } |
|
1115 |
|
1116 TUint32 artistId = recordset.ColumnInt64(KMPXTableDefaultIndex); |
|
1117 CleanupStack::PopAndDestroy(&recordset); |
|
1118 |
|
1119 return artistId; |
|
1120 } |
|
1121 |
|
1122 // ---------------------------------------------------------------------------- |
|
1123 // CMPXDbMusic::AlbumartForAlbumL |
|
1124 // ---------------------------------------------------------------------------- |
|
1125 // |
|
1126 HBufC* CMPXDbMusic::AlbumartForAlbumL(const TUint32 aAlbumId, TPtrC aArt) |
|
1127 { |
|
1128 MPX_FUNC("CMPXDbMusic::AlbumartForAlbumL"); |
|
1129 RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicGetAlbumartForAlbum, aAlbumId)); |
|
1130 HBufC* albumart(NULL); |
|
1131 |
|
1132 CleanupClosePushL(recordset); |
|
1133 TInt err(KErrNone); |
|
1134 while ((err = recordset.Next()) == KSqlAtRow) |
|
1135 { |
|
1136 TPtrC art(MPXDbCommonUtil::GetColumnTextL(recordset, KMPXTableDefaultIndex)); |
|
1137 if (art.Length()>0 && art.Compare(KNullDesC)!=0 && art.CompareF(aArt)!=0 ) |
|
1138 { |
|
1139 albumart = art.AllocL(); |
|
1140 break; |
|
1141 } |
|
1142 } |
|
1143 |
|
1144 CleanupStack::PopAndDestroy(&recordset); |
|
1145 return albumart; |
|
1146 } |
|
1147 // ---------------------------------------------------------------------------- |
|
1148 // CMPXDbMusic::SongExistsL |
|
1149 // ---------------------------------------------------------------------------- |
|
1150 // |
|
1151 TBool CMPXDbMusic::SongExistsL( |
|
1152 TUint32 aSongId) |
|
1153 { |
|
1154 MPX_FUNC("CMPXDbMusic::SongExistsL"); |
|
1155 |
|
1156 RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicVolumeAll, aSongId)); |
|
1157 TBool found = (recordset.Next() == KSqlAtRow); |
|
1158 recordset.Close(); |
|
1159 |
|
1160 return found; |
|
1161 } |
|
1162 |
|
1163 // ---------------------------------------------------------------------------- |
|
1164 // CMPXDbMusic::UpdateMediaL |
|
1165 // ---------------------------------------------------------------------------- |
|
1166 // |
|
1167 void CMPXDbMusic::UpdateMediaL( |
|
1168 RSqlStatement& aMusicTable, |
|
1169 const TArray<TMPXAttribute>& aAttrs, |
|
1170 CMPXMedia& aMedia) |
|
1171 { |
|
1172 MPX_FUNC("CMPXDbMusic::UpdateMediaL"); |
|
1173 |
|
1174 TInt count(aAttrs.Count()); |
|
1175 for (TInt i = 0; i < count; ++i) |
|
1176 { |
|
1177 switch (aAttrs[i].ContentId()) |
|
1178 { |
|
1179 case KMPXMediaIdGeneral: |
|
1180 { |
|
1181 UpdateMediaGeneralL(aMusicTable, aAttrs[i].AttributeId(), aMedia); |
|
1182 break; |
|
1183 } |
|
1184 case KMPXMediaIdMusic: |
|
1185 { |
|
1186 UpdateMediaMusicL(aMusicTable, aAttrs[i].AttributeId(), aMedia); |
|
1187 break; |
|
1188 } |
|
1189 case KMPXMediaIdDrm: |
|
1190 { |
|
1191 // DRM is set by drm helper |
|
1192 break; |
|
1193 } |
|
1194 case KMPXMediaIdMTP: |
|
1195 { |
|
1196 // Only attribute stored in db is MTP drm status |
|
1197 UpdateMediaMTPL(aMusicTable, aAttrs[i].AttributeId(), aMedia); |
|
1198 break; |
|
1199 } |
|
1200 case KMPXMediaIdAudio: |
|
1201 { |
|
1202 UpdateMediaAudioL(aMusicTable, aAttrs[i].AttributeId(), aMedia); |
|
1203 break; |
|
1204 } |
|
1205 default: |
|
1206 // Do not leave. If this plugin doesn't support |
|
1207 // the content id they want, just return what we have |
|
1208 break; |
|
1209 } // end switch |
|
1210 } // end for |
|
1211 } |
|
1212 |
|
1213 // ---------------------------------------------------------------------------- |
|
1214 // CMPXDbMusic::UpdateMediaGeneralL |
|
1215 // ---------------------------------------------------------------------------- |
|
1216 // |
|
1217 void CMPXDbMusic::UpdateMediaGeneralL( |
|
1218 RSqlStatement& aMusicTable, |
|
1219 const TUint aAttrId, |
|
1220 CMPXMedia& aMedia) |
|
1221 { |
|
1222 MPX_DEBUG1("-->CMPXDbMusic::UpdateMediaGeneralL"); |
|
1223 MPX_DEBUG2(" aAttrId=%b", aAttrId); |
|
1224 |
|
1225 aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem ); |
|
1226 aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, EMPXSong ); |
|
1227 |
|
1228 // FIX ME, temporary always fetch item ID |
|
1229 //if (aAttrId & EMPXMediaGeneralId) |
|
1230 if (!aMedia.IsSupported(KMPXMediaGeneralId)) |
|
1231 { |
|
1232 MPX_DEBUG1(" !aMedia.IsSupported(KMPXMediaGeneralId)"); |
|
1233 TUint32 songId(aMusicTable.ColumnInt64(EMusicUniqueId)); |
|
1234 TInt columnCount(aMusicTable.ColumnCount()); |
|
1235 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
1236 if(columnCount == 40 && aMusicTable.ColumnIndex(_L("PlUId"))==38) |
|
1237 { |
|
1238 TUint32 pListUId(aMusicTable.ColumnInt64(38)); |
|
1239 aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, TMPXItemId(pListUId, songId)); |
|
1240 } |
|
1241 #else |
|
1242 if(columnCount == 37 && aMusicTable.ColumnIndex(_L("PlUId"))==35) |
|
1243 { |
|
1244 TUint32 pListUId(aMusicTable.ColumnInt64(35)); |
|
1245 aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, TMPXItemId(pListUId, songId)); |
|
1246 } |
|
1247 #endif |
|
1248 else |
|
1249 { |
|
1250 aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, songId); |
|
1251 } |
|
1252 MPX_DEBUG2(" SongId[%d]", songId); |
|
1253 } |
|
1254 // FIX ME temporary always fetch URI |
|
1255 if (aAttrId & EMPXMediaGeneralUri) |
|
1256 { |
|
1257 MPX_DEBUG1(" !aMedia.IsSupported(KMPXMediaGeneralUri)"); |
|
1258 HBufC* uri = ConstructUriL(aMusicTable); |
|
1259 CleanupStack::PushL(uri); |
|
1260 aMedia.SetTextValueL(KMPXMediaGeneralUri, *uri); |
|
1261 MPX_DEBUG2(" FullPath[%S]", uri); |
|
1262 CleanupStack::PopAndDestroy(uri); |
|
1263 } |
|
1264 if (aAttrId & EMPXMediaGeneralDrive) |
|
1265 { |
|
1266 MPX_DEBUG1(" EMPXMediaGeneralDrive"); |
|
1267 TDriveUnit driveUnit; |
|
1268 if (aMedia.IsSupported(KMPXMediaGeneralUri)) |
|
1269 { |
|
1270 MPX_DEBUG1(" aMedia.IsSupported(KMPXMediaGeneralUri)"); |
|
1271 driveUnit = aMedia.ValueText(KMPXMediaGeneralUri); |
|
1272 MPX_DEBUG2(" driveUnit=%d", (TInt)driveUnit); |
|
1273 } |
|
1274 else |
|
1275 { |
|
1276 MPX_DEBUG1(" !aMedia.IsSupported(KMPXMediaGeneralUri)"); |
|
1277 driveUnit = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), |
|
1278 aMusicTable.ColumnInt64(EMusicVolumeId)); |
|
1279 MPX_DEBUG2(" driveUnit=%d", (TInt)driveUnit); |
|
1280 } |
|
1281 |
|
1282 TPtrC driveName(driveUnit.Name()); |
|
1283 aMedia.SetTextValueL(KMPXMediaGeneralDrive, driveName); |
|
1284 MPX_DEBUG2(" Drive[%S]", &driveName); |
|
1285 } |
|
1286 if (aAttrId & EMPXMediaGeneralSize) |
|
1287 { |
|
1288 MPX_DEBUG1(" EMPXMediaGeneralSize"); |
|
1289 // to-do: store this in the DB |
|
1290 } |
|
1291 if (aAttrId & EMPXMediaGeneralDuration) |
|
1292 { |
|
1293 MPX_DEBUG1(" EMPXMediaGeneralDuration"); |
|
1294 TInt32 duration(aMusicTable.ColumnInt(EMusicDuration)); |
|
1295 aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralDuration, duration); |
|
1296 MPX_DEBUG2(" Duration[%d]", duration); |
|
1297 } |
|
1298 if ((aAttrId & EMPXMediaGeneralTitle) && !aMedia.IsSupported(KMPXMediaGeneralTitle)) |
|
1299 { |
|
1300 MPX_DEBUG1(" EMPXMediaGeneralTitle"); |
|
1301 TPtrC title(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicTitle)); |
|
1302 aMedia.SetTextValueL(KMPXMediaGeneralTitle, title); |
|
1303 MPX_DEBUG2(" Title[%S]", &title); |
|
1304 } |
|
1305 if ( aAttrId & EMPXMediaGeneralDate) |
|
1306 { |
|
1307 MPX_DEBUG1(" EMPXMediaGeneralDate"); |
|
1308 const TDesC& dateStr(MPXDbCommonUtil::GetColumnTextL (aMusicTable, |
|
1309 EMusicTimeAdded)); |
|
1310 if ( dateStr.Compare (KNullDesC)!= 0) |
|
1311 { |
|
1312 TTime dateTime(MPXDbCommonUtil::DesToTTimeL (dateStr)); |
|
1313 aMedia.SetTObjectValueL<TInt64> (KMPXMediaGeneralDate, |
|
1314 dateTime.Int64 ()); |
|
1315 } |
|
1316 MPX_DEBUG2(" Date[%S]", &dateStr); |
|
1317 } |
|
1318 if (aAttrId & EMPXMediaGeneralComment) |
|
1319 { |
|
1320 MPX_DEBUG1(" EMPXMediaGeneralComment"); |
|
1321 TPtrC comment(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicComment)); |
|
1322 aMedia.SetTextValueL(KMPXMediaGeneralComment, comment); |
|
1323 MPX_DEBUG2(" Comment[%S]", &comment); |
|
1324 } |
|
1325 if (aAttrId & EMPXMediaGeneralMimeType) |
|
1326 { |
|
1327 MPX_DEBUG1(" EMPXMediaGeneralMimeType"); |
|
1328 TPtrC mimeType(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicMimeType)); |
|
1329 aMedia.SetTextValueL(KMPXMediaGeneralMimeType, mimeType); |
|
1330 MPX_DEBUG2(" MimeType[%S]", &mimeType); |
|
1331 } |
|
1332 if (aAttrId & EMPXMediaGeneralSynchronized) |
|
1333 { |
|
1334 MPX_DEBUG1(" EMPXMediaGeneralSynchronized"); |
|
1335 TInt sync(aMusicTable.ColumnInt(EMusicSync)); |
|
1336 aMedia.SetTObjectValueL<TBool>(KMPXMediaGeneralSynchronized, sync); |
|
1337 MPX_DEBUG2(" Synchronized[%d]", sync); |
|
1338 } |
|
1339 if (aAttrId & EMPXMediaGeneralDeleted) |
|
1340 { |
|
1341 MPX_DEBUG1(" EMPXMediaGeneralDeleted"); |
|
1342 TInt del(aMusicTable.ColumnInt(EMusicDeleted)); |
|
1343 aMedia.SetTObjectValueL<TBool>(KMPXMediaGeneralDeleted, del); |
|
1344 MPX_DEBUG2(" Deleted[%d]", del); |
|
1345 } |
|
1346 if (aAttrId & EMPXMediaGeneralModified) |
|
1347 { |
|
1348 MPX_DEBUG1(" EMPXMediaGeneralModified"); |
|
1349 TInt mod(aMusicTable.ColumnInt(EMusicModified)); |
|
1350 aMedia.SetTObjectValueL<TBool>(KMPXMediaGeneralModified, mod); |
|
1351 MPX_DEBUG2(" Modified[%d]", mod); |
|
1352 } |
|
1353 if (aAttrId & EMPXMediaGeneralCount) |
|
1354 { |
|
1355 MPX_DEBUG1(" EMPXMediaGeneralCount"); |
|
1356 aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount, 1); |
|
1357 } |
|
1358 if (aAttrId & EMPXMediaGeneralCollectionId) |
|
1359 { |
|
1360 MPX_DEBUG1(" EMPXMediaGeneralCollectionId"); |
|
1361 aMedia.SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, |
|
1362 TUid::Uid(KDBPluginUid)); |
|
1363 } |
|
1364 if(aAttrId & EMPXMediaGeneralCopyright) |
|
1365 { |
|
1366 MPX_DEBUG1(" EMPXMediaGeneralCopyright"); |
|
1367 TPtrC copyright(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicCopyright)); |
|
1368 aMedia.SetTextValueL(KMPXMediaGeneralCopyright, copyright); |
|
1369 MPX_DEBUG2(" Copyright[%S]", ©right); |
|
1370 } |
|
1371 if (aAttrId & EMPXMediaGeneralFlags) |
|
1372 { |
|
1373 MPX_DEBUG1(" EMPXMediaGeneralFlags"); |
|
1374 TUint32 dbFlags(aMusicTable.ColumnInt64(EMusicDbFlag)); |
|
1375 MPX_DEBUG2(" dbFlags=%b", dbFlags); |
|
1376 TDriveUnit driveUnit; |
|
1377 if (aMedia.IsSupported(KMPXMediaGeneralUri)) |
|
1378 { |
|
1379 MPX_DEBUG1(" aMedia.IsSupported(KMPXMediaGeneralUri)"); |
|
1380 TParsePtrC parse( aMedia.ValueText(KMPXMediaGeneralUri) ); |
|
1381 if( parse.DrivePresent() ) |
|
1382 { |
|
1383 driveUnit = parse.Drive(); |
|
1384 } |
|
1385 else |
|
1386 { |
|
1387 driveUnit = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), |
|
1388 aMusicTable.ColumnInt64(EMusicVolumeId)); |
|
1389 } |
|
1390 MPX_DEBUG2(" driveUnit=%d", (TInt)driveUnit); |
|
1391 } |
|
1392 else |
|
1393 { |
|
1394 MPX_DEBUG1(" !aMedia.IsSupported(KMPXMediaGeneralUri)"); |
|
1395 driveUnit = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), |
|
1396 aMusicTable.ColumnInt64(EMusicVolumeId)); |
|
1397 MPX_DEBUG2(" driveUnit=%d", (TInt)driveUnit); |
|
1398 } |
|
1399 |
|
1400 TInt driveId = driveUnit & KMPXMediaGeneralFlagsDriveInfo; // 5 bits |
|
1401 aMedia.SetTObjectValueL<TUint>(KMPXMediaGeneralFlags, dbFlags | driveId); |
|
1402 |
|
1403 MPX_DEBUG2(" GeneralFlags[%b]", dbFlags | driveId); |
|
1404 MPX_DEBUG2(" DriveId[%u]", driveId); |
|
1405 } |
|
1406 if (aAttrId & EMPXMediaGeneralPlayCount) |
|
1407 { |
|
1408 MPX_DEBUG1(" EMPXMediaGeneralPlayCount"); |
|
1409 TUint32 playcount(aMusicTable.ColumnInt(EMusicPlayCount)); |
|
1410 aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralPlayCount, playcount); |
|
1411 MPX_DEBUG2(" PlayCount[%d]", playcount); |
|
1412 } |
|
1413 |
|
1414 MPX_DEBUG1("<--CMPXDbMusic::UpdateMediaGeneralL"); |
|
1415 } |
|
1416 |
|
1417 // ---------------------------------------------------------------------------- |
|
1418 // CMPXDbMusic::UpdateMediaMusicL |
|
1419 // ---------------------------------------------------------------------------- |
|
1420 // |
|
1421 void CMPXDbMusic::UpdateMediaMusicL( |
|
1422 RSqlStatement& aMusicTable, |
|
1423 const TUint aAttrId, |
|
1424 CMPXMedia& aMedia) |
|
1425 { |
|
1426 MPX_FUNC("CMPXDbMusic::UpdateMediaMusicL"); |
|
1427 |
|
1428 if (aAttrId & EMPXMediaMusicAlbumArtFileName) |
|
1429 { |
|
1430 TPtrC art(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicArt)); |
|
1431 aMedia.SetTextValueL(KMPXMediaMusicAlbumArtFileName, art); |
|
1432 MPX_DEBUG2(" Album Art File Name[%S]", &art); |
|
1433 } |
|
1434 if (aAttrId & EMPXMediaMusicArtist) |
|
1435 { |
|
1436 TPtrC artist(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicArtistName)); |
|
1437 aMedia.SetTextValueL(KMPXMediaMusicArtist, artist); |
|
1438 MPX_DEBUG2(" Artist[%S]", &artist); |
|
1439 } |
|
1440 if (aAttrId & EMPXMediaMusicAlbum) |
|
1441 { |
|
1442 TPtrC album(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicAlbumName)); |
|
1443 aMedia.SetTextValueL(KMPXMediaMusicAlbum, album); |
|
1444 MPX_DEBUG2(" Album[%S]", &album); |
|
1445 } |
|
1446 if ( aAttrId & EMPXMediaMusicYear) |
|
1447 { |
|
1448 const TDesC& dateStr(MPXDbCommonUtil::GetColumnTextL (aMusicTable, |
|
1449 EMusicReleaseDate)); |
|
1450 if ( dateStr.Compare (KNullDesC)!= 0) |
|
1451 { |
|
1452 TTime dateTime(MPXDbCommonUtil::DesToTTimeL (dateStr)); |
|
1453 aMedia.SetTObjectValueL<TInt64> (KMPXMediaMusicYear, |
|
1454 dateTime.Int64 ()); |
|
1455 MPX_DEBUG2(" Year[%d]", dateTime.Int64()); |
|
1456 } |
|
1457 MPX_DEBUG2(" ReleaseDate[%S]", &dateStr); |
|
1458 } |
|
1459 if (aAttrId & EMPXMediaMusicAlbumTrack) |
|
1460 { |
|
1461 TInt32 track(aMusicTable.ColumnInt(EMusicAlbumTrack)); |
|
1462 HBufC* hbuf = HBufC::NewLC(KMCIntegerLen); |
|
1463 if (track != KMaxTInt) |
|
1464 { |
|
1465 hbuf->Des().AppendFormat(_L("%d"), track); |
|
1466 } |
|
1467 aMedia.SetTextValueL(KMPXMediaMusicAlbumTrack, *hbuf); |
|
1468 MPX_DEBUG3(" Album Track[%S][%d]", hbuf, track); |
|
1469 CleanupStack::PopAndDestroy(hbuf); |
|
1470 } |
|
1471 if (aAttrId & EMPXMediaMusicGenre) |
|
1472 { |
|
1473 TPtrC genre(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicGenreName)); |
|
1474 aMedia.SetTextValueL(KMPXMediaMusicGenre, genre); |
|
1475 MPX_DEBUG2(" Music Genre[%S]", &genre); |
|
1476 } |
|
1477 if (aAttrId & EMPXMediaMusicComposer) |
|
1478 { |
|
1479 TPtrC composer(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicComposerName)); |
|
1480 aMedia.SetTextValueL(KMPXMediaMusicComposer, composer); |
|
1481 MPX_DEBUG2(" Music Composer[%S]", &composer); |
|
1482 } |
|
1483 if (aAttrId & EMPXMediaMusicRating) |
|
1484 { |
|
1485 TUint32 rating(aMusicTable.ColumnInt(EMusicRating)); |
|
1486 aMedia.SetTObjectValueL<TUint32>(KMPXMediaMusicRating, rating); |
|
1487 MPX_DEBUG2(" Music Rating[%d]", rating); |
|
1488 } |
|
1489 if (aAttrId & EMPXMediaMusicURL) |
|
1490 { |
|
1491 TPtrC url(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicUrl)); |
|
1492 aMedia.SetTextValueL(KMPXMediaMusicURL, url); |
|
1493 MPX_DEBUG2(" Music URL[%S]", &url); |
|
1494 } |
|
1495 if (aAttrId & EMPXMediaMusicOriginalAlbumArtFileName) |
|
1496 { |
|
1497 // Always set original album art to be file path |
|
1498 // Maybe add a new column to db for future if services like rhapsody pushes jpgs to us |
|
1499 if (aMedia.IsSupported(KMPXMediaGeneralUri)) |
|
1500 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
1501 { |
|
1502 TUint32 abstractAlbumId(aMusicTable.ColumnInt64(EMusicAbstractAlbum)); |
|
1503 TInt containEmbeddedArt = aMusicTable.ColumnInt( EMusicContainEmbeddedArt); |
|
1504 //embedded with art, no art |
|
1505 if (containEmbeddedArt || (!containEmbeddedArt && !abstractAlbumId)) //embedded with art case, no art |
|
1506 { |
|
1507 const TDesC& art(aMedia.ValueText(KMPXMediaGeneralUri)); |
|
1508 aMedia.SetTextValueL(KMPXMediaMusicOriginalAlbumArtFileName, art); |
|
1509 MPX_DEBUG2(" Music Original Album Art FullPath[%S]", &art); |
|
1510 } |
|
1511 //for abstractalbum case, originalAlbumArt from AbstractAlbum table |
|
1512 else if ( abstractAlbumId ) |
|
1513 { |
|
1514 HBufC* art = iObserver.HandleGetAlbumNameFromIdL(abstractAlbumId); |
|
1515 CleanupStack::PushL(art); |
|
1516 aMedia.SetTextValueL(KMPXMediaMusicOriginalAlbumArtFileName, *art); |
|
1517 MPX_DEBUG2(" Music Original Album Art FullPath[%S]", art); |
|
1518 CleanupStack::PopAndDestroy(art); |
|
1519 } |
|
1520 } |
|
1521 #else |
|
1522 { |
|
1523 const TDesC& uri(aMedia.ValueText(KMPXMediaGeneralUri)); |
|
1524 aMedia.SetTextValueL(KMPXMediaMusicOriginalAlbumArtFileName, uri); |
|
1525 MPX_DEBUG2(" Music Original Album Art FullPath[%S]", &uri); |
|
1526 } |
|
1527 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
1528 else |
|
1529 { |
|
1530 HBufC* fullPath = ConstructUriL(aMusicTable); |
|
1531 CleanupStack::PushL(fullPath); |
|
1532 aMedia.SetTextValueL(KMPXMediaMusicOriginalAlbumArtFileName, *fullPath); |
|
1533 MPX_DEBUG2(" Music Original Album Art FullPath[%S]", fullPath); |
|
1534 CleanupStack::PopAndDestroy(fullPath); |
|
1535 } |
|
1536 } |
|
1537 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
1538 if (aAttrId & EMPXMediaMusicAlbumArtist) |
|
1539 { |
|
1540 TPtrC albumartist(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicAlbumArtist)); |
|
1541 aMedia.SetTextValueL(KMPXMediaMusicAlbumArtist, albumartist); |
|
1542 MPX_DEBUG2(" Music AlbumArtist[%S]", &albumartist); |
|
1543 } |
|
1544 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
1545 } |
|
1546 |
|
1547 // ---------------------------------------------------------------------------- |
|
1548 // CMPXDbMusic::UpdateMediaAudioL |
|
1549 // ---------------------------------------------------------------------------- |
|
1550 // |
|
1551 void CMPXDbMusic::UpdateMediaAudioL( |
|
1552 RSqlStatement& aMusicTable, |
|
1553 const TUint aAttrId, |
|
1554 CMPXMedia& aMedia) |
|
1555 { |
|
1556 MPX_FUNC("CMPXDbMusic::UpdateMediaAudioL"); |
|
1557 |
|
1558 if (aAttrId & EMPXMediaAudioBitrate) |
|
1559 { |
|
1560 TUint32 bitrate(aMusicTable.ColumnInt(EMusicBitRate)); |
|
1561 aMedia.SetTObjectValueL<TUint32>(KMPXMediaAudioBitrate, bitrate); |
|
1562 MPX_DEBUG2(" Bitrate[%d]", bitrate); |
|
1563 } |
|
1564 if (aAttrId & EMPXMediaAudioSamplerate) |
|
1565 { |
|
1566 TUint32 samplerate(aMusicTable.ColumnInt(EMusicSampleRate)); |
|
1567 aMedia.SetTObjectValueL<TUint32>(KMPXMediaAudioSamplerate, samplerate); |
|
1568 MPX_DEBUG2(" SampleRate[%d]", samplerate); |
|
1569 } |
|
1570 if (aAttrId & EMPXMediaAudioNumberOfChannels) |
|
1571 { |
|
1572 TUint32 numchannels(aMusicTable.ColumnInt(EMusicNumChannels)); |
|
1573 aMedia.SetTObjectValueL<TUint32>(KMPXMediaAudioNumberOfChannels, numchannels); |
|
1574 MPX_DEBUG2(" Num of Channels[%d]", numchannels); |
|
1575 } |
|
1576 if (aAttrId & EMPXMediaAudioCodec) |
|
1577 { |
|
1578 TUint32 codec(aMusicTable.ColumnInt(EMusicCodec)); |
|
1579 aMedia.SetTObjectValueL<TUint32>(KMPXMediaAudioAudioCodec, codec); |
|
1580 MPX_DEBUG2(" Audio Codec[%d]", codec); |
|
1581 } |
|
1582 } |
|
1583 |
|
1584 // ---------------------------------------------------------------------------- |
|
1585 // CMPXDbMusic::UpdateMediaMTPL |
|
1586 // ---------------------------------------------------------------------------- |
|
1587 // |
|
1588 void CMPXDbMusic::UpdateMediaMTPL( |
|
1589 RSqlStatement& aMusicTable, |
|
1590 const TUint aAttrId, |
|
1591 CMPXMedia& aMedia) |
|
1592 { |
|
1593 MPX_FUNC("CMPXDbMusic::UpdateMediaMTPL"); |
|
1594 |
|
1595 if (aAttrId & KMPXMediaMTPDrmStatus.iAttributeId) |
|
1596 { |
|
1597 TUint32 val(aMusicTable.ColumnInt(EMusicMTPDrmStatus)); |
|
1598 aMedia.SetTObjectValueL<TUint16>(KMPXMediaMTPDrmStatus, val); |
|
1599 } |
|
1600 } |
|
1601 |
|
1602 // ---------------------------------------------------------------------------- |
|
1603 // CMPXDbMusic::GenerateMusicFieldsValuesL |
|
1604 // ---------------------------------------------------------------------------- |
|
1605 // |
|
1606 CMPXDbActiveTask::TChangeVisibility CMPXDbMusic::GenerateMusicFieldsValuesL( |
|
1607 TUint32 aSongId, |
|
1608 const CMPXMedia& aMedia, |
|
1609 CMPXMessageArray* aItemChangedMessages, |
|
1610 RSqlStatement* aMusicTable, |
|
1611 CDesCArray& aFields, |
|
1612 CDesCArray& aValues, |
|
1613 TInt aDrive) |
|
1614 { |
|
1615 MPX_FUNC("CMPXDbMusic::GenerateMusicFieldsValuesL"); |
|
1616 |
|
1617 CMPXDbActiveTask::TChangeVisibility visibleChange(CMPXDbActiveTask::ENotVisibile); |
|
1618 TBool metaDataModified(EFalse); |
|
1619 const TArray<TMPXAttribute> attributes = aMedia.Attributes(); |
|
1620 |
|
1621 TBool addSongChangedMessage(ETrue); |
|
1622 CMPXMessage* songChangedMessage(NULL); |
|
1623 if (aItemChangedMessages) |
|
1624 { |
|
1625 songChangedMessage = CMPXMedia::NewL(); |
|
1626 CleanupStack::PushL(songChangedMessage); |
|
1627 MPXDbCommonUtil::FillItemChangedMessageL(*songChangedMessage, aSongId, |
|
1628 aMusicTable ? EMPXItemModified : EMPXItemInserted, EMPXSong, KDBPluginUid); |
|
1629 } |
|
1630 |
|
1631 // NOTE: Attributes being processed here should be listed in IsSupported() |
|
1632 TInt attrCount(attributes.Count()); |
|
1633 for (TInt i = 0; i < attrCount; ++i) |
|
1634 { |
|
1635 TUint attributeId(attributes[i].AttributeId()); |
|
1636 |
|
1637 switch (attributes[i].ContentId()) |
|
1638 { |
|
1639 case KMPXMediaIdGeneral: |
|
1640 { |
|
1641 if (attributeId & EMPXMediaGeneralDeleted) |
|
1642 { |
|
1643 TBool deleted(aMedia.ValueTObjectL<TBool>(KMPXMediaGeneralDeleted)); |
|
1644 if (!aMusicTable || (deleted != aMusicTable->ColumnInt(EMusicDeleted))) |
|
1645 { |
|
1646 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicDel, deleted); |
|
1647 } |
|
1648 MPX_DEBUG2(" Deleted[%d]", deleted); |
|
1649 } |
|
1650 |
|
1651 if (attributeId & EMPXMediaGeneralFlags) |
|
1652 { |
|
1653 TUint flag(aMedia.ValueTObjectL<TUint>(KMPXMediaGeneralFlags)); |
|
1654 TUint32 curFlag(0); |
|
1655 if (aMusicTable) |
|
1656 { |
|
1657 curFlag = aMusicTable->ColumnInt64(EMusicDbFlag); |
|
1658 } |
|
1659 TUint32 oldFlag(curFlag); |
|
1660 |
|
1661 if (flag & KMPXMediaGeneralFlagsSetOrUnsetBit) |
|
1662 { |
|
1663 // Set bits |
|
1664 curFlag |= flag; |
|
1665 } |
|
1666 else |
|
1667 { |
|
1668 // Clear bits |
|
1669 curFlag &= (~flag); |
|
1670 } |
|
1671 |
|
1672 // The field is written ONLY if the flag value is changing |
|
1673 if (((curFlag ^ oldFlag) & 0x7FFFFFFF) != 0) |
|
1674 { |
|
1675 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicDbFlag, curFlag); |
|
1676 visibleChange = CMPXDbActiveTask::EAllVisible; |
|
1677 } |
|
1678 MPX_DEBUG2(" GeneralFlags[%b]", curFlag); |
|
1679 } |
|
1680 |
|
1681 if (attributeId & EMPXMediaGeneralTitle) |
|
1682 { |
|
1683 TBool titleChanged(NULL == aMusicTable); |
|
1684 |
|
1685 const TDesC& title = aMedia.ValueText(KMPXMediaGeneralTitle); |
|
1686 TPtrC truncatedTitle(title.Left(KMCMaxTextLen)); |
|
1687 if (aMusicTable) |
|
1688 { |
|
1689 // Title of the song has been changed |
|
1690 if (truncatedTitle.Compare(MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicTitle)) != 0) |
|
1691 { |
|
1692 titleChanged = ETrue; |
|
1693 } |
|
1694 } |
|
1695 |
|
1696 if (titleChanged) |
|
1697 { |
|
1698 if ( title.Length() == 0 ) |
|
1699 { |
|
1700 const TDesC& path = aMedia.ValueText( KMPXMediaGeneralUri ); |
|
1701 TParsePtrC parse( path ); |
|
1702 TPtrC truncatedParse( parse.Name().Left( KMCMaxTextLen ) ); |
|
1703 |
|
1704 MPXDbCommonUtil::AppendValueL( aFields, aValues, KMCMusicName, truncatedParse ); |
|
1705 } |
|
1706 else |
|
1707 { |
|
1708 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicName, truncatedTitle); |
|
1709 } |
|
1710 visibleChange = CMPXDbActiveTask::EAllVisible; |
|
1711 metaDataModified = ETrue; |
|
1712 |
|
1713 MPX_DEBUG2(" Title[%S]", &truncatedTitle); |
|
1714 } |
|
1715 } |
|
1716 |
|
1717 if (attributeId & EMPXMediaGeneralMimeType) |
|
1718 { |
|
1719 const TDesC& mimeTypeText( aMedia.ValueText(KMPXMediaGeneralMimeType) ); |
|
1720 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicMimeType, mimeTypeText); |
|
1721 MPX_DEBUG2(" MimeType[%S]", &mimeTypeText); |
|
1722 } |
|
1723 |
|
1724 if (attributeId & EMPXMediaGeneralUri) |
|
1725 { |
|
1726 const TDesC& uri = aMedia.ValueText(KMPXMediaGeneralUri); |
|
1727 const TDesC& uriTrunc(uri.Mid(KMCPathStartPos)); |
|
1728 |
|
1729 TDriveUnit driveUnit(uri); |
|
1730 TUint volId(MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), driveUnit)); |
|
1731 |
|
1732 if (!aMusicTable || ((uriTrunc != MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicLocation)) || |
|
1733 (volId != aMusicTable->ColumnInt64(EMusicVolumeId)))) |
|
1734 { |
|
1735 // only do the update something changed |
|
1736 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicVolumeId, volId); |
|
1737 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicLocation, |
|
1738 uri.Mid(KMCPathStartPos)); |
|
1739 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicDRM, DRMTypeL(uri)); |
|
1740 MPX_DEBUG3(" VolumeId[%u] Location[%S]", volId, &uri); |
|
1741 |
|
1742 if (!aMedia.IsSupported(KMPXMediaGeneralMimeType)) |
|
1743 { |
|
1744 TBuf< KMaxDataTypeLength > mimeTypeText(MPXDbCommonUtil::GetMimeTypeForUriL(uri).Des()); |
|
1745 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicMimeType, mimeTypeText); |
|
1746 MPX_DEBUG2(" MimeType[%S]", &mimeTypeText); |
|
1747 } |
|
1748 |
|
1749 if (!aMusicTable && !aMedia.IsSupported(KMPXMediaGeneralTitle)) |
|
1750 { |
|
1751 TParsePtrC parser(uri); |
|
1752 TPtrC title = parser.Name(); |
|
1753 // use file name as song name |
|
1754 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicName, title); |
|
1755 |
|
1756 visibleChange = CMPXDbActiveTask::EAllVisible; |
|
1757 MPX_DEBUG2(" Title[%S]", &title); |
|
1758 } |
|
1759 |
|
1760 // URI of the song has been changed. This changes the Id of the song |
|
1761 if (aMusicTable) |
|
1762 { |
|
1763 TUint32 newSongId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXCollection, uri, EFalse); |
|
1764 if (aSongId != newSongId) |
|
1765 { |
|
1766 MPX_DEBUG3(" CurrentSongId[0x%x] changed to [0x%x]", aSongId, newSongId); |
|
1767 if (songChangedMessage) |
|
1768 { |
|
1769 songChangedMessage->SetTObjectValueL<TMPXItemId>(KMPXMessageMediaGeneralId, newSongId); |
|
1770 songChangedMessage->SetTObjectValueL<TMPXItemId>(KMPXMessageMediaDeprecatedId, aSongId); |
|
1771 } |
|
1772 |
|
1773 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicUniqueId, newSongId); |
|
1774 } |
|
1775 } |
|
1776 } |
|
1777 } |
|
1778 |
|
1779 if (attributeId & EMPXMediaGeneralPlayCount) |
|
1780 { |
|
1781 TInt increment(aMedia.ValueTObjectL<TInt>(KMPXMediaGeneralPlayCount)); |
|
1782 TUint32 curCount(increment); |
|
1783 if (aMusicTable) |
|
1784 { |
|
1785 curCount += aMusicTable->ColumnInt(EMusicPlayCount); |
|
1786 } |
|
1787 |
|
1788 if (!aMusicTable || (curCount != aMusicTable->ColumnInt(EMusicPlayCount))) |
|
1789 { |
|
1790 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicPlayCount, curCount); |
|
1791 |
|
1792 // this needs to be visible in order for Recently Played and Most Played |
|
1793 // playlists will be updated |
|
1794 visibleChange = CMPXDbActiveTask::ESingleVisible; |
|
1795 |
|
1796 if (aItemChangedMessages) |
|
1797 { |
|
1798 iObserver.HandlePlayCountModifiedL(*aItemChangedMessages); |
|
1799 } |
|
1800 addSongChangedMessage = EFalse; |
|
1801 } |
|
1802 |
|
1803 MPX_DEBUG2(" PlayCount[%d]", curCount); |
|
1804 } |
|
1805 |
|
1806 if (attributeId & EMPXMediaGeneralLastPlaybackTime) |
|
1807 { |
|
1808 HBufC* time = MPXDbCommonUtil::TTimeToDesLC( |
|
1809 TTime(aMedia.ValueTObjectL<TInt64>(KMPXMediaGeneralLastPlaybackTime))); |
|
1810 if (!aMusicTable || (*time != MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicTimePlayed))) |
|
1811 { |
|
1812 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicTimePlayed, *time); |
|
1813 // this needs to be visible in order for Recently Played playlist to be updated |
|
1814 visibleChange = CMPXDbActiveTask::ESingleVisible; |
|
1815 |
|
1816 if (aItemChangedMessages) |
|
1817 { |
|
1818 iObserver.HandlePlaybackTimeModifiedL(*aItemChangedMessages); |
|
1819 } |
|
1820 addSongChangedMessage = EFalse; |
|
1821 } |
|
1822 MPX_DEBUG2(" PlaybackTime[%S]", time); |
|
1823 CleanupStack::PopAndDestroy(time); |
|
1824 } |
|
1825 |
|
1826 if (attributeId & EMPXMediaGeneralDuration) |
|
1827 { |
|
1828 TInt duration(aMedia.ValueTObjectL<TInt>(KMPXMediaGeneralDuration)); |
|
1829 if (!aMusicTable || (duration != aMusicTable->ColumnInt(EMusicDuration))) |
|
1830 { |
|
1831 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicDuration, duration); |
|
1832 visibleChange = CMPXDbActiveTask::EAllVisible; |
|
1833 metaDataModified = ETrue; |
|
1834 } |
|
1835 MPX_DEBUG2(" Duration[%d]", duration); |
|
1836 } |
|
1837 |
|
1838 if (attributeId & EMPXMediaGeneralSynchronized) |
|
1839 { |
|
1840 TBool synced(aMedia.ValueTObjectL<TBool>(KMPXMediaGeneralSynchronized)); |
|
1841 if (!aMusicTable || (synced != aMusicTable->ColumnInt(EMusicSync))) |
|
1842 { |
|
1843 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicSync, synced); |
|
1844 } |
|
1845 MPX_DEBUG2(" Synchronized[%d]", synced); |
|
1846 } |
|
1847 |
|
1848 if (attributeId & EMPXMediaGeneralModified) |
|
1849 { |
|
1850 TBool modified(aMedia.ValueTObjectL<TBool>(KMPXMediaGeneralModified)); |
|
1851 if (!aMusicTable || (modified != aMusicTable->ColumnInt(EMusicModified))) |
|
1852 { |
|
1853 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicMod, modified); |
|
1854 } |
|
1855 MPX_DEBUG2(" Modified[%d]", modified); |
|
1856 } |
|
1857 |
|
1858 if (attributeId & EMPXMediaGeneralComment) |
|
1859 { |
|
1860 TPtrC comment = aMedia.ValueText(KMPXMediaGeneralComment).Left(KMCMaxTextLen); |
|
1861 if (!aMusicTable || (comment != MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicComment))) |
|
1862 { |
|
1863 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicComment, comment); |
|
1864 metaDataModified = ETrue; |
|
1865 } |
|
1866 MPX_DEBUG2(" Comment[%S]", &comment); |
|
1867 } |
|
1868 |
|
1869 if (attributeId & EMPXMediaGeneralCopyright) |
|
1870 { |
|
1871 const TDesC& copyright = aMedia.ValueText(KMPXMediaGeneralCopyright). |
|
1872 Left(KMCMaxTextLen); |
|
1873 if (!aMusicTable || (copyright != MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicCopyright))) |
|
1874 { |
|
1875 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicCopyright, copyright); |
|
1876 metaDataModified = ETrue; |
|
1877 } |
|
1878 MPX_DEBUG2(" Copyright[%S]", ©right); |
|
1879 } |
|
1880 } |
|
1881 break; |
|
1882 |
|
1883 case KMPXMediaIdMusic: |
|
1884 { |
|
1885 if (attributeId & EMPXMediaMusicAlbumTrack) |
|
1886 { |
|
1887 const TDesC& trackNumber = aMedia.ValueText(KMPXMediaMusicAlbumTrack); |
|
1888 |
|
1889 // KMaxTInt is used to represent null album track |
|
1890 TInt track(KMaxTInt); |
|
1891 if (trackNumber.Length()) |
|
1892 { |
|
1893 TLex stringParser(trackNumber); |
|
1894 |
|
1895 if ((stringParser.Val(track) != KErrNone) || |
|
1896 (track == 0) || (track > 999)) // Limit track number to 3 characters |
|
1897 { |
|
1898 track = KMaxTInt; |
|
1899 } |
|
1900 } |
|
1901 |
|
1902 if (!aMusicTable || (track != aMusicTable->ColumnInt(EMusicAlbumTrack))) |
|
1903 { |
|
1904 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicTrackNumber, track); |
|
1905 visibleChange = CMPXDbActiveTask::EAllVisible; |
|
1906 metaDataModified = ETrue; |
|
1907 } |
|
1908 MPX_DEBUG3(" Album Track[%S][%d]", &trackNumber, track); |
|
1909 } |
|
1910 |
|
1911 if (attributeId & EMPXMediaMusicYear) |
|
1912 { |
|
1913 TInt64 int64(aMedia.ValueTObjectL<TInt64>(KMPXMediaMusicYear)); |
|
1914 |
|
1915 TTime maxTime(0); |
|
1916 maxTime += TTimeIntervalYears(9999); // Limit years to 4 characters |
|
1917 TTime time(int64); |
|
1918 |
|
1919 if (time > maxTime) |
|
1920 { |
|
1921 time = Time::NullTTime(); |
|
1922 } |
|
1923 |
|
1924 HBufC* timeStr = MPXDbCommonUtil::TTimeToDesLC(time); |
|
1925 if (!aMusicTable || (*timeStr != MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicReleaseDate))) |
|
1926 { |
|
1927 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicReleaseDate, *timeStr); |
|
1928 metaDataModified = ETrue; |
|
1929 } |
|
1930 MPX_DEBUG2(" Music Year[%S]", timeStr); |
|
1931 CleanupStack::PopAndDestroy(timeStr); |
|
1932 } |
|
1933 |
|
1934 if (attributeId & EMPXMediaMusicRating) |
|
1935 { |
|
1936 TInt rating(aMedia.ValueTObjectL<TInt>(KMPXMediaMusicRating)); |
|
1937 if (!aMusicTable || (rating != aMusicTable->ColumnInt(EMusicRating))) |
|
1938 { |
|
1939 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicRating, rating); |
|
1940 metaDataModified = ETrue; |
|
1941 } |
|
1942 MPX_DEBUG2(" Rating[%d]", rating); |
|
1943 } |
|
1944 |
|
1945 if (attributeId & EMPXMediaMusicAlbumArtFileName) |
|
1946 { |
|
1947 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
1948 TInt containEmbeddedArt(0); |
|
1949 if (aMusicTable ) |
|
1950 { |
|
1951 containEmbeddedArt = aMusicTable->ColumnInt(EMusicContainEmbeddedArt); |
|
1952 } |
|
1953 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
1954 const TDesC& albumArtFilename = aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen); |
|
1955 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
1956 TParsePtrC parse(albumArtFilename); |
|
1957 TPtrC ext(parse.Ext()); |
|
1958 //set flag to false, so .alb will not overwrite art field in album, artist table |
|
1959 // when song with embedded art |
|
1960 if ((ext.CompareF(KAbstractAlbumExt)== 0) && containEmbeddedArt) |
|
1961 { |
|
1962 iArtNeedUpdated = EFalse; |
|
1963 } |
|
1964 |
|
1965 if ( ((ext.CompareF(KAbstractAlbumExt)== 0) && !containEmbeddedArt) || (ext.CompareF(KAbstractAlbumExt)!= 0)) |
|
1966 { |
|
1967 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
1968 if (!aMusicTable || (albumArtFilename != MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicArt))) |
|
1969 { |
|
1970 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArt, albumArtFilename); |
|
1971 visibleChange = CMPXDbActiveTask::EAllVisible; |
|
1972 metaDataModified = ETrue; |
|
1973 } |
|
1974 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
1975 } |
|
1976 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
1977 MPX_DEBUG2(" Album Art Filename[%S]", &albumArtFilename); |
|
1978 } |
|
1979 |
|
1980 if (attributeId & EMPXMediaMusicURL) |
|
1981 { |
|
1982 const TDesC& url = aMedia.ValueText(KMPXMediaMusicURL).Left(KMCMaxTextLen); |
|
1983 if (!aMusicTable || (url != MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicUrl))) |
|
1984 { |
|
1985 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicUrl, url); |
|
1986 metaDataModified = ETrue; |
|
1987 } |
|
1988 |
|
1989 MPX_DEBUG2(" Music URL[%S]", &url); |
|
1990 } |
|
1991 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
1992 if (attributeId & EMPXMediaMusicAlbumArtist) |
|
1993 { |
|
1994 const TDesC& albumartist = aMedia.ValueText(KMPXMediaMusicAlbumArtist); |
|
1995 TPtrC truncatedAlbumartist(albumartist.Left(KMCMaxTextLen)); |
|
1996 |
|
1997 if (!aMusicTable || (truncatedAlbumartist.Compare(MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicAlbumArtist)) != 0)) |
|
1998 { |
|
1999 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicAlbumArtist, truncatedAlbumartist); |
|
2000 visibleChange = CMPXDbActiveTask::EAllVisible; |
|
2001 metaDataModified = ETrue; |
|
2002 } |
|
2003 } |
|
2004 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
2005 } |
|
2006 break; |
|
2007 |
|
2008 case KMPXMediaIdAudio: |
|
2009 { |
|
2010 if (attributeId & EMPXMediaAudioSamplerate) |
|
2011 { |
|
2012 TInt samplerate(aMedia.ValueTObjectL<TInt>(KMPXMediaAudioSamplerate)); |
|
2013 if (!aMusicTable || (samplerate != aMusicTable->ColumnInt(EMusicSampleRate))) |
|
2014 { |
|
2015 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicSampleRate, samplerate); |
|
2016 metaDataModified = ETrue; |
|
2017 } |
|
2018 |
|
2019 MPX_DEBUG2(" Sample Rate[%d]", samplerate); |
|
2020 } |
|
2021 |
|
2022 if (attributeId & EMPXMediaAudioBitrate) |
|
2023 { |
|
2024 TInt bitrate(aMedia.ValueTObjectL<TInt>(KMPXMediaAudioBitrate)); |
|
2025 if (!aMusicTable || (bitrate != aMusicTable->ColumnInt(EMusicBitRate))) |
|
2026 { |
|
2027 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicBitRate, bitrate); |
|
2028 metaDataModified = ETrue; |
|
2029 } |
|
2030 MPX_DEBUG2(" Bitrate[%d]", bitrate); |
|
2031 } |
|
2032 |
|
2033 if (attributeId & EMPXMediaAudioNumberOfChannels) |
|
2034 { |
|
2035 TUint32 val = aMedia.ValueTObjectL<TUint32>(KMPXMediaAudioNumberOfChannels); |
|
2036 if (!aMusicTable || (val != aMusicTable->ColumnInt(EMusicNumChannels))) |
|
2037 { |
|
2038 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicNumChannels, val); |
|
2039 } |
|
2040 MPX_DEBUG2(" Num of Channels[%d]", val); |
|
2041 } |
|
2042 } |
|
2043 break; |
|
2044 |
|
2045 case KMPXMediaIdDrm: |
|
2046 { |
|
2047 if (attributeId & EMPXMediaDrmType) |
|
2048 { |
|
2049 TInt drmType(aMedia.ValueTObjectL<TInt>(KMPXMediaDrmType)); |
|
2050 if (!aMusicTable || (drmType != aMusicTable->ColumnInt(EMusicDRM))) |
|
2051 { |
|
2052 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicDRM, drmType); |
|
2053 } |
|
2054 MPX_DEBUG2(" DRM type[%d]", drmType); |
|
2055 } |
|
2056 |
|
2057 if (attributeId & KMPXMediaDrmRightsStatus.iAttributeId) |
|
2058 { |
|
2059 if (aMusicTable) |
|
2060 { |
|
2061 TMPXMediaDrmRightsStatus status = |
|
2062 aMedia.ValueTObjectL<TMPXMediaDrmRightsStatus>(KMPXMediaDrmRightsStatus); |
|
2063 |
|
2064 //.Set the db flag |
|
2065 TUint32 curFlag(aMusicTable->ColumnInt64(EMusicDbFlag)); |
|
2066 TUint32 oldFlag(curFlag); |
|
2067 |
|
2068 if ((status != EMPXDrmRightsFull) && (status != EMPXDrmRightsRestricted)) |
|
2069 { |
|
2070 // No rights |
|
2071 curFlag |= KMPXMediaGeneralFlagsIsDrmLicenceInvalid; |
|
2072 } |
|
2073 else |
|
2074 { |
|
2075 // Rights valid |
|
2076 curFlag &= (KMPXMediaGeneralFlagsIsDrmLicenceInvalid ^ 0xFFFFFFFF); |
|
2077 } |
|
2078 |
|
2079 // The field is written ONLY if the flag value is changing |
|
2080 if (((curFlag ^ oldFlag) & 0x7FFFFFFF) != 0) |
|
2081 { |
|
2082 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicDbFlag, curFlag); |
|
2083 visibleChange = CMPXDbActiveTask::EAllVisible; |
|
2084 } |
|
2085 |
|
2086 MPX_DEBUG2(" Rights Status[%d]", curFlag); |
|
2087 } |
|
2088 } |
|
2089 |
|
2090 break; |
|
2091 } |
|
2092 |
|
2093 case KMPXMediaIdMTP: |
|
2094 { |
|
2095 if (attributeId & KMPXMediaMTPDrmStatus.iAttributeId) |
|
2096 { |
|
2097 TUint16 drmStatus(aMedia.ValueTObjectL<TUint16>(KMPXMediaMTPDrmStatus)); |
|
2098 if (!aMusicTable || (drmStatus != aMusicTable->ColumnInt(EMusicMTPDrmStatus))) |
|
2099 { |
|
2100 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicMTPDrmStatus, drmStatus); |
|
2101 } |
|
2102 MPX_DEBUG2(" MTP Drm Status[%d]", drmStatus); |
|
2103 } |
|
2104 } |
|
2105 break; |
|
2106 |
|
2107 default: |
|
2108 break; |
|
2109 } // end switch |
|
2110 } // end for |
|
2111 |
|
2112 // get the current artist/album/genre/composer/abstractalbum |
|
2113 // this is required because the recordset may be reused by the code below |
|
2114 TUint32 artistId(0); |
|
2115 TUint32 albumId(0); |
|
2116 TUint32 genreId(0); |
|
2117 TUint32 composerId(0); |
|
2118 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
2119 TUint32 abstractAlbumId(0); |
|
2120 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
2121 //need to get song art for updating art field in Album and Artist tables |
|
2122 TPtrC art(KNullDesC); |
|
2123 if (aMusicTable) |
|
2124 { |
|
2125 artistId = aMusicTable->ColumnInt64(EMusicArtist); |
|
2126 albumId = aMusicTable->ColumnInt64(EMusicAlbum); |
|
2127 genreId = aMusicTable->ColumnInt64(EMusicGenre); |
|
2128 composerId = aMusicTable->ColumnInt64(EMusicComposer); |
|
2129 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
2130 abstractAlbumId = aMusicTable->ColumnInt64(EMusicAbstractAlbum); |
|
2131 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
2132 art.Set(MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicArt)); |
|
2133 } |
|
2134 |
|
2135 // update the artist field |
|
2136 TUint32 id(0); |
|
2137 TUint32 artistIdForAlbum(artistId); |
|
2138 if (UpdateCategoryFieldL(EMPXArtist, aMedia, KMPXMediaMusicArtist, artistId, |
|
2139 aDrive, aItemChangedMessages, id, art)) |
|
2140 { |
|
2141 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArtist, id); |
|
2142 metaDataModified = (aMusicTable != NULL); |
|
2143 visibleChange = CMPXDbActiveTask::EAllVisible; |
|
2144 artistIdForAlbum = id; |
|
2145 } |
|
2146 |
|
2147 // update the album field |
|
2148 if (UpdateCategoryFieldL(EMPXAlbum, aMedia, KMPXMediaMusicAlbum, albumId, |
|
2149 aDrive, aItemChangedMessages, id, art)) |
|
2150 { |
|
2151 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicAlbum, id); |
|
2152 metaDataModified = (aMusicTable != NULL); |
|
2153 visibleChange = CMPXDbActiveTask::EAllVisible; |
|
2154 |
|
2155 // |
|
2156 // added to handle error EALU-73WDJN. If the album name of the last song |
|
2157 // in the album for the artist is changed to an existing album name from |
|
2158 // artist view, a change message needs to be sent in order for UI to |
|
2159 // correctly refresh. |
|
2160 // |
|
2161 // Fix for EDXU-7BBALS, remove check for HasOtherSongsInArtistAlbumL |
|
2162 // Always send a Album Inserted message when Album change to get Artist updated |
|
2163 if (aItemChangedMessages) |
|
2164 { |
|
2165 // send album added m essage instead of album deleted or modified |
|
2166 // to avoid collection paths of other clients being modified |
|
2167 MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, albumId, |
|
2168 EMPXItemInserted, EMPXAlbum, KDBPluginUid); |
|
2169 } |
|
2170 } |
|
2171 |
|
2172 // update the genre field |
|
2173 if (UpdateCategoryFieldL(EMPXGenre, aMedia, KMPXMediaMusicGenre, genreId, |
|
2174 aDrive, aItemChangedMessages, id)) |
|
2175 { |
|
2176 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicGenre, id); |
|
2177 metaDataModified = (aMusicTable != NULL); |
|
2178 visibleChange = CMPXDbActiveTask::EAllVisible; |
|
2179 } |
|
2180 |
|
2181 // update the composer field |
|
2182 if (UpdateCategoryFieldL(EMPXComposer, aMedia, KMPXMediaMusicComposer, composerId, |
|
2183 aDrive, aItemChangedMessages, id)) |
|
2184 { |
|
2185 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicComposer, id); |
|
2186 metaDataModified = (aMusicTable != NULL); |
|
2187 visibleChange = CMPXDbActiveTask::EAllVisible; |
|
2188 } |
|
2189 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
2190 if ( aMedia.IsSupported (KMPXMediaMusicAlbumArtFileName)) |
|
2191 { |
|
2192 const TDesC& albumArtFilename = aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen); |
|
2193 TParsePtrC parse( albumArtFilename ); |
|
2194 TPtrC ext( parse.Ext() ); |
|
2195 if (ext.CompareF(KAbstractAlbumExt)== 0) |
|
2196 { |
|
2197 if (UpdateCategoryFieldL(EMPXAbstractAlbum, aMedia, KMPXMediaMusicAlbumArtFileName, abstractAlbumId, |
|
2198 aDrive, aItemChangedMessages, id)) |
|
2199 { |
|
2200 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicAbstractAlbum, id); |
|
2201 metaDataModified = (aMusicTable != NULL); |
|
2202 visibleChange = CMPXDbActiveTask::EAllVisible; |
|
2203 } |
|
2204 } |
|
2205 } |
|
2206 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
2207 #if defined (__MTP_PROTOCOL_SUPPORT) |
|
2208 // Set Mod bit to ETrue if metadata has been updated and caller hasn't explicitly |
|
2209 // set/reset it |
|
2210 if (aMusicTable && |
|
2211 !aMedia.IsSupported(KMPXMediaGeneralModified) && |
|
2212 metaDataModified) |
|
2213 { |
|
2214 MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicMod, 1); |
|
2215 MPX_DEBUG1(" Modified[1]"); |
|
2216 } |
|
2217 #endif |
|
2218 |
|
2219 if (aItemChangedMessages) |
|
2220 { |
|
2221 if (aFields.Count() && addSongChangedMessage) |
|
2222 { |
|
2223 aItemChangedMessages->AppendL(*songChangedMessage); |
|
2224 } |
|
2225 CleanupStack::PopAndDestroy(songChangedMessage); |
|
2226 } |
|
2227 |
|
2228 return visibleChange; |
|
2229 } |
|
2230 |
|
2231 // ---------------------------------------------------------------------------- |
|
2232 // CMPXDbMusic::DRMTypeL |
|
2233 // ---------------------------------------------------------------------------- |
|
2234 // |
|
2235 TMCDrmType CMPXDbMusic::DRMTypeL( |
|
2236 const TDesC& aFile) |
|
2237 { |
|
2238 MPX_FUNC("CMPXDbMusic::DRMTypeL"); |
|
2239 |
|
2240 TMCDrmType drm(EMCDrmNone); |
|
2241 TInt pos(0); |
|
2242 TParsePtrC fullEntry(aFile); |
|
2243 TPtrC theExt = fullEntry.Ext(); |
|
2244 |
|
2245 if (iExtensionsDrm->Find(theExt, pos) == 0) |
|
2246 { |
|
2247 drm = MPXDbCommonUtil::GetDRMTypeL(aFile); |
|
2248 } |
|
2249 |
|
2250 return drm; |
|
2251 } |
|
2252 |
|
2253 // ---------------------------------------------------------------------------- |
|
2254 // CMPXDbMusic::GenerateMusicMatchingCriteriaLC |
|
2255 // ---------------------------------------------------------------------------- |
|
2256 // |
|
2257 HBufC* CMPXDbMusic::GenerateMusicMatchingCriteriaLC( |
|
2258 TUint32 aGeneralId, |
|
2259 TUint32 aContainerId, |
|
2260 TMPXGeneralType aType, |
|
2261 const CMPXMedia& aCriteria) |
|
2262 { |
|
2263 MPX_FUNC("CMPXDbMusic::GenerateMusicMatchingCriteriaLC"); |
|
2264 |
|
2265 const TArray<TMPXAttribute> criteria = aCriteria.Attributes(); |
|
2266 TInt criteriaCount(criteria.Count()); |
|
2267 |
|
2268 // construct an array of criteria strings |
|
2269 CDesCArrayFlat* sqlCriteria = new (ELeave) CDesCArrayFlat(criteriaCount); |
|
2270 CleanupStack::PushL(sqlCriteria); |
|
2271 |
|
2272 // If EMPXMediaGeneralDeleted is not defined, always unset the deleted bit for matching |
|
2273 if (!aCriteria.IsSupported(KMPXMediaGeneralDeleted)) |
|
2274 { |
|
2275 sqlCriteria->AppendL(KCriterionMusicNotDeleted); |
|
2276 } |
|
2277 |
|
2278 TBool volumeAdded(EFalse); |
|
2279 for (TInt i = 0; i < criteriaCount; ++i) |
|
2280 { |
|
2281 const TMPXAttribute& criterion = criteria[i]; |
|
2282 |
|
2283 if (criterion == KMPXMediaGeneralId) |
|
2284 { |
|
2285 // Set the type if no type is specified |
|
2286 TInt category(MPX_ITEM_CATEGORY(aGeneralId)); |
|
2287 |
|
2288 if( aType == EMPXNoType ) |
|
2289 { |
|
2290 aType = (category == EMPXCollection) ? EMPXItem : EMPXGroup; |
|
2291 } |
|
2292 |
|
2293 TPtrC ptr; |
|
2294 if (aType == EMPXItem && (category == EMPXCollection)) |
|
2295 { |
|
2296 ptr.Set(KCriterionMusicUniqueId); |
|
2297 } |
|
2298 else if (aType == EMPXGroup && (category == EMPXArtist)) |
|
2299 { |
|
2300 ptr.Set(KCriterionMusicArtist); |
|
2301 } |
|
2302 else if (aType == EMPXGroup && (category == EMPXAlbum)) |
|
2303 { |
|
2304 ptr.Set(KCriterionMusicAlbum); |
|
2305 } |
|
2306 else if (aType == EMPXGroup && (category == EMPXGenre)) |
|
2307 { |
|
2308 ptr.Set(KCriterionMusicGenre); |
|
2309 } |
|
2310 else if (aType == EMPXGroup && (category == EMPXComposer)) |
|
2311 { |
|
2312 ptr.Set(KCriterionMusicComposer); |
|
2313 } |
|
2314 else |
|
2315 { |
|
2316 User::Leave(KErrNotSupported); |
|
2317 } |
|
2318 |
|
2319 MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, ptr, aGeneralId); |
|
2320 } |
|
2321 else if (criterion == KMPXMediaGeneralContainerId) |
|
2322 { |
|
2323 TInt containerCategory(MPX_ITEM_CATEGORY(aContainerId)); |
|
2324 |
|
2325 if (aType == EMPXGroup && (containerCategory == EMPXArtist)) |
|
2326 { |
|
2327 MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, |
|
2328 KCriterionMusicArtist, aContainerId); |
|
2329 } |
|
2330 else if (aType == EMPXGroup && (containerCategory == EMPXAlbum)) |
|
2331 { |
|
2332 MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, |
|
2333 KCriterionMusicAlbum, aContainerId); |
|
2334 } |
|
2335 else |
|
2336 { |
|
2337 //User::Leave(KErrNotSupported); |
|
2338 } |
|
2339 } |
|
2340 else if (criterion == KMPXMediaGeneralTitle) |
|
2341 { |
|
2342 HBufC* title = MPXDbCommonUtil::ProcessPatternCharsLC( |
|
2343 aCriteria.ValueText(KMPXMediaGeneralTitle)); |
|
2344 MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionMusicTitle, *title); |
|
2345 CleanupStack::PopAndDestroy(title); |
|
2346 } |
|
2347 else if (criterion == KMPXMediaGeneralUri) |
|
2348 { |
|
2349 // full URI from criteria |
|
2350 const TDesC& uri = aCriteria.ValueText(KMPXMediaGeneralUri); |
|
2351 TUint32 itemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXCollection, |
|
2352 uri, EFalse); |
|
2353 |
|
2354 MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionMusicUniqueId, itemId); |
|
2355 } |
|
2356 else if (criterion == KMPXMediaGeneralDrive) |
|
2357 { |
|
2358 if (!volumeAdded) |
|
2359 { |
|
2360 // validate the drive letter, TDriveUnit panics if given drive isn't between |
|
2361 // 'A' to 'Z' |
|
2362 const TDesC& drive = aCriteria.ValueText(KMPXMediaGeneralDrive); |
|
2363 TInt driveInt = 0; |
|
2364 if( drive == KNullDesC || RFs::CharToDrive( drive[0], driveInt )!= KErrNone ) |
|
2365 { |
|
2366 User::Leave(KErrArgument); |
|
2367 } |
|
2368 TDriveUnit driveUnit(drive); |
|
2369 MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionMusicVolume, |
|
2370 MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), driveUnit)); |
|
2371 volumeAdded = ETrue; |
|
2372 } |
|
2373 } |
|
2374 else if (criterion == KMPXMediaGeneralSynchronized) |
|
2375 { |
|
2376 MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionMusicSync, |
|
2377 aCriteria.ValueTObjectL<TBool>(KMPXMediaGeneralSynchronized)); |
|
2378 } |
|
2379 else if (criterion == KMPXMediaGeneralDeleted) |
|
2380 { |
|
2381 MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionMusicDeleted, |
|
2382 aCriteria.ValueTObjectL<TBool>(KMPXMediaGeneralDeleted)); |
|
2383 } |
|
2384 else if (criterion == KMPXMediaGeneralModified) |
|
2385 { |
|
2386 MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionMusicModified, |
|
2387 aCriteria.ValueTObjectL<TBool>(KMPXMediaGeneralModified)); |
|
2388 } |
|
2389 else |
|
2390 { |
|
2391 // to-do: provide searching ability on the rest of the fields |
|
2392 } |
|
2393 } |
|
2394 |
|
2395 // construct the final criteria string |
|
2396 HBufC* criteriaStr = MPXDbCommonUtil::StringFromArrayLC(*sqlCriteria, KMCAndKeyword); |
|
2397 |
|
2398 CleanupStack::Pop(criteriaStr); |
|
2399 CleanupStack::PopAndDestroy(sqlCriteria); |
|
2400 CleanupStack::PushL(criteriaStr); |
|
2401 |
|
2402 return criteriaStr; |
|
2403 } |
|
2404 |
|
2405 // ---------------------------------------------------------------------------- |
|
2406 // CMPXDbMusic::ConstructUriL |
|
2407 // ---------------------------------------------------------------------------- |
|
2408 // |
|
2409 HBufC* CMPXDbMusic::ConstructUriL( |
|
2410 RSqlStatement& aMusicTable) |
|
2411 { |
|
2412 MPX_FUNC("CMPXDbMusic::ConstructUriL"); |
|
2413 |
|
2414 TUint volId(aMusicTable.ColumnInt64(EMusicVolumeId)); |
|
2415 TPtrC location(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicLocation)); |
|
2416 return MPXDbCommonUtil::CreateFullPathL( |
|
2417 MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), volId), location); |
|
2418 } |
|
2419 |
|
2420 // ---------------------------------------------------------------------------- |
|
2421 // CMPXDbMusic::CreateTableL |
|
2422 // ---------------------------------------------------------------------------- |
|
2423 // |
|
2424 void CMPXDbMusic::CreateTableL( |
|
2425 RSqlDatabase& aDatabase, |
|
2426 TBool /* aCorruptTable */) |
|
2427 { |
|
2428 MPX_FUNC("CMPXDbMusic::CreateTableL"); |
|
2429 |
|
2430 // Create the table |
|
2431 User::LeaveIfError(aDatabase.Exec(KMusicCreateTable)); |
|
2432 |
|
2433 // Do not create any other indexes than the one on UniqueId |
|
2434 // as they only slow down the database overall |
|
2435 User::LeaveIfError(aDatabase.Exec(KMusicDeletedTitleIndex)); |
|
2436 } |
|
2437 |
|
2438 // ---------------------------------------------------------------------------- |
|
2439 // CMPXDbMusic::DropTableL |
|
2440 // ---------------------------------------------------------------------------- |
|
2441 // |
|
2442 void CMPXDbMusic::DropTableL( |
|
2443 RSqlDatabase& aDatabase) |
|
2444 { |
|
2445 MPX_FUNC("CMPXDbMusic::DropTableL"); |
|
2446 User::LeaveIfError(aDatabase.Exec(KMusicDropTable)); |
|
2447 } |
|
2448 |
|
2449 // ---------------------------------------------------------------------------- |
|
2450 // CMPXDbMusic::CheckTableL |
|
2451 // ---------------------------------------------------------------------------- |
|
2452 // |
|
2453 TBool CMPXDbMusic::CheckTableL( |
|
2454 RSqlDatabase& aDatabase) |
|
2455 { |
|
2456 MPX_FUNC("CMPXDbMusic::CheckTableL"); |
|
2457 return DoCheckTable(aDatabase, KMusicCheckTable); |
|
2458 } |
|
2459 |
|
2460 // ---------------------------------------------------------------------------- |
|
2461 // CMPXDbMusic::UpdateCategoryFieldL |
|
2462 // ---------------------------------------------------------------------------- |
|
2463 // |
|
2464 TBool CMPXDbMusic::UpdateCategoryFieldL( |
|
2465 TMPXGeneralCategory aCategory, |
|
2466 const CMPXMedia& aMedia, |
|
2467 const TMPXAttribute& aAttribute, |
|
2468 TUint32 aOldId, |
|
2469 TInt aDriveId, |
|
2470 CMPXMessageArray* aItemChangedMessages, |
|
2471 TUint32& aItemId, const TDesC& aArt) |
|
2472 { |
|
2473 TBool updated(EFalse); |
|
2474 TBool itemNotRemoved( EFalse ); |
|
2475 TBool itemAdded( EFalse ); |
|
2476 |
|
2477 // update category table and add category Id to the music table |
|
2478 if (!aOldId || aMedia.IsSupported(aAttribute)) |
|
2479 { |
|
2480 TInt changeMsgCount( 0 ); |
|
2481 if( aItemChangedMessages ) |
|
2482 { |
|
2483 changeMsgCount = aItemChangedMessages->Count(); |
|
2484 } |
|
2485 |
|
2486 if (aMedia.IsSupported(aAttribute)) |
|
2487 { |
|
2488 TPtrC name(aMedia.ValueText(aAttribute).Left(KMCMaxTextLen)); |
|
2489 |
|
2490 // construct the new ID for the category record |
|
2491 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
2492 // genre and abstractalbum are not case sensitive |
|
2493 TBool caseSensitive = ETrue; |
|
2494 if ((aCategory == EMPXGenre) || (aCategory == EMPXAbstractAlbum)) |
|
2495 caseSensitive = EFalse; |
|
2496 |
|
2497 aItemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), aCategory, |
|
2498 name, caseSensitive); |
|
2499 |
|
2500 #else |
|
2501 // only genre is not case sensitive |
|
2502 aItemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), aCategory, |
|
2503 name, (aCategory != EMPXGenre)); |
|
2504 #endif |
|
2505 if (!aOldId || (aOldId != aItemId)) |
|
2506 { |
|
2507 // only add if the ID changed, |
|
2508 // otherwise the song was updated but the artist name was not |
|
2509 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
2510 if(aCategory == EMPXAbstractAlbum) |
|
2511 { |
|
2512 if (aMedia.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory) == EMPXSong ) |
|
2513 { |
|
2514 iObserver.AddCategoryItemL(aCategory, KNullDesC, aDriveId, |
|
2515 aItemChangedMessages, itemAdded, name, KNullDesC); |
|
2516 } |
|
2517 else |
|
2518 { |
|
2519 TPtrC albumartist(KNullDesC); |
|
2520 TPtrC abstractAlbumName(KNullDesC); |
|
2521 if (aMedia.IsSupported(KMPXMediaMusicAlbumArtist) ) |
|
2522 { |
|
2523 albumartist.Set(aMedia.ValueText(KMPXMediaMusicAlbumArtist).Left(KMCMaxTextLen)); |
|
2524 //get AlbumArt AbstractAlbum |
|
2525 MPX_DEBUG2(" albumartist[%S]", &albumartist); |
|
2526 } |
|
2527 if (aMedia.IsSupported(KMPXMediaGeneralTitle) ) |
|
2528 { |
|
2529 abstractAlbumName.Set(aMedia.ValueText(KMPXMediaGeneralTitle).Left(KMCMaxTextLen)); |
|
2530 MPX_DEBUG2(" abstractAlbumName[%S]", &abstractAlbumName); |
|
2531 } |
|
2532 // ignore the return value |
|
2533 |
|
2534 iObserver.AddCategoryItemL(aCategory, abstractAlbumName, aDriveId, |
|
2535 aItemChangedMessages, itemAdded, name, albumartist); |
|
2536 } |
|
2537 } |
|
2538 else |
|
2539 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
2540 if (aCategory == EMPXArtist || aCategory == EMPXAlbum) |
|
2541 { |
|
2542 TPtrC art(KNullDesC); |
|
2543 TPtrC artistname(KNullDesC); |
|
2544 |
|
2545 if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName)) |
|
2546 { |
|
2547 art.Set(aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen)); |
|
2548 } |
|
2549 if (aCategory == EMPXAlbum) |
|
2550 { |
|
2551 if (aMedia.IsSupported(KMPXMediaMusicArtist)) |
|
2552 { |
|
2553 artistname.Set(aMedia.ValueText(KMPXMediaMusicArtist).Left(KMCMaxTextLen)); |
|
2554 } |
|
2555 } |
|
2556 //for the update case, need to maitain art field for Artist/Album table. |
|
2557 if (aOldId && (aOldId != aItemId)) |
|
2558 { |
|
2559 iObserver.AddCategoryItemL(aCategory, name, artistname, aArt, aDriveId, aItemChangedMessages, itemAdded); |
|
2560 } |
|
2561 else |
|
2562 { |
|
2563 iObserver.AddCategoryItemL(aCategory, name, artistname, art, aDriveId, aItemChangedMessages, itemAdded); |
|
2564 } |
|
2565 } |
|
2566 else |
|
2567 { |
|
2568 // ignore the return value |
|
2569 iObserver.AddCategoryItemL(aCategory, name, aDriveId, |
|
2570 aItemChangedMessages, itemAdded); |
|
2571 } |
|
2572 updated = ETrue; |
|
2573 } |
|
2574 } |
|
2575 else |
|
2576 { |
|
2577 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
2578 // genre and abstractalbum are not case sensitive |
|
2579 aItemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), aCategory, KNullDesC, |
|
2580 (aCategory != EMPXGenre)&&(aCategory != EMPXAbstractAlbum)); |
|
2581 #else |
|
2582 // only genre is not case sensitive |
|
2583 aItemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), aCategory, KNullDesC, |
|
2584 (aCategory != EMPXGenre)); |
|
2585 #endif |
|
2586 if (!aOldId || (aOldId != aItemId)) |
|
2587 { |
|
2588 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
2589 if(aCategory == EMPXAbstractAlbum) |
|
2590 { |
|
2591 //get AlbumArt for AbstractAlbum |
|
2592 TPtrC albumartist(aMedia.ValueText(KMPXMediaMusicAlbumArtist).Left(KMCMaxTextLen)); |
|
2593 MPX_DEBUG2(" Music albumartist[%S]", &albumartist); |
|
2594 TPtrC abstractAlbumName(aMedia.ValueText(KMPXMediaGeneralTitle).Left(KMCMaxTextLen)); |
|
2595 MPX_DEBUG2(" Music abstractAlbumName[%S]", &abstractAlbumName); |
|
2596 // ignore the return value |
|
2597 iObserver.AddCategoryItemL(aCategory, abstractAlbumName, aDriveId, |
|
2598 aItemChangedMessages, itemAdded, KNullDesC, albumartist); |
|
2599 } |
|
2600 else |
|
2601 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
2602 if (aCategory == EMPXArtist || aCategory == EMPXAlbum) |
|
2603 { |
|
2604 TPtrC art(KNullDesC); |
|
2605 TPtrC artistname(KNullDesC); |
|
2606 if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName)) |
|
2607 { |
|
2608 art.Set(aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen)); |
|
2609 } |
|
2610 if (aCategory == EMPXAlbum) |
|
2611 { |
|
2612 if (aMedia.IsSupported(KMPXMediaMusicArtist)) |
|
2613 { |
|
2614 artistname.Set(aMedia.ValueText(KMPXMediaMusicArtist).Left(KMCMaxTextLen)); |
|
2615 } |
|
2616 } |
|
2617 iObserver.AddCategoryItemL(aCategory, KNullDesC, artistname, art, aDriveId, |
|
2618 aItemChangedMessages, itemAdded); |
|
2619 } |
|
2620 else |
|
2621 { |
|
2622 // ignore the return value |
|
2623 iObserver.AddCategoryItemL(aCategory, KNullDesC, aDriveId, |
|
2624 aItemChangedMessages, itemAdded); |
|
2625 } |
|
2626 updated = ETrue; |
|
2627 } |
|
2628 } |
|
2629 |
|
2630 if (aOldId && (aOldId != aItemId)) |
|
2631 { |
|
2632 iObserver.DeleteSongForCategoryL(aCategory, aOldId, aDriveId, |
|
2633 aItemChangedMessages, itemNotRemoved); |
|
2634 updated = ETrue; |
|
2635 } |
|
2636 |
|
2637 // Special case where the item(s) has been renamed. |
|
2638 // In this case, a new category is created +1 change msg |
|
2639 // a old category is removed +1 change msg |
|
2640 // We merge these 2 change messages into one using the deprecated ID |
|
2641 // |
|
2642 if( aItemChangedMessages ) |
|
2643 { |
|
2644 TInt newChangeMsgCount( aItemChangedMessages->Count() ); |
|
2645 if( newChangeMsgCount - changeMsgCount > 0 ) |
|
2646 { |
|
2647 TInt oldId = KErrNotFound; |
|
2648 TInt newId = KErrNotFound; |
|
2649 for( TInt i=0; i<newChangeMsgCount; ++i ) |
|
2650 { |
|
2651 CMPXMessage& msg = *(*aItemChangedMessages)[i]; |
|
2652 |
|
2653 TMPXItemId id = msg.ValueTObjectL<TMPXItemId>(KMPXMessageMediaGeneralId); |
|
2654 TMPXChangeEventType changeType = msg.ValueTObjectL<TMPXChangeEventType>(KMPXMessageChangeEventType); |
|
2655 |
|
2656 // Look for the added and deleted category IDs |
|
2657 // |
|
2658 if( id == aOldId && changeType == EMPXItemDeleted ) |
|
2659 { |
|
2660 oldId = i; |
|
2661 } |
|
2662 else if( id == aItemId && changeType == EMPXItemInserted ) |
|
2663 { |
|
2664 newId = i; |
|
2665 } |
|
2666 } |
|
2667 |
|
2668 if( oldId != KErrNotFound && |
|
2669 newId != KErrNotFound ) |
|
2670 { |
|
2671 aItemChangedMessages->Remove(oldId); // category removed |
|
2672 aItemChangedMessages->Remove(newId); // category added |
|
2673 MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aItemId, EMPXItemModified, |
|
2674 aCategory, KDBPluginUid, aOldId ); |
|
2675 } |
|
2676 else if ( oldId !=KErrNotFound && itemAdded ) // old item removed, new item already exist |
|
2677 { |
|
2678 MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aItemId, EMPXItemModified, |
|
2679 aCategory, KDBPluginUid, aOldId ); |
|
2680 } |
|
2681 else if ( newId !=KErrNotFound && itemNotRemoved ) // new item added, old item still exist |
|
2682 { |
|
2683 MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aOldId, EMPXItemModified, |
|
2684 aCategory, KDBPluginUid, aItemId ); |
|
2685 } |
|
2686 } |
|
2687 } |
|
2688 } |
|
2689 |
|
2690 return updated; |
|
2691 } |
|
2692 |
|
2693 |
|
2694 // ---------------------------------------------------------------------------- |
|
2695 // CMPXDbMusic::ExtraFieldsRequired |
|
2696 // ---------------------------------------------------------------------------- |
|
2697 // |
|
2698 TBool CMPXDbMusic::ExtraFieldsRequired( |
|
2699 const TArray<TMPXAttribute>& aAttrs) |
|
2700 { |
|
2701 MPX_DEBUG1("-->CMPXDbMusic::ExtraFieldsRequired"); |
|
2702 |
|
2703 // check if any extra fields are required |
|
2704 TUint defaultFields(EMPXMediaGeneralId | |
|
2705 EMPXMediaGeneralType | |
|
2706 EMPXMediaGeneralCategory | |
|
2707 EMPXMediaGeneralTitle | |
|
2708 EMPXMediaGeneralUri | |
|
2709 EMPXMediaGeneralFlags); |
|
2710 |
|
2711 TBool extraRequired(EFalse); |
|
2712 TInt count(aAttrs.Count()); |
|
2713 for (TInt i = 0; i < count; ++i) |
|
2714 { |
|
2715 TUint attributeId(aAttrs[i].AttributeId()|defaultFields); |
|
2716 MPX_DEBUG2(" attribute content id 0x%x", aAttrs[i].ContentId()); |
|
2717 MPX_DEBUG3(" attribute id %b, original attribute id %b", attributeId, aAttrs[i].AttributeId()); |
|
2718 |
|
2719 if (KMPXMediaIdGeneral != aAttrs[i].ContentId() || |
|
2720 attributeId != defaultFields) |
|
2721 { |
|
2722 MPX_DEBUG1(" extraRequired YES"); |
|
2723 extraRequired = ETrue; |
|
2724 break; |
|
2725 } |
|
2726 } |
|
2727 |
|
2728 MPX_DEBUG2("<--CMPXDbMusic::ExtraFieldsRequired returns %d", extraRequired); |
|
2729 return extraRequired; |
|
2730 } |
|
2731 |
|
2732 // ---------------------------------------------------------------------------------------------------------- |
|
2733 // Test if the given media contains supported attributes |
|
2734 // ---------------------------------------------------------------------------------------------------------- |
|
2735 // |
|
2736 TBool CMPXDbMusic::IsSupported( |
|
2737 const CMPXMedia& aMedia) |
|
2738 { |
|
2739 MPX_FUNC("CMPXDbMusic::IsSupported"); |
|
2740 |
|
2741 // this checklist should match the attributes processed in DoFillInDatabaseInfoL |
|
2742 return aMedia.IsSupported(KMPXMediaGeneralTitle) || |
|
2743 aMedia.IsSupported(KMPXMediaGeneralUri) || |
|
2744 aMedia.IsSupported(KMPXMediaGeneralComment) || |
|
2745 aMedia.IsSupported(KMPXMediaGeneralSynchronized) || |
|
2746 aMedia.IsSupported(KMPXMediaGeneralDeleted) || |
|
2747 aMedia.IsSupported(KMPXMediaGeneralModified) || |
|
2748 aMedia.IsSupported(KMPXMediaGeneralCopyright) || |
|
2749 aMedia.IsSupported(KMPXMediaGeneralDuration) || |
|
2750 aMedia.IsSupported(KMPXMediaGeneralFlags) || |
|
2751 aMedia.IsSupported(KMPXMediaGeneralPlayCount) || |
|
2752 aMedia.IsSupported(KMPXMediaGeneralLastPlaybackTime) || |
|
2753 aMedia.IsSupported(KMPXMediaMusicAlbumTrack) || |
|
2754 aMedia.IsSupported(KMPXMediaMusicYear) || |
|
2755 aMedia.IsSupported(KMPXMediaMusicRating) || |
|
2756 aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName) || |
|
2757 aMedia.IsSupported(KMPXMediaMusicURL) || |
|
2758 aMedia.IsSupported(KMPXMediaMusicArtist) || |
|
2759 aMedia.IsSupported(KMPXMediaMusicAlbum) || |
|
2760 aMedia.IsSupported(KMPXMediaMusicGenre) || |
|
2761 aMedia.IsSupported(KMPXMediaMusicComposer) || |
|
2762 aMedia.IsSupported(KMPXMediaAudioSamplerate) || |
|
2763 aMedia.IsSupported(KMPXMediaAudioBitrate) || |
|
2764 aMedia.IsSupported(KMPXMediaAudioNumberOfChannels) || |
|
2765 aMedia.IsSupported(KMPXMediaDrmType) || |
|
2766 aMedia.IsSupported(KMPXMediaDrmRightsStatus) || |
|
2767 aMedia.IsSupported(KMPXMediaMTPDrmStatus) |
|
2768 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
2769 ||aMedia.IsSupported(KMPXMediaMusicAlbumArtist) |
|
2770 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
2771 ; |
|
2772 } |
|
2773 |
|
2774 // End of File |