harvesterplugins/media/audio/src/cpixmediaaudiodoc.cpp
changeset 17 7d8c8d8f5eab
parent 11 773be20e0a25
child 20 68cdadcf169e
equal deleted inserted replaced
12:993ab30e92fc 17:7d8c8d8f5eab
   110                              MdeConstants::MediaObject::KArtistProperty,
   110                              MdeConstants::MediaObject::KArtistProperty,
   111                              textProperty->Value(),
   111                              textProperty->Value(),
   112                              CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText);
   112                              CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText);
   113        AddToFieldExcerptL(textProperty->Value());//Add artist to excerpt
   113        AddToFieldExcerptL(textProperty->Value());//Add artist to excerpt
   114        }
   114        }
       
   115 #ifdef USE_HIGHLIGHTER
       
   116     //Get the media file extension and store
       
   117     TBuf<KMaxExtLength> extension;        
       
   118     GetExtension(aObject.Uri(),extension);
       
   119     AddToFieldExcerptL(extension);
       
   120 #endif  
   115     CMdEPropertyDef& albumPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KAlbumProperty );
   121     CMdEPropertyDef& albumPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KAlbumProperty );
   116     if(aObject.Property( albumPropDef, property )!= KErrNotFound)
   122     if(aObject.Property( albumPropDef, property )!= KErrNotFound)
   117        {
   123        {
   118        //Add field to document
   124        //Add field to document
   119        CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property);
   125        CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property);
   219     
   225     
   220     //Size property
   226     //Size property
   221     CMdEPropertyDef& sizePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KSizeProperty);
   227     CMdEPropertyDef& sizePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KSizeProperty);
   222     if(aObject.Property( sizePropDef, property )!= KErrNotFound)
   228     if(aObject.Property( sizePropDef, property )!= KErrNotFound)
   223        {
   229        {
   224        //Add field to document
   230        //Add field to document       
   225        if( property->Def().PropertyType() == EPropertyUint32 )
   231        CMdEUint32Property& sizeProperty = static_cast < CMdEUint32Property& > (*property );
   226            {
   232        TBuf<32> buf;
   227            CMdEUint32Property& sizeProperty = static_cast < CMdEUint32Property& > (*property );
   233        buf.Format(_L("%u"), sizeProperty.Value());
   228            TBuf<32> buf;
   234        AddFiledtoDocumentL(*index_item,
   229            buf.Format(_L("%u"), sizeProperty.Value());
   235                        MdeConstants::Object::KSizeProperty,
   230            AddFiledtoDocumentL(*index_item,
   236                        buf,
   231                            MdeConstants::Object::KSizeProperty,
   237                        CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   232                            buf,
   238        AddToFieldExcerptL(buf);       
   233                            CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
       
   234            AddToFieldExcerptL(buf);
       
   235            }
       
   236        }
   239        }
   237     
   240     
   238     //Get legal property
   241     //Get legal property
   239     CMdEPropertyDef& legalPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KLegalProperty );
   242     CMdEPropertyDef& legalPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KLegalProperty );
   240     if(aObject.Property( legalPropDef, property ) != KErrNotFound)
   243     if(aObject.Property( legalPropDef, property ) != KErrNotFound)
   249     //Get track property
   252     //Get track property
   250     CMdEPropertyDef& trackPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KTrackProperty );
   253     CMdEPropertyDef& trackPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KTrackProperty );
   251     if(aObject.Property( trackPropDef, property ) != KErrNotFound)
   254     if(aObject.Property( trackPropDef, property ) != KErrNotFound)
   252        {
   255        {
   253        //Add field to document       
   256        //Add field to document       
   254        if( property->Def().PropertyType() == EPropertyUint16 )
   257        CMdEUint16Property& trackProperty = static_cast < CMdEUint16Property& > (*property );               
   255            {
   258        TBuf<32> buf;
   256            CMdEUint16Property& trackProperty = static_cast < CMdEUint16Property& > (*property );               
   259        buf.Format(_L("%d"), trackProperty.Value());
   257            TBuf<32> buf;
   260        AddFiledtoDocumentL(*index_item,
   258            buf.Format(_L("%d"), trackProperty.Value());
   261                           MdeConstants::MediaObject::KTrackProperty,
   259            AddFiledtoDocumentL(*index_item,
   262                           buf);
   260                               MdeConstants::MediaObject::KTrackProperty,
   263        
   261                               buf);
       
   262            }       
       
   263        }
   264        }
   264     // Capturedate property
   265     // Capturedate property
   265     CMdEPropertyDef& captureDatePropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCaptureDateProperty);
   266     CMdEPropertyDef& captureDatePropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCaptureDateProperty);
   266     if(aObject.Property( captureDatePropDef, property ) != KErrNotFound)
   267     if(aObject.Property( captureDatePropDef, property ) != KErrNotFound)
   267       {
   268       {
   268       //Add field to document
   269       //Add field to document      
   269       if(EPropertyTime == property->Def().PropertyType())
   270       CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
   270           {
   271       TDateTime time = timeProperty.Value().DateTime();
   271           CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
   272       TBuf<32> buf;
   272           TDateTime time = timeProperty.Value().DateTime();
   273       buf.Format( KFormatDateTime, time.Year(), 
   273           TBuf<32> buf;
   274                                    time.Month() + 1, 
   274           buf.Format( KFormatDateTime, time.Year(), 
   275                                    time.Day() + 1, 
   275                                        time.Month() + 1, 
   276                                    time.Hour(), 
   276                                        time.Day() + 1, 
   277                                    time.Minute());
   277                                        time.Hour(), 
   278       
   278                                        time.Minute());
   279       AddFiledtoDocumentL(*index_item,
   279           
   280                          MdeConstants::MediaObject::KCaptureDateProperty,
   280           AddFiledtoDocumentL(*index_item,
   281                          buf,
   281                              MdeConstants::MediaObject::KCaptureDateProperty,
   282                          CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   282                              buf,
   283       
   283                              CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   284       //Format for excerpt field
   284           
   285       buf.Format( KExcerptFormat, time.Year(), 
   285           //Format for excerpt field
   286                                  time.Month() + 1, 
   286           buf.Format( KExcerptFormat, time.Year(), 
   287                                  time.Day() + 1, 
   287                                      time.Month() + 1, 
   288                                  time.Hour(), 
   288                                      time.Day() + 1, 
   289                                  time.Minute());
   289                                      time.Hour(), 
   290       AddToFieldExcerptL(buf);         
   290                                      time.Minute());
       
   291           AddToFieldExcerptL(buf);
       
   292           }
       
   293       }
   291       }
   294     //Get LastModifiedDate property
   292     //Get LastModifiedDate property
   295     CMdEPropertyDef& dateTimePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KLastModifiedDateProperty);
   293     CMdEPropertyDef& dateTimePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KLastModifiedDateProperty);
   296     if(aObject.Property( dateTimePropDef, property ) != KErrNotFound)
   294     if(aObject.Property( dateTimePropDef, property ) != KErrNotFound)
   297       {
   295       {
   298       //Add field to document
   296       //Add field to document      
   299       if(EPropertyTime == property->Def().PropertyType())
   297       CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
   300           {
   298       TDateTime time = timeProperty.Value().DateTime();
   301           CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
   299       TBuf<32> buf;
   302           TDateTime time = timeProperty.Value().DateTime();
   300       buf.Format( KFormatDateTime, time.Year(),
   303           TBuf<32> buf;
   301                                    time.Month() + 1,
   304           buf.Format( KFormatDateTime, time.Year(),
   302                                    time.Day() + 1,
   305                                        time.Month() + 1,
   303                                    time.Hour(),
   306                                        time.Day() + 1,
       
   307                                        time.Hour(),
       
   308                                        time.Minute());
       
   309           
       
   310           AddFiledtoDocumentL(*index_item,
       
   311                              MdeConstants::Object::KLastModifiedDateProperty,
       
   312                              buf,
       
   313                              CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
       
   314           //Format for excerpt field
       
   315           buf.Format( KExcerptFormat, time.Year(), 
       
   316                                    time.Month() + 1, 
       
   317                                    time.Day() + 1, 
       
   318                                    time.Hour(), 
       
   319                                    time.Minute());
   304                                    time.Minute());
   320           AddToFieldExcerptL(buf);
   305       
   321           }
   306       AddFiledtoDocumentL(*index_item,
       
   307                          MdeConstants::Object::KLastModifiedDateProperty,
       
   308                          buf,
       
   309                          CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
       
   310       //Format for excerpt field
       
   311       buf.Format( KExcerptFormat, time.Year(), 
       
   312                                time.Month() + 1, 
       
   313                                time.Day() + 1, 
       
   314                                time.Hour(), 
       
   315                                time.Minute());
       
   316       AddToFieldExcerptL(buf);
   322       }
   317       }
   323     //Get duration property
   318     //Get duration property
   324     CMdEPropertyDef& durationPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KDurationProperty );
   319     CMdEPropertyDef& durationPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KDurationProperty );
   325     if(aObject.Property( durationPropDef, property ) != KErrNotFound)
   320     if(aObject.Property( durationPropDef, property ) != KErrNotFound)
   326        {        
   321        {        
   327        //Add field to document
   322        //Add field to document       
   328        if( property->Def().PropertyType() == EPropertyReal32 )
   323        CMdEReal32Property& durationProperty = static_cast < CMdEReal32Property& > (*property );               
   329            {
   324        TBuf<32> buf;
   330            CMdEReal32Property& durationProperty = static_cast < CMdEReal32Property& > (*property );               
   325        buf.Format(_L("%f"), durationProperty.Value());
   331            TBuf<32> buf;
   326        AddFiledtoDocumentL(*index_item,
   332            buf.Format(_L("%f"), durationProperty.Value());
   327                       MdeConstants::MediaObject::KDurationProperty,
   333            AddFiledtoDocumentL(*index_item,
   328                       buf );
   334                           MdeConstants::MediaObject::KDurationProperty,
   329        
   335                           buf );
   330        }
   336            }       
   331     
   337        }
   332     index_item->AddExcerptL(*iExcerpt);
   338     if( iExcerpt )
   333 
   339         {
       
   340         index_item->AddExcerptL(*iExcerpt);
       
   341         }
       
   342     CPIXLOGSTRING("END CCPIXMediaAudioDoc::GetCpixDocumentL");
   334     CPIXLOGSTRING("END CCPIXMediaAudioDoc::GetCpixDocumentL");
   343     OstTraceFunctionExit0( CCPIXMEDIAAUDIODOC_GETCPIXDOCUMENTL_EXIT );
   335     OstTraceFunctionExit0( CCPIXMEDIAAUDIODOC_GETCPIXDOCUMENTL_EXIT );
   344     return index_item;
   336     return index_item;
   345     }
   337     }
   346 //End of life
   338 //End of life