Index: trunk/ippScripts/scripts/minidvodb_createdb.pl
===================================================================
--- trunk/ippScripts/scripts/minidvodb_createdb.pl	(revision 28375)
+++ trunk/ippScripts/scripts/minidvodb_createdb.pl	(revision 28377)
@@ -41,5 +41,5 @@
 my (  $outroot, $dbname, $dvodb, $minidvodb,$minidvodb_interval, $minidvodb_group, $camera,  $verbose, $no_update,
      $no_op, $redirect, $save_temps);
-GetOptions(    
+GetOptions(
     'camera|c=s'        => \$camera, # Camera
     'dbname|d=s'        => \$dbname, # Database name
@@ -62,5 +62,5 @@
           ) unless
     defined $minidvodb_group and
-    defined $camera and 
+    defined $camera and
     defined $outroot and
     defined $dvodb;
@@ -114,6 +114,6 @@
 
 unless ($no_op) {
-    
-  
+
+
 
 #see if there is already one in new state
@@ -123,9 +123,9 @@
     $fpaCommand1 .= " -dbname $dbname" if defined $dbname;
 
-    
+
 unless ($no_update) {
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
         run(command => $fpaCommand1, verbose => $verbose);
-    
+
 
 
@@ -135,8 +135,8 @@
        exit($error_code);
     }
-   
+
     if (scalar(@{$stdout_buf})) {
-	$error_code = 3;
-	    warn("Unwilling to create minidvodb, one already exists in new state: $error_code\n");
+        $error_code = 3;
+            warn("Unwilling to create minidvodb, one already exists in new state: $error_code\n");
         exit($error_code);
     }
@@ -145,6 +145,6 @@
     my $addRun_count;
     my $minidvodb_name;
-#find the active one's date, and find out if it has more than 1 addRun in it   
-    
+#find the active one's date, and find out if it has more than 1 addRun in it
+
     my $fpaCommand2 = "$addtool -listminidvodbrun";
     $fpaCommand2 .= " -minidvodb_group '$minidvodb_group'";
@@ -155,27 +155,27 @@
 #print $fpaCommand2;
 
-    
+
     my ( $success2, $error_code2, $full_buf2, $stdout_buf2, $stderr_buf2 ) =
-	run(command => $fpaCommand2, verbose => $verbose);
+        run(command => $fpaCommand2, verbose => $verbose);
     &my_die( "Unable to get listminidvodbrun",$minidvodb_group, $PS_EXIT_SYS_ERROR) unless $success2;
   # if it didn't list something in active state (what?) then we definitely need to create a new one
     if (defined(@$stdout_buf2)) {
   my  $metadata2 = $mdcParser->parse(join "", @$stdout_buf2) or
-	&my_die("Unable to parse metadata config", $minidvodb_group, $PS_EXIT_PROG_ERROR);
-    
+        &my_die("Unable to parse metadata config", $minidvodb_group, $PS_EXIT_PROG_ERROR);
+
   my   $components2 = parse_md_list($metadata2) or
-	&my_die("Unable to parse metadata list", $minidvodb_group, $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to parse metadata list", $minidvodb_group, $PS_EXIT_PROG_ERROR);
   my   $comp2 = $$components2[0];
     $minidvodb_name = $comp2->{minidvodb_name};
     $creation_date  = $comp2->{creation_date};
     if (!defined($minidvodb_name)) {
-	&my_die("Unable to parse minidvodb_name", $minidvodb_group, $PS_EXIT_PROG_ERROR);
-    } 
+        &my_die("Unable to parse minidvodb_name", $minidvodb_group, $PS_EXIT_PROG_ERROR);
+    }
     if (!defined($creation_date)) {
-	&my_die("Unable to parse creation_date", $minidvodb_group, $PS_EXIT_PROG_ERROR);
-    } 
-    } else { 
-	$create_new = 1; #this is to force it to make a new one
-	    }
+        &my_die("Unable to parse creation_date", $minidvodb_group, $PS_EXIT_PROG_ERROR);
+    }
+    } else {
+        $create_new = 1; #this is to force it to make a new one
+            }
 
     #find the number of add_ids that have been proccessed
