harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp
branchRCL_3
changeset 7 3cebc1a84278
parent 3 6752808b2036
child 8 50de4d668bb6
equal deleted inserted replaced
6:646a02f170b9 7:3cebc1a84278
    40 
    40 
    41 void CHarvesterAudioPluginPropertyDefs::ConstructL(CMdEObjectDef& aObjectDef)
    41 void CHarvesterAudioPluginPropertyDefs::ConstructL(CMdEObjectDef& aObjectDef)
    42 	{
    42 	{
    43 	CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef();
    43 	CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef();
    44 
    44 
    45 	// Image property definitions
    45 	// Common property definitions
    46 	CMdEObjectDef& objectDef = nsDef.GetObjectDefL( MdeConstants::Object::KBaseObject );
    46 	CMdEObjectDef& objectDef = nsDef.GetObjectDefL( MdeConstants::Object::KBaseObject );
    47 	iCreationDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KCreationDateProperty );
    47 	iCreationDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KCreationDateProperty );
    48 	iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty );
    48 	iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty );
    49 	iSizePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty );
    49 	iSizePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty );
    50 	iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty );
    50 	iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty );
    51 	iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty );
    51 	iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty );
       
    52     iTimeOffsetPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTimeOffsetProperty );
    52 
    53 
    53 	// Media property definitions
    54 	// Media property definitions
    54 	CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject );
    55 	CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject );
    55 	iRatingPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KRatingProperty );
    56 	iRatingPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KRatingProperty );
    56 	iGenrePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty );
    57 	iGenrePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty );
   134     if( iHarvestAlbumArt )
   135     if( iHarvestAlbumArt )
   135         {
   136         {
   136         TRAP_IGNORE( iTNM = CThumbnailManager::NewL( *this ) );
   137         TRAP_IGNORE( iTNM = CThumbnailManager::NewL( *this ) );
   137         }
   138         }
   138     
   139     
   139     SetPriority( KHarvesterPriorityHarvestingPlugin - 1);
   140     SetPriority( KHarvesterPriorityHarvestingPlugin - 2 );
   140 	}
   141 	}
   141 
   142 
   142 // ---------------------------------------------------------------------------
   143 // ---------------------------------------------------------------------------
   143 // CHarvesterAudioPlugin::HarvestL (from CHarvesterPlugin)
   144 // CHarvesterAudioPlugin::HarvestL (from CHarvesterPlugin)
   144 // ---------------------------------------------------------------------------
   145 // ---------------------------------------------------------------------------
   264     if ( err!= KErrNone )
   265     if ( err!= KErrNone )
   265         {
   266         {
   266         User::Leave( err ); // metadata cannot be gathered!
   267         User::Leave( err ); // metadata cannot be gathered!
   267         }
   268         }
   268     
   269     
   269 	TTime now;
   270     TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset();
   270 	now.HomeTime();
   271     TTime localModifiedDate = entry.iModified + timeOffsetSeconds;
   271     
   272 	
   272 	if( !iPropDefs )
   273 	if( !iPropDefs )
   273 		{
   274 		{
   274 		CMdEObjectDef& objectDef = mdeObject.Def();
   275 		CMdEObjectDef& objectDef = mdeObject.Def();
   275 		iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( objectDef );
   276 		iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( objectDef );
   276 		}
   277 		}
   277 	
   278 	
   278 	CMdeObjectWrapper::HandleObjectPropertyL(
   279 	CMdeObjectWrapper::HandleObjectPropertyL(
   279                  mdeObject, *iPropDefs->iCreationDatePropertyDef, &now, aIsAdd );
   280                  mdeObject, *iPropDefs->iCreationDatePropertyDef, &localModifiedDate, aIsAdd );
   280 
   281 
   281 	CMdeObjectWrapper::HandleObjectPropertyL(
   282 	CMdeObjectWrapper::HandleObjectPropertyL(
   282              mdeObject, *iPropDefs->iLastModifiedDatePropertyDef, &entry.iModified, aIsAdd );
   283              mdeObject, *iPropDefs->iLastModifiedDatePropertyDef, &entry.iModified, aIsAdd );
   283 
   284 
   284 	CMdeObjectWrapper::HandleObjectPropertyL(
   285 	CMdeObjectWrapper::HandleObjectPropertyL(
   359 	if( !iPropDefs )
   360 	if( !iPropDefs )
   360 		{
   361 		{
   361 	    CMdEObjectDef& audioObjectDef = mdeObject.Def();
   362 	    CMdEObjectDef& audioObjectDef = mdeObject.Def();
   362 		iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( audioObjectDef );
   363 		iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( audioObjectDef );
   363 		}
   364 		}
   364     
   365  
       
   366     // Time offset
       
   367     TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset();
       
   368     TInt16 timeOffsetMinutes = timeOffsetSeconds.Int() / 60;
       
   369     CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iTimeOffsetPropertyDef, &timeOffsetMinutes, aIsAdd );
       
   370 	
   365     if ( song.Length() > 0
   371     if ( song.Length() > 0
   366         && song.Length() < iPropDefs->iTitlePropertyDef->MaxTextLengthL() )
   372         && song.Length() < iPropDefs->iTitlePropertyDef->MaxTextLengthL() )
   367         {    
   373         {    
   368         CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, 
   374         CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, 
   369         		*iPropDefs->iTitlePropertyDef, &song, EFalse );
   375         		*iPropDefs->iTitlePropertyDef, &song, EFalse );