harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp
branchRCL_3
changeset 9 82c0024438c8
parent 8 50de4d668bb6
child 10 ab88d4a85041
--- a/harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp	Wed Mar 31 22:19:07 2010 +0300
+++ b/harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp	Wed Apr 14 16:24:03 2010 +0300
@@ -161,6 +161,7 @@
 	{
 	delete iPropDefs;
 	iMimeTypeMappings.Close();
+    RMediaIdUtil::ReleaseInstance();
 
 	WRITELOG("CHarvesterVideoPlugin::CHarvesterVideoPlugin()");
 	}
@@ -268,6 +269,7 @@
                     KMimeTypeWmv(), KMimeTypeWmv() ) ), 
             cmp ) );
     
+    iMediaIdUtil = &RMediaIdUtil::GetInstanceL();
     }
 
 
@@ -948,6 +950,8 @@
     	{
     	CMdEObjectDef& objectDef = mdeObject.Def();
     	iPropDefs = CHarvesterVideoPluginPropertyDefs::NewL( objectDef );
+    	// Prefetch max text lengt for validity checking
+    	iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL();
     	}
 
     TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset();
@@ -1045,33 +1049,33 @@
     	        }
     		}
     	}
-
+    
     // Copyright
-    if( aVHD.iCopyright )
+    if( aVHD.iCopyright && aVHD.iCopyright->Length() < iMaxTextLength )
     	{
     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCopyrightPropertyDef, aVHD.iCopyright, aIsAdd );
     	}
 
     // Author
-    if( aVHD.iAuthor )
+    if( aVHD.iAuthor && aVHD.iAuthor->Length() < iMaxTextLength )
     	{
     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iAuthorPropertyDef, aVHD.iAuthor, aIsAdd );
     	}
 
     // Genre
-    if( aVHD.iGenre )
+    if( aVHD.iGenre && aVHD.iGenre->Length() < iMaxTextLength )
     	{
     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iGenrePropertyDef, aVHD.iGenre, aIsAdd );
     	}
 
     // Artist
-    if( aVHD.iPerformer )
+    if( aVHD.iPerformer && aVHD.iPerformer->Length() < iMaxTextLength )
     	{
     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iArtistPropertyDef, aVHD.iPerformer, aIsAdd );
     	}
 
     // Description
-    if( aVHD.iDescription )
+    if( aVHD.iDescription && aVHD.iDescription->Length() < iMaxTextLength )
     	{
     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDescriptionPropertyDef, aVHD.iDescription, aIsAdd );
     	}
@@ -1083,7 +1087,7 @@
         }
     
     // Title
-    if( aVHD.iTitle )
+    if( aVHD.iTitle && aVHD.iTitle->Length() < iMaxTextLength )
         {
         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iTitlePropertyDef, aVHD.iTitle, EFalse );
         }
@@ -1143,6 +1147,29 @@
 	CHXMetaDataUtility* helixMetadata = CHXMetaDataUtility::NewL();
 	CleanupStack::PushL( helixMetadata );
 
+	TFileName tempName;
+	TUint32 mediaId( 0 );
+	TInt blackListError( KErrNone );
+	
+    if( iBlacklist )
+        {
+        WRITELOG( "CHarvesterVideoPlugin::GetRmTypeL - Adding URI to blacklist" );
+        blackListError = aFile.FullName( tempName );
+        if( blackListError == KErrNone )
+            {
+            blackListError = iMediaIdUtil->GetMediaId( tempName, mediaId );
+            if( blackListError == KErrNone )
+                {
+                TTime modified ( 0 );
+                blackListError = iFs.Modified( tempName, modified );
+                if( blackListError == KErrNone )
+                    {
+                    iBlacklist->AddFile( tempName, mediaId, modified );
+                    }
+                }
+            }
+        }
+	
 	TRAPD( err, helixMetadata->OpenFileL( aFile ) );
 
 	if( err == KErrNone )
@@ -1226,6 +1253,12 @@
 		{
 		aType.Copy( KVideo );
 		}
+	
+    if ( iBlacklist && blackListError == KErrNone )
+        {
+        WRITELOG( "CHarvesterVideoPlugin::GetRmTypeL - Removing URI from blacklist" );
+        iBlacklist->RemoveFile( tempName, mediaId );
+        }
     
 	helixMetadata->ResetL();
     CleanupStack::PopAndDestroy( helixMetadata );