Index: trunk/pstamp/scripts/pstamp_finish.pl
===================================================================
--- trunk/pstamp/scripts/pstamp_finish.pl	(revision 19278)
+++ trunk/pstamp/scripts/pstamp_finish.pl	(revision 19279)
@@ -21,4 +21,5 @@
 use PS::IPP::Config qw( :standard );
 use PStamp::RequestFile qw( :standard );
+use PStamp::Job qw( :standard );
 
 my ( $req_id, $req_name, $req_file, $product, $dbname, $verbose, $save_temps );
@@ -159,9 +160,9 @@
 
         # XXX: get the image_db from a table in the database, or maybe save it in the job
-        my $image_db = "ps_simtest";     
+
+        # unless $exp_id is null (e.g. stack images) get the metadata for this exposure
+        my ($row, $req_info, $project) = get_request_info($rows, $rownum);
+        my ($image_db) = resolve_project($project);
         my $exp_info = get_exposure_info($image_db, $exp_id);
-
-        # unless $exp_id is null (e.g. stack images) get the metadata for this exposure
-        my ($row, $req_info) = get_request_info($rows, $rownum) if $exp_id;
 
         if (($job_type eq "stamp") || ($job_type eq "get_image")) {
@@ -273,5 +274,5 @@
     $rowinfo   .= "$row->{WIDTH}|$row->{HEIGHT}";
 
-    return ($row, $rowinfo);
+    return ($row, $rowinfo, $row->{PROJECT});
 }
 
