-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfitter-script
executable file
·74 lines (71 loc) · 2.01 KB
/
fitter-script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/csh
#converts all files in the original caputues folder to jpeg in jpeg-exports
# 2011-05-12
# exit status
# 0 sucess
# 1 wrong parameters sent
# 2 not the correct hierachy
# 3 lpfile not found
# 4 No valid jpef/nef files found
# 5 ptmfit failed
set nonomatch
if($#argv != 2) then
echo "Wrong number of parameters specified"
echo "Usage:" $0 "default-lpfile(full path) folder to fit"
exit 1
endif
set lpfile="$1"
set workingdir = "$2"
cd "$workingdir"
if((! -d original-captures) || (! -d jpeg-exports) || (! -d finished-files) || (! -d assembly-files)) then
#It's not a valid ptm folder hierachy
echo "No valid folder structure detected"
exit 2
endif
if (! -e $lpfile) then
#lpfile doesn't exist or full path isn't given
echo "Not able to find lpfile on path specified, make sure it's a full path"
exit 3
endif
echo "copy default lp file "
cp $lpfile ./assembly-files/capture.lp
if ( -e original-captures/1.jpg ) then
#check to see if jpegs in orginal captures
cp original-captures/*.jpg jpeg-exports/
echo "Copied jpegs to folder"
else if ( -e original-captures/0.nef) then
#else check if raw and convert
ufraw-batch --out-type=jpeg original-captures/*.nef --out-path=jpeg-exports
echo "Converted all files to jpeg"
else
#else panic - no idea what to do so quit
echo "No idea what to do as no jpeg or NEF files offered"
exit 4
endif
#run the fitter
set crop = ""
grep "Selection" camsettings.txt
if ($status == 0) then
set sel = `grep Selection camsettings.txt`
set x = `echo $sel | cut -f 2 -d " " | tr -d \" `
set y = `echo $sel | cut -f 3 -d " " `
set w = `echo $sel | cut -f 4 -d " " `
set h = `echo $sel | cut -f 5 -d " " | tr -d \"`
echo $sel
echo $x
echo $y
echo $w
echo $h
set crop = "-crop $x $y $w $h"
endif
cd jpeg-exports
echo "Running PTMFitter"
ptmfit -cache -i ../assembly-files/capture.lp -o ../finished-files/output.ptm $crop
if ($status == 0) then
echo "PTMFitter Complete"
exit 0
else
echo "PTM fit failed"
exit 5
endif