@@ -187,38 +187,38 @@
     $fpaCommand3 .= " -dbname $dbname" if defined $dbname;
 
-   
+
 my ( $success3, $error_code3, $full_buf3, $stdout_buf3, $stderr_buf3 ) =
-	run(command => $fpaCommand3, verbose => $verbose);
+        run(command => $fpaCommand3, verbose => $verbose);
     &my_die( "Unable to get checkminidvodbunaddrun", $minidvodb_group, $PS_EXIT_SYS_ERROR) unless $success3;
-   
+
     if (defined(@$stdout_buf3)) {  #checkminidvodb returns nothing IF there have been no addruns added to the db yet
     my  $metadata3 = $mdcParser->parse(join "", @$stdout_buf3) or
-	&my_die("Unable to parse metadata config", $minidvodb_group, $PS_EXIT_PROG_ERROR);
-    
+        &my_die("Unable to parse metadata config", $minidvodb_group, $PS_EXIT_PROG_ERROR);
+
     my  $components3 = parse_md_list($metadata3) or
-	&my_die("Unable to parse metadata list", $minidvodb_group, $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to parse metadata list", $minidvodb_group, $PS_EXIT_PROG_ERROR);
    my  $comp = $$components3[0];
     $addRun_count = $comp->{addRun_count};
-	} 
+        }
     if (!defined($addRun_count)) {
-	 ## there's nothing to parse if there's nothing
+         ## there's nothing to parse if there's nothing
         $addRun_count = 0;
-    } 
-    
-
-    if ($addRun_count > 30000) {
-	#it's too big, create_new 
+    }
+
+
+    if ($addRun_count > 500) {
+        #it's too big, create_new
         $create_new = 1;
    }
     if ($create_new == 0) {
-	my $parser = DateTime::Format::Strptime->new( pattern => '%Y-%m-%dT%H:%M:%S', time_zone => "HST" );
-	my $creation_dt = $parser->parse_datetime( $creation_date )->mjd;
-	if ($mjd_start- $creation_dt > $minidvodb_interval && $addRun_count > 0 ) {
-	    #db is old and has stuff in it, want to create_new 
-	    $create_new = 1;
-	}
-    }
-    
-    
+        my $parser = DateTime::Format::Strptime->new( pattern => '%Y-%m-%dT%H:%M:%S', time_zone => "HST" );
+        my $creation_dt = $parser->parse_datetime( $creation_date )->mjd;
+        if ($mjd_start- $creation_dt > $minidvodb_interval && $addRun_count > 0 ) {
+            #db is old and has stuff in it, want to create_new
+            $create_new = 1;
+        }
+    }
+
+
 }
 #create the minidvodb entry (well, the command for it)
@@ -228,17 +228,17 @@
     $fpaCommand .= " -set_mergedvodb_path $dvodbReal";
     $fpaCommand .= " -dbname $dbname" if defined $dbname;
-    
+
     unless ($no_update or !$create_new) {
 
 
-	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	    run(command => $fpaCommand, verbose => $verbose);
-	unless ($success) {
-	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	    warn("Unable to add result to database: $error_code\n");
-	    exit($error_code);
-	}
+        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+            run(command => $fpaCommand, verbose => $verbose);
+        unless ($success) {
+            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+            warn("Unable to add result to database: $error_code\n");
+            exit($error_code);
+        }
     } else {
-	print "skipping command: $fpaCommand\n";
+        print "skipping command: $fpaCommand\n";
     }
 }
@@ -249,9 +249,9 @@
     my $minidvodb_group = shift; # Camtool identifier
     my $exit_code = shift; # Exit code to add
-    
+
     $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
-    
+
     carp($msg);
-    
+
     exit $exit_code;
 }
