561 TInt err(KErrNone); |
561 TInt err(KErrNone); |
562 while ((err = recordset.Next()) == KSqlAtRow) |
562 while ((err = recordset.Next()) == KSqlAtRow) |
563 { |
563 { |
564 // Setup basic info - with first record of a group |
564 // Setup basic info - with first record of a group |
565 TUint32 playlistId(recordset.ColumnInt64(EPlaylistUniqueId)); |
565 TUint32 playlistId(recordset.ColumnInt64(EPlaylistUniqueId)); |
|
566 TUint32 volId(recordset.ColumnInt64(EPlaylistVolumeId)); |
|
567 TInt driveId = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), volId); |
566 |
568 |
567 TBool valid(ETrue); |
569 TBool valid(ETrue); |
568 TInt songCount(-1); |
570 TInt songCount(-1); |
569 if (criteriaCounterSet) |
571 if (criteriaCounterSet) |
570 { |
572 { |
571 songCount = iPlaylistSongs->CountL(playlistId); |
573 if (driveId >= 0) |
|
574 { |
|
575 //valid disk |
|
576 songCount = iPlaylistSongs->CountL(playlistId, driveId); |
|
577 } |
572 valid = (criteriaCounter == songCount); |
578 valid = (criteriaCounter == songCount); |
573 } |
579 } |
574 |
580 |
575 if (valid) |
581 if (valid) |
576 { |
582 { |
701 TBool countRequested(EFalse); |
707 TBool countRequested(EFalse); |
702 TBool durationRequested(EFalse); |
708 TBool durationRequested(EFalse); |
703 TUint32 playlistId(aRecord.ColumnInt64(EPlaylistUniqueId)); |
709 TUint32 playlistId(aRecord.ColumnInt64(EPlaylistUniqueId)); |
704 |
710 |
705 TInt count(aAttrs.Count()); |
711 TInt count(aAttrs.Count()); |
|
712 TUint32 volId(aRecord.ColumnInt64(EPlaylistVolumeId)); |
|
713 TInt driveId = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), volId); |
706 for (TInt i = 0; i < count; ++i) |
714 for (TInt i = 0; i < count; ++i) |
707 { |
715 { |
708 TInt contentId(aAttrs[i].ContentId()); |
716 TInt contentId(aAttrs[i].ContentId()); |
709 TUint attributeId(aAttrs[i].AttributeId()); |
717 TUint attributeId(aAttrs[i].AttributeId()); |
710 |
718 |
728 } |
736 } |
729 if ((attributeId & EMPXMediaGeneralUri) || |
737 if ((attributeId & EMPXMediaGeneralUri) || |
730 (attributeId & EMPXMediaGeneralDrive) || |
738 (attributeId & EMPXMediaGeneralDrive) || |
731 (attributeId & EMPXMediaGeneralFlags)) |
739 (attributeId & EMPXMediaGeneralFlags)) |
732 { |
740 { |
733 TUint32 volId(aRecord.ColumnInt64(EPlaylistVolumeId)); |
|
734 TInt driveId = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), volId); |
|
735 |
741 |
736 // LTAN-7GH6BZ, crash if eject memory card when adding song to existing playlist |
742 // LTAN-7GH6BZ, crash if eject memory card when adding song to existing playlist |
737 // due to special timing issue, it is possible drive number is -1 and create a |
743 // due to special timing issue, it is possible drive number is -1 and create a |
738 // panic when use for TDriveUnit |
744 // panic when use for TDriveUnit |
739 MPX_DEBUG3("volId = %d, driveId = %d", volId, driveId); |
745 MPX_DEBUG3("volId = %d, driveId = %d", volId, driveId); |
796 durationRequested = ETrue; |
802 durationRequested = ETrue; |
797 } |
803 } |
798 } // end if contentId == KMPXMediaIdGeneral |
804 } // end if contentId == KMPXMediaIdGeneral |
799 } // end for |
805 } // end for |
800 |
806 |
|
807 TInt plSongCount(0); |
|
808 TInt plSongDuration(0); |
801 if (countRequested) |
809 if (countRequested) |
802 { |
810 { |
803 TInt count = iPlaylistSongs->CountL(playlistId); |
811 if (driveId >= 0) |
|
812 { |
|
813 //valid disk |
|
814 iObserver.HandlePlaylistInfoL(playlistId, plSongCount, plSongDuration); |
|
815 } |
804 aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount, |
816 aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount, |
805 count ); |
817 plSongCount ); |
806 |
818 |
807 MPX_DEBUG1(" EMPXMediaGeneralCount"); |
819 MPX_DEBUG1(" EMPXMediaGeneralCount"); |
808 MPX_DEBUG2(" Count[%d]", count); |
820 MPX_DEBUG2(" Count[%d]", plSongCount); |
809 } |
821 } |
810 if (durationRequested) |
822 if (durationRequested) |
811 { |
823 { |
812 TInt duration = iObserver.HandlePlaylistDurationL(playlistId); |
824 aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralDuration, plSongDuration); |
813 aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralDuration, duration); |
825 |
814 |
826 MPX_DEBUG1(" EMPXMediaGeneralDuration"); |
815 MPX_DEBUG1(" EMPXMediaGeneralDuration"); |
827 MPX_DEBUG2(" Duration[%d]", plSongDuration); |
816 MPX_DEBUG2(" Duration[%d]", duration); |
|
817 } |
828 } |
818 |
829 |
819 aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem); |
830 aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem); |
820 aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, EMPXPlaylist); |
831 aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, EMPXPlaylist); |
821 } |
832 } |