--- a/harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp Tue Jul 06 14:44:37 2010 +0300
+++ b/harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp Wed Aug 18 10:12:07 2010 +0300
@@ -25,6 +25,7 @@
#include <caf/caf.h>
#include <pathinfo.h>
+#include "harvestercommon.h"
#include "harvesteraudioplugin.h"
#include "harvesteraudiopluginutils.h"
#include "mdsutils.h"
@@ -36,52 +37,55 @@
const TUid KHarvesterRepoUid = { 0x200009FE };
const TUint32 KEnableAlbumArtHarvest = 0x00090001;
-CHarvesterAudioPluginPropertyDefs::CHarvesterAudioPluginPropertyDefs() : CBase()
+CHarvesterAudioPluginPropertyDefs::CHarvesterAudioPluginPropertyDefs() : CBase(),
+ iCreationDatePropertyDef( NULL )
{
}
void CHarvesterAudioPluginPropertyDefs::ConstructL(CMdEObjectDef& aObjectDef)
{
- CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef();
+ SetByObjectDefL( aObjectDef );
+ }
+
+CHarvesterAudioPluginPropertyDefs* CHarvesterAudioPluginPropertyDefs::NewL()
+ {
+ CHarvesterAudioPluginPropertyDefs* self =
+ new (ELeave) CHarvesterAudioPluginPropertyDefs();
+ return self;
+ }
- // Common property definitions
- CMdEObjectDef& objectDef = nsDef.GetObjectDefL( MdeConstants::Object::KBaseObject );
- iCreationDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KCreationDateProperty );
- iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty );
- iSizePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty );
- iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty );
- iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty );
+void CHarvesterAudioPluginPropertyDefs::SetByObjectDefL(CMdEObjectDef& aObjectDef)
+ {
+ CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef();
+
+ // Common property definitions
+ CMdEObjectDef& objectDef = nsDef.GetObjectDefL( MdeConstants::Object::KBaseObject );
+ iCreationDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KCreationDateProperty );
+ iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty );
+ iSizePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty );
+ 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 );
- iRatingPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KRatingProperty );
- iGenrePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty );
- iArtistPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KArtistProperty );
- iDurationPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDurationProperty );
- iCopyrightPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KCopyrightProperty );
- iTrackPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KTrackProperty );
- iThumbnailPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KThumbnailPresentProperty );
- iDatePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KReleaseDateProperty );
+ // Media property definitions
+ CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject );
+ iRatingPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KRatingProperty );
+ iGenrePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty );
+ iArtistPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KArtistProperty );
+ iDurationPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDurationProperty );
+ iCopyrightPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KCopyrightProperty );
+ iTrackPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KTrackProperty );
+ iThumbnailPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KThumbnailPresentProperty );
+ iDatePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KReleaseDateProperty );
iDrmPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDRMProperty );
- // Audio property definitions
- CMdEObjectDef& audioDef = nsDef.GetObjectDefL( MdeConstants::Audio::KAudioObject );
- iAlbumPropertyDef = &audioDef.GetPropertyDefL( MdeConstants::Audio::KAlbumProperty );
- iComposerPropertyDef = &audioDef.GetPropertyDefL( MdeConstants::Audio::KComposerProperty );
- iOriginalArtistPropertyDef = &audioDef.GetPropertyDefL( MdeConstants::Audio::KOriginalArtistProperty );
- }
-
-CHarvesterAudioPluginPropertyDefs* CHarvesterAudioPluginPropertyDefs::NewL(CMdEObjectDef& aObjectDef)
- {
- CHarvesterAudioPluginPropertyDefs* self =
- new (ELeave) CHarvesterAudioPluginPropertyDefs();
- CleanupStack::PushL( self );
- self->ConstructL( aObjectDef );
- CleanupStack::Pop( self );
- return self;
- }
+ // Audio property definitions
+ CMdEObjectDef& audioDef = nsDef.GetObjectDefL( MdeConstants::Audio::KAudioObject );
+ iAlbumPropertyDef = &audioDef.GetPropertyDefL( MdeConstants::Audio::KAlbumProperty );
+ iComposerPropertyDef = &audioDef.GetPropertyDefL( MdeConstants::Audio::KComposerProperty );
+ iOriginalArtistPropertyDef = &audioDef.GetPropertyDefL( MdeConstants::Audio::KOriginalArtistProperty );
+ }
using namespace MdeConstants;
@@ -118,11 +122,16 @@
WRITELOG( "CHarvesterAudioPlugin::~CHarvesterAudioPlugin()" );
delete iAudioParser;
+ iAudioParser = NULL;
delete iPropDefs;
+ iPropDefs = NULL;
delete iTNM;
+ iTNM = NULL;
delete iPhoneSoundsPath;
+ iPhoneSoundsPath = NULL;
delete iMmcSoundsPath;
+ iMmcSoundsPath = NULL;
}
// ---------------------------------------------------------------------------
@@ -144,7 +153,10 @@
{
TRAP_IGNORE( iTNM = CThumbnailManager::NewL( *this ) );
}
+
+ iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL();
+ SetPriority( KHarvesterPriorityHarvestingPlugin - 2 );
TFileName sounds = PathInfo::SoundsPath();
@@ -287,13 +299,7 @@
TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset();
TTime localModifiedDate = entry.iModified + timeOffsetSeconds;
- if( !iPropDefs )
- {
- CMdEObjectDef& objectDef = mdeObject.Def();
- iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( objectDef );
- // Prefetch max text lengt for validity checking
- iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL();
- }
+ InitPropDefsL( mdeObject.Def() );
CMdeObjectWrapper::HandleObjectPropertyL(
mdeObject, *iPropDefs->iCreationDatePropertyDef, &localModifiedDate, aIsAdd );
@@ -322,13 +328,7 @@
if ( mapping && !mdeObject.Placeholder() )
{
- if( !iPropDefs )
- {
- CMdEObjectDef& objectDef = mdeObject.Def();
- iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( objectDef );
- // Prefetch max text lengt for validity checking
- iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL();
- }
+ InitPropDefsL( mdeObject.Def() );
CMdeObjectWrapper::HandleObjectPropertyL( mdeObject,
*iPropDefs->iItemTypePropertyDef, (TAny*)&(mapping->iMimeType), aIsAdd );
@@ -354,13 +354,7 @@
CMdEObject& mdeObject = aHD->MdeObject();
const TDesC& uri = mdeObject.Uri();
- if( !iPropDefs )
- {
- CMdEObjectDef& audioObjectDef = mdeObject.Def();
- iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( audioObjectDef );
- // Prefetch max text lengt for validity checking
- iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL();
- }
+ InitPropDefsL( mdeObject.Def() );
TBool possiblyProtectedContent( EFalse );
if( aMimeType.Length() > 0 )
@@ -534,6 +528,7 @@
CleanupStack::Pop(); // jpegBuf
iTNM->CreateThumbnails( *tnmSource );
delete tnmSource;
+ tnmSource = NULL;
TBool thumbnailPresent( ETrue );
CMdeObjectWrapper::HandleObjectPropertyL( mdeObject,
*iPropDefs->iThumbnailPropertyDef, &thumbnailPresent, aIsAdd );
@@ -553,5 +548,15 @@
#endif
}
+void CHarvesterAudioPlugin::InitPropDefsL(CMdEObjectDef& aObjectDef)
+ {
+ if( !iPropDefs->iCreationDatePropertyDef )
+ {
+ iPropDefs->SetByObjectDefL( aObjectDef );
+ // Prefetch max text lengt for validity checking
+ iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL();
+ }
+ }
+
// End of file