harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp
changeset 20 6dfc5f825351
parent 3 b73a2e62868f
child 21 50bf9db68373
equal deleted inserted replaced
3:b73a2e62868f 20:6dfc5f825351
   127     CRepository* rep = CRepository::NewLC( KHarvesterRepoUid );
   127     CRepository* rep = CRepository::NewLC( KHarvesterRepoUid );
   128     rep->Get( KEnableAlbumArtHarvest, iHarvestAlbumArt );
   128     rep->Get( KEnableAlbumArtHarvest, iHarvestAlbumArt );
   129     CleanupStack::PopAndDestroy( rep );   
   129     CleanupStack::PopAndDestroy( rep );   
   130 	
   130 	
   131 	iAudioParser = CAudioMDParser::NewL( iHarvestAlbumArt );
   131 	iAudioParser = CAudioMDParser::NewL( iHarvestAlbumArt );
   132     iAudioParser->ResetL();
       
   133     
   132     
   134     if( iHarvestAlbumArt )
   133     if( iHarvestAlbumArt )
   135         {
   134         {
   136         TRAP_IGNORE( iTNM = CThumbnailManager::NewL( *this ) );
   135         TRAP_IGNORE( iTNM = CThumbnailManager::NewL( *this ) );
   137         }
   136         }
   166     {
   165     {
   167     // Pass through, nothing to do
   166     // Pass through, nothing to do
   168     }
   167     }
   169 
   168 
   170 // ---------------------------------------------------------------------------
   169 // ---------------------------------------------------------------------------
   171 // CHarvesterAudioPlugin::HarvestL (from CHarvesterPlugin)
   170 // CHarvesterAudioPlugin::ThumbnailReady
   172 // ---------------------------------------------------------------------------
   171 // ---------------------------------------------------------------------------
   173 //    
   172 //    
   174 void CHarvesterAudioPlugin::ThumbnailReady( TInt /*aError*/, 
   173 void CHarvesterAudioPlugin::ThumbnailReady( TInt /*aError*/, 
   175     MThumbnailData& /*aThumbnail*/,
   174     MThumbnailData& /*aThumbnail*/,
   176     TThumbnailRequestId /*aId*/ )
   175     TThumbnailRequestId /*aId*/ )
   177     {
   176     {
   178     // Pass through, nothing to do
   177     // Pass through, nothing to do
       
   178     }
       
   179 
       
   180 // ---------------------------------------------------------------------------
       
   181 // CHarvesterAudioPlugin::GetMimeType (from CHarvesterPlugin)
       
   182 // ---------------------------------------------------------------------------
       
   183 //    
       
   184 void CHarvesterAudioPlugin::GetMimeType( const TDesC& aUri, TDes& aMimeType )
       
   185     {
       
   186     aMimeType.Zero();
       
   187     
       
   188     const TMimeTypeMapping<TAudioMetadataHandling>* mapping = 
       
   189         iAudioParser->ParseMimeType( aUri );
       
   190 
       
   191     if ( !mapping )
       
   192         {
       
   193         return;
       
   194         }
       
   195     
       
   196     aMimeType = mapping->iMimeType;
   179     }
   197     }
   180 
   198 
   181 // ---------------------------------------------------------------------------
   199 // ---------------------------------------------------------------------------
   182 // CHarvesterAudioPlugin::DoHarvestL
   200 // CHarvesterAudioPlugin::DoHarvestL
   183 // ---------------------------------------------------------------------------
   201 // ---------------------------------------------------------------------------
   277     CMdEObject& mdeObject = aHD->MdeObject();
   295     CMdEObject& mdeObject = aHD->MdeObject();
   278  
   296  
   279     const TMimeTypeMapping<TAudioMetadataHandling>* mapping = 
   297     const TMimeTypeMapping<TAudioMetadataHandling>* mapping = 
   280     	iAudioParser->ParseMimeType( mdeObject.Uri() );
   298     	iAudioParser->ParseMimeType( mdeObject.Uri() );
   281     
   299     
   282     if ( mapping )
   300     if ( mapping && !mdeObject.Placeholder() )
   283         {
   301         {
   284     	if( !iPropDefs )
   302     	if( !iPropDefs )
   285     		{
   303     		{
   286     		CMdEObjectDef& objectDef = mdeObject.Def();
   304     		CMdEObjectDef& objectDef = mdeObject.Def();
   287     		iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( objectDef );
   305     		iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( objectDef );
   341 		iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( audioObjectDef );
   359 		iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( audioObjectDef );
   342 		}
   360 		}
   343     
   361     
   344     if ( song.Length() > 0
   362     if ( song.Length() > 0
   345         && song.Length() < iPropDefs->iTitlePropertyDef->MaxTextLengthL() )
   363         && song.Length() < iPropDefs->iTitlePropertyDef->MaxTextLengthL() )
   346         {
   364         {    
   347         TRAPD( error, CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, 
   365         CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, 
   348         		*iPropDefs->iTitlePropertyDef, &song, aIsAdd ) );
   366         		*iPropDefs->iTitlePropertyDef, &song, EFalse );
   349         if( error != KErrNone )
       
   350             {
       
   351             CMdEProperty* prop = NULL;
       
   352             const TInt index = mdeObject.Property( *iPropDefs->iTitlePropertyDef, prop );
       
   353             mdeObject.RemoveProperty( index );
       
   354             CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, 
       
   355             		*iPropDefs->iTitlePropertyDef, &song, aIsAdd );
       
   356             }
       
   357         }
   367         }
   358 
   368 
   359     if ( artist.Length() > 0
   369     if ( artist.Length() > 0
   360         && artist.Length() < iPropDefs->iArtistPropertyDef->MaxTextLengthL() )
   370         && artist.Length() < iPropDefs->iArtistPropertyDef->MaxTextLengthL() )
   361         {
   371         {