21 #include <mdenamespacedef.h> |
21 #include <mdenamespacedef.h> |
22 #include <mdeobjectdef.h> |
22 #include <mdeobjectdef.h> |
23 #include <mdeobject.h> |
23 #include <mdeobject.h> |
24 #include <centralrepository.h> |
24 #include <centralrepository.h> |
25 |
25 |
|
26 #include "harvestercommon.h" |
26 #include "harvesteraudioplugin.h" |
27 #include "harvesteraudioplugin.h" |
27 #include "harvesteraudiopluginutils.h" |
28 #include "harvesteraudiopluginutils.h" |
28 #include "mdsutils.h" |
29 #include "mdsutils.h" |
29 |
30 |
30 #include "harvesterlog.h" |
31 #include "harvesterlog.h" |
127 CRepository* rep = CRepository::NewLC( KHarvesterRepoUid ); |
128 CRepository* rep = CRepository::NewLC( KHarvesterRepoUid ); |
128 rep->Get( KEnableAlbumArtHarvest, iHarvestAlbumArt ); |
129 rep->Get( KEnableAlbumArtHarvest, iHarvestAlbumArt ); |
129 CleanupStack::PopAndDestroy( rep ); |
130 CleanupStack::PopAndDestroy( rep ); |
130 |
131 |
131 iAudioParser = CAudioMDParser::NewL( iHarvestAlbumArt ); |
132 iAudioParser = CAudioMDParser::NewL( iHarvestAlbumArt ); |
132 iAudioParser->ResetL(); |
|
133 |
133 |
134 if( iHarvestAlbumArt ) |
134 if( iHarvestAlbumArt ) |
135 { |
135 { |
136 TRAP_IGNORE( iTNM = CThumbnailManager::NewL( *this ) ); |
136 TRAP_IGNORE( iTNM = CThumbnailManager::NewL( *this ) ); |
137 } |
137 } |
|
138 |
|
139 SetPriority( KHarvesterPriorityHarvestingPlugin - 1); |
138 } |
140 } |
139 |
141 |
140 // --------------------------------------------------------------------------- |
142 // --------------------------------------------------------------------------- |
141 // CHarvesterAudioPlugin::HarvestL (from CHarvesterPlugin) |
143 // CHarvesterAudioPlugin::HarvestL (from CHarvesterPlugin) |
142 // --------------------------------------------------------------------------- |
144 // --------------------------------------------------------------------------- |
166 { |
168 { |
167 // Pass through, nothing to do |
169 // Pass through, nothing to do |
168 } |
170 } |
169 |
171 |
170 // --------------------------------------------------------------------------- |
172 // --------------------------------------------------------------------------- |
171 // CHarvesterAudioPlugin::HarvestL (from CHarvesterPlugin) |
173 // CHarvesterAudioPlugin::ThumbnailReady |
172 // --------------------------------------------------------------------------- |
174 // --------------------------------------------------------------------------- |
173 // |
175 // |
174 void CHarvesterAudioPlugin::ThumbnailReady( TInt /*aError*/, |
176 void CHarvesterAudioPlugin::ThumbnailReady( TInt /*aError*/, |
175 MThumbnailData& /*aThumbnail*/, |
177 MThumbnailData& /*aThumbnail*/, |
176 TThumbnailRequestId /*aId*/ ) |
178 TThumbnailRequestId /*aId*/ ) |
177 { |
179 { |
178 // Pass through, nothing to do |
180 // Pass through, nothing to do |
|
181 } |
|
182 |
|
183 // --------------------------------------------------------------------------- |
|
184 // CHarvesterAudioPlugin::GetMimeType (from CHarvesterPlugin) |
|
185 // --------------------------------------------------------------------------- |
|
186 // |
|
187 void CHarvesterAudioPlugin::GetMimeType( const TDesC& aUri, TDes& aMimeType ) |
|
188 { |
|
189 aMimeType.Zero(); |
|
190 |
|
191 const TMimeTypeMapping<TAudioMetadataHandling>* mapping = |
|
192 iAudioParser->ParseMimeType( aUri ); |
|
193 |
|
194 if ( !mapping ) |
|
195 { |
|
196 return; |
|
197 } |
|
198 |
|
199 aMimeType = mapping->iMimeType; |
179 } |
200 } |
180 |
201 |
181 // --------------------------------------------------------------------------- |
202 // --------------------------------------------------------------------------- |
182 // CHarvesterAudioPlugin::DoHarvestL |
203 // CHarvesterAudioPlugin::DoHarvestL |
183 // --------------------------------------------------------------------------- |
204 // --------------------------------------------------------------------------- |
277 CMdEObject& mdeObject = aHD->MdeObject(); |
298 CMdEObject& mdeObject = aHD->MdeObject(); |
278 |
299 |
279 const TMimeTypeMapping<TAudioMetadataHandling>* mapping = |
300 const TMimeTypeMapping<TAudioMetadataHandling>* mapping = |
280 iAudioParser->ParseMimeType( mdeObject.Uri() ); |
301 iAudioParser->ParseMimeType( mdeObject.Uri() ); |
281 |
302 |
282 if ( mapping ) |
303 if ( mapping && !mdeObject.Placeholder() ) |
283 { |
304 { |
284 if( !iPropDefs ) |
305 if( !iPropDefs ) |
285 { |
306 { |
286 CMdEObjectDef& objectDef = mdeObject.Def(); |
307 CMdEObjectDef& objectDef = mdeObject.Def(); |
287 iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( objectDef ); |
308 iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( objectDef ); |
341 iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( audioObjectDef ); |
362 iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( audioObjectDef ); |
342 } |
363 } |
343 |
364 |
344 if ( song.Length() > 0 |
365 if ( song.Length() > 0 |
345 && song.Length() < iPropDefs->iTitlePropertyDef->MaxTextLengthL() ) |
366 && song.Length() < iPropDefs->iTitlePropertyDef->MaxTextLengthL() ) |
346 { |
367 { |
347 TRAPD( error, CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, |
368 CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, |
348 *iPropDefs->iTitlePropertyDef, &song, aIsAdd ) ); |
369 *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 } |
370 } |
358 |
371 |
359 if ( artist.Length() > 0 |
372 if ( artist.Length() > 0 |
360 && artist.Length() < iPropDefs->iArtistPropertyDef->MaxTextLengthL() ) |
373 && artist.Length() < iPropDefs->iArtistPropertyDef->MaxTextLengthL() ) |
361 { |
374 { |