mmappcomponents/harvester/metadataextractor/src/mpxmetadataextractor.cpp
branchRCL_3
changeset 59 666f9a5a90a9
parent 56 63223d4fd956
child 67 16db3449d7ba
equal deleted inserted replaced
56:63223d4fd956 59:666f9a5a90a9
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  Extracts metadata from a file
    14 * Description:  Extracts metadata from a file
    15 *  Version     : %version: da1mmcf#38.1.4.2.6.1.15 % << Don't touch! Updated by Synergy at check-out.
    15 *  Version     : %version: da1mmcf#38.1.4.2.6.1.17 % << Don't touch! Updated by Synergy at check-out.
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 #include <e32base.h>
    19 #include <e32base.h>
    20 #include <badesca.h>
    20 #include <badesca.h>
   252     aMediaProp.SetTextValueL( KMPXMediaMusicAlbumArtFileName,
   252     aMediaProp.SetTextValueL( KMPXMediaMusicAlbumArtFileName,
   253                               KNullDesC );
   253                               KNullDesC );
   254     // URL
   254     // URL
   255     aMediaProp.SetTextValueL( KMPXMediaMusicURL,
   255     aMediaProp.SetTextValueL( KMPXMediaMusicURL,
   256                               KNullDesC );
   256                               KNullDesC );
       
   257     // AlbumArtist
       
   258     aMediaProp.SetTextValueL( KMPXMediaMusicAlbumArtist,
       
   259                               KNullDesC );
       
   260     
   257     }
   261     }
   258 
   262 
   259 // ---------------------------------------------------------------------------
   263 // ---------------------------------------------------------------------------
   260 // Sets media object attributes from metadata utilities
   264 // Sets media object attributes from metadata utilities
   261 // ---------------------------------------------------------------------------
   265 // ---------------------------------------------------------------------------
   474                 
   478                 
   475                     MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL- duration = %i", bitRate);  
   479                     MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL- duration = %i", bitRate);  
   476                     }
   480                     }
   477                 break;
   481                 break;
   478                 }
   482                 }
       
   483             case EMetaDataAlbumArtist:
       
   484                 {
       
   485                 TPtr valptr = value->Des();
       
   486                 valptr.Trim();
       
   487                 TInt vallen = value->Length();
       
   488                 if (vallen>0)
       
   489                     {
       
   490                     FindAndReplaceForbiddenChars(valptr, vallen);
       
   491                     iMedia->SetTextValueL(KMPXMediaMusicAlbumArtist, *value);
       
   492                     }
       
   493                 break;
       
   494                 }
   479             case EMetaDataOriginalArtist:  // fall through
   495             case EMetaDataOriginalArtist:  // fall through
   480             case EMetaDataVendor:          // fall through
   496             case EMetaDataVendor:          // fall through
   481             case EMetaDataRating:          // fall through
   497             case EMetaDataRating:          // fall through
   482             case EMetaDataUniqueFileIdentifier:  // fall through
   498             case EMetaDataUniqueFileIdentifier:  // fall through
   483             case EMetaDataDate:            // fall through
   499             case EMetaDataDate:            // fall through
   924         }
   940         }
   925     else // other case use apparc to fetch and set mimetype
   941     else // other case use apparc to fetch and set mimetype
   926         {
   942         {
   927         TDataType dataType;
   943         TDataType dataType;
   928         TUid dummyUid(KNullUid);
   944         TUid dummyUid(KNullUid);
   929         iAppArc.AppForDocument(iFileName, dummyUid, dataType);
   945         // File handle based mime type recogniton required , because AppArc does 
       
   946         // not have All Files capa required for files in private folders 
       
   947         TDataRecognitionResult result;
       
   948         RFs fs;
       
   949 		RFile rFile;
       
   950         User::LeaveIfError(fs.Connect());
       
   951 		CleanupClosePushL(fs);
       
   952         User::LeaveIfError(fs.ShareProtected());
       
   953         User::LeaveIfError(rFile.Open(fs, iFileName, EFileShareReadersOrWriters));
       
   954 		CleanupClosePushL(rFile);
       
   955         User::LeaveIfError(iAppArc.RecognizeData(rFile, result)); 
       
   956         CleanupStack::PopAndDestroy(&rFile);
       
   957         CleanupStack::PopAndDestroy(&fs);
       
   958         dataType = result.iDataType;
   930         iMedia->SetTextValueL( KMPXMediaGeneralMimeType,dataType.Des() );
   959         iMedia->SetTextValueL( KMPXMediaGeneralMimeType,dataType.Des() );
   931         }
   960         }
   932         
   961         
   933     // Initially set default tags.
   962     // Initially set default tags.
   934     SetDefaultL( *iMedia );
   963     SetDefaultL( *iMedia );