Index: trunk/ippScripts/scripts/ipp_image_path.pl
===================================================================
--- trunk/ippScripts/scripts/ipp_image_path.pl	(revision 18536)
+++ trunk/ippScripts/scripts/ipp_image_path.pl	(revision 22429)
@@ -2,6 +2,4 @@
 
 # ipp_image_path.pl print out the unix path name(s) for rawImage files for an exposure
-# Note this program should really be called gpc1_image_path since the camera is
-# hardcoded to gpc1 and the telescope is gpc1
 #
 
@@ -10,6 +8,7 @@
 
 # get images that are on ipp008 from alternative location until the
-# dataase is updated
-my $use_008_workaround  = 1;
+# database is updated
+my $use_008_workaround  = 0;
+my $use_017_workaround  = 0;
 
 use vars qw( $VERSION );
@@ -41,8 +40,4 @@
 my $ota_num;
 if ($class_id) {
-    # we accept class_id in 3 formats (all we care about is the number)
-    # xy23
-    # ota23
-    # 23
     $class_id = lc($class_id);
     my $extra;
@@ -74,10 +69,8 @@
     if ($from_registered) {
         $query = "SELECT exp_id, class_id, uri FROM rawImfile"
-                . " WHERE exp_name = \'$exp_name\'"
-                . " AND camera = \'gpc1\' AND telescope = \'ps1\'";
+                . " WHERE exp_name = \'$exp_name\'";
         $query .= " AND class_id = \'xy$ota_num\'" if ($ota_num);
     } else {
-        $query = "SELECT exp_id FROM newExp WHERE tmp_exp_name = ?"
-                . " AND tmp_camera = \'gpc1\' AND tmp_telescope = \'ps1\'";
+        $query = "SELECT exp_id FROM newExp WHERE tmp_exp_name = ?";
         my $stmt = $dbh->prepare($query);
         $stmt->execute($exp_name);
@@ -105,4 +98,7 @@
             if ($use_008_workaround && ($uri =~ /ipp008/)) {
                 $path = resolve_ipp008_file($uri);
+            } elsif ($use_017_workaround && ($uri =~ /4683/) &&
+                    ($uri =~ /ipp017/)) {
+                $path = resolve_ipp017_file($uri);
             } else {
                 $path = $ipprc->file_resolve($uri);
@@ -169,2 +165,22 @@
     return $path;
 }
+
+sub resolve_ipp017_file {
+    my $uri = shift;
+
+    # uri's look like neb://ipp008.0/gpc1/20080625/o4642g0400o/o4642g0400o.ota24.fits
+    
+    my ($left, $middle, $ota, $fits) = split '\.', $uri;
+    
+    my $node = "ipp015";
+
+    die "can't find node for $ota: $uri" if (!$node);
+
+    my $path =  $uri;
+    
+    $path =~  s%neb://ipp017.0%/data/${node}.0/recover17%;
+
+    die "sorry backup image for $uri not found\n" if (!-e $path);
+
+    return $path;
+}
