Index: /main/trunk/greenstone2/perllib/plugins/EmbeddedMetadataPlugin.pm
===================================================================
--- /main/trunk/greenstone2/perllib/plugins/EmbeddedMetadataPlugin.pm	(revision 24486)
+++ /main/trunk/greenstone2/perllib/plugins/EmbeddedMetadataPlugin.pm	(revision 24487)
@@ -75,4 +75,13 @@
 	'list' => [{'name' => "true", 'desc' => "{common.true}"}, {'name' => "false", 'desc' => "{common.false}"}],
 	'deft' => "true"
+	},{
+	'name' => "set_filter_list",
+	'desc' => "{EmbeddedMetadataPlugin.set_filter_list}",
+	'type' => "string"
+	},{
+	'name' => "set_filter_regexp",
+	'desc' => "{EmbeddedMetadataPlugin.set_filter_regexp}",
+	'type' => "string",
+	'deft' => ".*" #If changing this default, also need to update the constructor
 	}];
 
@@ -102,4 +111,27 @@
     $exifTool->Options('Verbose');
     $self->{'exiftool'} = $exifTool;
+	
+	my $setFilterList = $self->{'set_filter_list'};
+	my $setFilterRegexp = $self->{'set_filter_regexp'};
+	if ((defined $setFilterList) && ($setFilterList ne ""))
+	{
+		if ((defined $setFilterRegexp) && ($setFilterRegexp ne ".*") && ($setFilterRegexp ne ""))
+		{
+			my $outhandle = $self->{'outhandle'};
+			print $outhandle "Warning: can only specify 'set_filter_list' or 'set_filter_regexp'\n";
+			print $outhandle "         defaulting to 'set_filter_list'\n";
+		}
+
+		my @sets = split(/,/,$setFilterList);
+		my @sets_bracketed;
+		foreach my $s (@sets)
+		{
+			$s =~ s/^(ex\.)?(.*)$/(ex.$2)/;
+			push (@sets_bracketed, $s);
+		}
+
+		my $setFilterRegexp = join("|",@sets_bracketed);
+		$self->{'set_filter_regexp'} = $setFilterRegexp;
+	}
 
     return bless $self, $class;
@@ -145,4 +177,19 @@
 }
 
+sub checkAgainstFilters
+{
+	my $self = shift(@_);
+	my $name = shift(@_);
+	
+	my $setFilterRegexp = $self->{'set_filter_regexp'};
+	if((defined $setFilterRegexp) && ($setFilterRegexp ne ""))
+	{
+		return ($name =~ m/($setFilterRegexp)/i);
+	}
+	else
+	{
+		return 1;
+	}
+}
 
 sub extractEmbeddedMetadata()
@@ -215,5 +262,5 @@
 								foreach my $val (@vs) {
 									if ($val =~ /\S/) {
-										push (@{$exif_metadata{$field}}, $self->gsSafe($val));
+										push (@{$exif_metadata{$field}}, $self->gsSafe($val)) if $self->checkAgainstFilters($field);
 										++$metadata_count;
 									}
@@ -222,5 +269,5 @@
 							else
 							{
-								push (@{$exif_metadata{$field}}, $self->gsSafe($v));
+								push (@{$exif_metadata{$field}}, $self->gsSafe($v)) if $self->checkAgainstFilters($field);
 								++$metadata_count;
 							}
@@ -239,5 +286,5 @@
 							foreach my $val (@vs) {
 								if ($val =~ /\S/) {
-									push (@{$exif_metadata{$field}}, $self->gsSafe($val));
+									push (@{$exif_metadata{$field}}, $self->gsSafe($val)) if $self->checkAgainstFilters($field);
 									++$metadata_count;
 								}
@@ -246,5 +293,5 @@
 						else
 						{
-							push (@{$exif_metadata{$field}}, $self->gsSafe($allvals));
+							push (@{$exif_metadata{$field}}, $self->gsSafe($allvals)) if $self->checkAgainstFilters($field);
 							++$metadata_count;
 						}
@@ -258,5 +305,5 @@
 						foreach my $v (@vs) {
 							if ($v =~ /\S/) {
-								push (@{$exif_metadata{$field}}, $self->gsSafe($v));
+								push (@{$exif_metadata{$field}}, $self->gsSafe($v)) if $self->checkAgainstFilters($field);
 								++$metadata_count; 
 							}
@@ -265,5 +312,5 @@
 				}
 				if (!$metadata_done) {
-					push (@{$exif_metadata{$field}}, $self->gsSafe($value));
+					push (@{$exif_metadata{$field}}, $self->gsSafe($value)) if $self->checkAgainstFilters($field);
 					++$metadata_count;
 				}
Index: /main/trunk/greenstone2/perllib/strings.properties
===================================================================
--- /main/trunk/greenstone2/perllib/strings.properties	(revision 24486)
+++ /main/trunk/greenstone2/perllib/strings.properties	(revision 24487)
@@ -866,4 +866,6 @@
 EmbeddedMetadataPlugin.join_character:The character to use with join_before_split (default is a single space).
 EmbeddedMetadataPlugin.trim_whitespace:Trim whitespace from start and end of any extracted metadata values (Note: this also applies to any values generated through joining with join_before_split or splitting through metadata_field_separator).
+EmbeddedMetadataPlugin.set_filter_list:A comma-separated list of the metadata sets we would like to retrieve.
+EmbeddedMetadataPlugin.set_filter_regexp:A regular expression that filters out the metadata we would like to retrieve.
 
 ExcelPlugin.desc:A plugin for importing Microsoft Excel files (versions 95 and 97).
