diff -r 33ae025ac1e8 -r 2290317b9ec5 harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp --- a/harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp Mon May 03 12:55:01 2010 +0300 +++ b/harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp Fri May 14 16:38:28 2010 +0300 @@ -23,10 +23,12 @@ #include #include #include +#include #include "harvesteraudioplugin.h" #include "harvesteraudiopluginutils.h" #include "mdsutils.h" +#include "mdscommoninternal.h" #include "harvesterlog.h" @@ -34,8 +36,6 @@ const TUid KHarvesterRepoUid = { 0x200009FE }; const TUint32 KEnableAlbumArtHarvest = 0x00090001; -_LIT( KExtensionWma, "wma" ); - CHarvesterAudioPluginPropertyDefs::CHarvesterAudioPluginPropertyDefs() : CBase() { } @@ -52,6 +52,7 @@ iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty ); iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty ); iTimeOffsetPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTimeOffsetProperty ); + iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KInDefaultFolder ); // Media property definitions CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject ); @@ -119,6 +120,9 @@ delete iAudioParser; delete iPropDefs; delete iTNM; + + delete iPhoneSoundsPath; + delete iMmcSoundsPath; } // --------------------------------------------------------------------------- @@ -140,6 +144,17 @@ { TRAP_IGNORE( iTNM = CThumbnailManager::NewL( *this ) ); } + + + TFileName sounds = PathInfo::SoundsPath(); + + TFileName phonePath = PathInfo::PhoneMemoryRootPath(); + phonePath.Append( sounds ); + iPhoneSoundsPath = phonePath.AllocL(); + + TFileName mmcPath = PathInfo::MemoryCardRootPath(); + mmcPath.Append( sounds ); + iMmcSoundsPath = mmcPath.Right( mmcPath.Length() - 1 ).AllocL(); } // --------------------------------------------------------------------------- @@ -244,7 +259,7 @@ // get properties for file types supported by CMetaDataUtility. if( mapping->iHandler == EMetaDataUtilityHandling ) { - GetMusicPropertiesL( aHD, aIsAdd ); + GetMusicPropertiesL( aHD, aIsAdd, mapping->iMimeType ); } } } @@ -327,7 +342,7 @@ // --------------------------------------------------------------------------- // void CHarvesterAudioPlugin::GetMusicPropertiesL( CHarvesterData* aHD, - TBool aIsAdd ) + TBool aIsAdd, TPtrC aMimeType ) { #ifdef _DEBUG TTime dStart, dStop; @@ -346,12 +361,17 @@ // Prefetch max text lengt for validity checking iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL(); } - - TPtrC ext; - MdsUtils::GetExt( uri, ext ); - - // Check for possibly protected content - if( ext.CompareF( KExtensionWma ) == 0 ) + + TBool possiblyProtectedContent( EFalse ); + if( aMimeType.Length() > 0 ) + { + if( aMimeType == KMimeTypeWma ) + { + possiblyProtectedContent = ETrue; + } + } + + if( possiblyProtectedContent ) { ContentAccess::CContent* content = ContentAccess::CContent::NewLC( uri ); ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EPeek ); @@ -365,7 +385,7 @@ } CleanupStack::PopAndDestroy( 2 ); // content, data } - + TBool parsed( EFalse ); TRAPD( parseError, parsed = iAudioParser->ParseL( uri ) ); @@ -394,9 +414,24 @@ TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset(); TInt16 timeOffsetMinutes = timeOffsetSeconds.Int() / 60; CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iTimeOffsetPropertyDef, &timeOffsetMinutes, aIsAdd ); - + + if( !mdeObject.Placeholder() ) + { + if( uri.FindF( iMmcSoundsPath->Des()) != KErrNotFound || + uri.FindF( iPhoneSoundsPath->Des()) != KErrNotFound ) + { + TBool inDefaultFolder( ETrue ); + CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd ); + } + else + { + TBool inDefaultFolder( EFalse ); + CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd ); + } + } + if ( song.Length() > 0 - && song.Length() < iMaxTextLength ) + && song.Length() < KMaxTitleFieldLength ) { CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, *iPropDefs->iTitlePropertyDef, &song, EFalse );