harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp
changeset 41 2290317b9ec5
parent 23 33ae025ac1e8
equal deleted inserted replaced
23:33ae025ac1e8 41:2290317b9ec5
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include <e32std.h>
    18 #include <e32std.h>
    19 #include <caf/caf.h>
    19 #include <caf/caf.h>
       
    20 #include <pathinfo.h>
    20 
    21 
    21 #include "mdsutils.h"
    22 #include "mdsutils.h"
    22 #include "harvesterdata.h"
    23 #include "harvesterdata.h"
    23 #include "harvesterlog.h"
    24 #include "harvesterlog.h"
    24 #include "harvestercommon.h"
    25 #include "harvestercommon.h"
    25 #include "harvesterwmvplugin.h"
    26 #include "harvesterwmvplugin.h"
       
    27 #include "mdscommoninternal.h"
    26 #include <mdenamespacedef.h>
    28 #include <mdenamespacedef.h>
    27 #include <mdeobjectdef.h>
    29 #include <mdeobjectdef.h>
    28 #include "mdeobject.h"
    30 #include "mdeobject.h"
    29 #include "mdetextproperty.h"
    31 #include "mdetextproperty.h"
    30 #include "mdeobjectwrapper.h"
    32 #include "mdeobjectwrapper.h"
    42 	iCreationDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KCreationDateProperty );
    44 	iCreationDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KCreationDateProperty );
    43 	iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty );
    45 	iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty );
    44 	iSizePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty );
    46 	iSizePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty );
    45 	iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty );
    47 	iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty );
    46     iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty );
    48     iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty );
       
    49     iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KInDefaultFolder );
    47 	
    50 	
    48     CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject );
    51     CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject );
    49     iDrmPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDRMProperty );
    52     iDrmPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDRMProperty );
    50     iDescriptionPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDescriptionProperty );
    53     iDescriptionPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDescriptionProperty );
    51     iAuthorPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KAuthorProperty );
    54     iAuthorPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KAuthorProperty );
    84 //
    87 //
    85 CHarvesterWMVPlugin::~CHarvesterWMVPlugin()
    88 CHarvesterWMVPlugin::~CHarvesterWMVPlugin()
    86     {
    89     {
    87     WRITELOG( "CHarvesterWMVPlugin::~CHarvesterWMVPlugin()" );
    90     WRITELOG( "CHarvesterWMVPlugin::~CHarvesterWMVPlugin()" );
    88     delete iPropDefs;
    91     delete iPropDefs;
       
    92     
       
    93     delete iPhoneVideosPath;
       
    94     delete iMmcVideosPath;
    89     }
    95     }
    90 
    96 
    91 // ---------------------------------------------------------------------------
    97 // ---------------------------------------------------------------------------
    92 // Harvest file
    98 // Harvest file
    93 // ---------------------------------------------------------------------------
    99 // ---------------------------------------------------------------------------
   161 // ---------------------------------------------------------------------------
   167 // ---------------------------------------------------------------------------
   162 //
   168 //
   163 void CHarvesterWMVPlugin::ConstructL()
   169 void CHarvesterWMVPlugin::ConstructL()
   164     {
   170     {
   165     WRITELOG( "CHarvesterWMVPlugin::ConstructL()" );
   171     WRITELOG( "CHarvesterWMVPlugin::ConstructL()" );
       
   172     
       
   173     TFileName videos = PathInfo::VideosPath();
       
   174     
       
   175     TFileName phonePath = PathInfo::PhoneMemoryRootPath();
       
   176     phonePath.Append( videos );
       
   177     iPhoneVideosPath = phonePath.AllocL();
       
   178 
       
   179     TFileName mmcPath = PathInfo::MemoryCardRootPath();
       
   180     mmcPath.Append( videos );
       
   181     iMmcVideosPath = mmcPath.Right( mmcPath.Length() - 1 ).AllocL();
       
   182    
   166     SetPriority( KHarvesterPriorityHarvestingPlugin - 1 );
   183     SetPriority( KHarvesterPriorityHarvestingPlugin - 1 );
   167     }
   184     }
   168 
   185 
   169 // ---------------------------------------------------------------------------
   186 // ---------------------------------------------------------------------------
   170 // GatherDataL
   187 // GatherDataL
   299     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
   316     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
   300     			*iPropDefs->iSizePropertyDef, &aClipDetails.iFileSize, aIsAdd );
   317     			*iPropDefs->iSizePropertyDef, &aClipDetails.iFileSize, aIsAdd );
   301         // Mime Type
   318         // Mime Type
   302         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
   319         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
   303                 *iPropDefs->iItemTypePropertyDef, &aClipDetails.iMimeType, aIsAdd );
   320                 *iPropDefs->iItemTypePropertyDef, &aClipDetails.iMimeType, aIsAdd );
       
   321 
       
   322         const TDesC& uri = mdeObject.Uri();
       
   323         if( uri.FindF( iMmcVideosPath->Des()) != KErrNotFound ||
       
   324             uri.FindF( iPhoneVideosPath->Des()) != KErrNotFound ||
       
   325             uri.FindF( KDCIMFolder ) != KErrNotFound )
       
   326             {
       
   327             TBool inDefaultFolder( ETrue );
       
   328             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd );
       
   329             }
       
   330         else
       
   331             {
       
   332             TBool inDefaultFolder( EFalse );
       
   333             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd );    
       
   334             }
   304     	}
   335     	}
   305     
   336     
   306     // DRM protection
   337     // DRM protection
   307     if( aClipDetails.iDrmProtected )
   338     if( aClipDetails.iDrmProtected )
   308         {
   339         {
   309         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
   340         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
   310                 *iPropDefs->iDrmPropertyDef, &aClipDetails.iDrmProtected, aIsAdd );
   341                 *iPropDefs->iDrmPropertyDef, &aClipDetails.iDrmProtected, aIsAdd );
   311         } 
   342         } 
   312     // Title (is set from URI by default)
   343     // Title (is set from URI by default)
   313     if( aClipDetails.iTitle.Length() > 0 && aClipDetails.iTitle.Length() < iMaxTextLength )
   344     if( aClipDetails.iTitle.Length() > 0 && aClipDetails.iTitle.Length() < KMaxTitleFieldLength )
   314         {
   345         {
   315         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
   346         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
   316                 *iPropDefs->iTitlePropertyDef, &aClipDetails.iTitle, EFalse );
   347                 *iPropDefs->iTitlePropertyDef, &aClipDetails.iTitle, EFalse );
   317         }
   348         }
   318     // Description
   349     // Description