harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp
changeset 21 50bf9db68373
parent 20 6dfc5f825351
child 23 33ae025ac1e8
--- a/harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp	Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp	Fri Apr 16 15:23:55 2010 +0300
@@ -58,6 +58,7 @@
 	iDrmPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDRMProperty );
 	iDescriptionPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDescriptionProperty );
 	iAuthorPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KAuthorProperty );
+	iGenrePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty );
 	}
 
 CHarvesterOmaDrmPluginPropertyDefs* CHarvesterOmaDrmPluginPropertyDefs::NewL(CMdEObjectDef& aObjectDef)
@@ -167,8 +168,8 @@
     aVHD.iFileSize = (TUint)entry->iSize;
     CleanupStack::PopAndDestroy( entry );
     
-    ContentAccess::CContent* content = NULL;
-    content = ContentAccess::CContent::NewLC( uri );
+    ContentAccess::CContent* content = ContentAccess::CContent::NewLC( uri );   
+    ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EPeek );
     
     ContentAccess::RStringAttributeSet attrSet;
     CleanupClosePushL( attrSet );
@@ -177,8 +178,9 @@
     attrSet.AddL( ContentAccess::EMimeType );
     attrSet.AddL( ContentAccess::ETitle );
     attrSet.AddL( ContentAccess::EAuthor );
-    
-    User::LeaveIfError( content->GetStringAttributeSet(attrSet) );
+    attrSet.AddL( ContentAccess::EGenre );
+
+    User::LeaveIfError( data->GetStringAttributeSet(attrSet) );
     
     TInt err = attrSet.GetValue( ContentAccess::EDescription, aVHD.iDescription );
     if ( err != KErrNone)
@@ -223,6 +225,17 @@
         {
         WRITELOG( "CHarvesterOMADRMPlugin::GatherDataL - no author" );
         }
+
+    err = attrSet.GetValue( ContentAccess::EGenre, aVHD.iGenre );
+    if ( err != KErrNone)
+        {
+        WRITELOG1( "CHarvesterOMADRMPlugin::GatherDataL - ERROR: getting genre failed %d", err );
+        }
+        
+    if ( aVHD.iGenre.Length() <= 0 )
+        {
+        WRITELOG( "CHarvesterOMADRMPlugin::GatherDataL - no genre" );
+        }
     
     err = content->GetAttribute( ContentAccess::EIsProtected, aVHD.iDrmProtected );
     if ( err != KErrNone)
@@ -230,7 +243,7 @@
         WRITELOG1( "CHarvesterOMADRMPlugin::GatherDataL - ERROR: getting protection info failed %d", err );
         }
         
-    CleanupStack::PopAndDestroy( 2, content );
+    CleanupStack::PopAndDestroy( 3 ); // content, data, attrSet
     }
 
 // ---------------------------------------------------------------------------
@@ -303,6 +316,12 @@
     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
     			*iPropDefs->iAuthorPropertyDef, &aVHD.iAuthor, aIsAdd );
     	}
+    // Genre
+    if(aVHD.iGenre.Length() > 0)
+        {
+        CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
+                *iPropDefs->iGenrePropertyDef, &aVHD.iGenre, aIsAdd );
+        }
     }
 
 // ---------------------------------------------------------------------------