harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp
branchRCL_3
changeset 17 50de4d668bb6
parent 15 3cebc1a84278
child 19 82c0024438c8
--- a/harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -59,6 +59,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)
@@ -169,8 +170,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 );
@@ -179,8 +180,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)
@@ -225,6 +227,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)
@@ -232,7 +245,7 @@
         WRITELOG1( "CHarvesterOMADRMPlugin::GatherDataL - ERROR: getting protection info failed %d", err );
         }
         
-    CleanupStack::PopAndDestroy( 2, content );
+    CleanupStack::PopAndDestroy( 3 ); // content, data, attrSet
     }
 
 // ---------------------------------------------------------------------------
@@ -305,6 +318,12 @@
     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
     			*iPropDefs->iAuthorPropertyDef, &aVHD.iAuthor, aIsAdd );
     	}
+    // Genre
+    if(aVHD.iGenre.Length() > 0)
+        {
+        CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
+                *iPropDefs->iGenrePropertyDef, &aVHD.iGenre, aIsAdd );
+        }
     }
 
 // ---------------------------------------------------------------------------