]> git.scottworley.com Git - picsort/commitdiff
Support NEF rotation in pic-mv
authorScott Worley <scottworley@scottworley.com>
Sat, 1 Mar 2014 08:33:30 +0000 (00:33 -0800)
committerScott Worley <scottworley@scottworley.com>
Sat, 1 Mar 2014 08:33:30 +0000 (00:33 -0800)
Move ufraw-batch invocation out into a separate file: pics-run-ufraw

pic-mv
pics-preprocess
pics-run-ufraw [new file with mode: 0755]

diff --git a/pic-mv b/pic-mv
index 2774a6928fb23674c8c9c2774991231ce2caf715..e1e18ac09d531c05648510d7b7808fa5e0f6e7a5 100755 (executable)
--- a/pic-mv
+++ b/pic-mv
@@ -24,18 +24,20 @@ else
   number=1
 fi
 
   number=1
 fi
 
+out="$destdir/$name $number.jpeg"
+
 if [[ "$file" == *.NEF ]];then
   base="${file%.NEF}"
   if [[ "$rotate" ]];then
 if [[ "$file" == *.NEF ]];then
   base="${file%.NEF}"
   if [[ "$rotate" ]];then
-    echo "NEF rotation not yet implemented" >&2
-    exit 1
+    numeric_exposure=$(dc <<< "2k $exposure 4 / 3.5-p")
+    pics-run-ufraw "$numeric_exposure" "$file" "$out" "$rotate"
   else
   else
-    mv -vi "$exposure/$base.jpeg" "$destdir/$name $number.jpeg"
-    mv -vi "$file" "$destdir/$name $number.NEF"
+    mv -vi "$exposure/$base.jpeg" "$out"
   fi
   fi
+  mv -vi "$file" "$destdir/$name $number.NEF"
 else
   if [[ "$rotate" ]];then
     sed -i "s/^# ROBOTS_INSERT_THINGS_HERE\$/&\n\"$name $number.jpeg\" => $rotate," "$destdir/rotations.php"
   fi
 else
   if [[ "$rotate" ]];then
     sed -i "s/^# ROBOTS_INSERT_THINGS_HERE\$/&\n\"$name $number.jpeg\" => $rotate," "$destdir/rotations.php"
   fi
-  mv -vi "$file" "$destdir/$name $number.jpeg"
+  mv -vi "$file" "$out"
 fi
 fi
index 780acdc794657b6f875e7aaee07d0c9f53fa2e90..8b8dcb4f4be6fd0fc1e01e770d228739ae99893f 100755 (executable)
@@ -4,9 +4,6 @@
 # This makes many variants of each .NEF file at different exposure levels
 # and makes reduced-size versions for faster browsing.
 
 # This makes many variants of each .NEF file at different exposure levels
 # and makes reduced-size versions for faster browsing.
 
-GREEN=1.105
-TEMPERATURE=5500
-JPEGCOMPRESSION=95
 SMALLHEIGHT=700
 
 
 SMALLHEIGHT=700
 
 
@@ -18,13 +15,7 @@ for f;do
       out="$level/${base%.NEF}.jpeg"
       exposure=$(dc <<< "2k $level 4 / 3.5-p")  # 10 to 30 -> -1 to 4 in .25 steps
       if [[ ! -s "$out" ]];then
       out="$level/${base%.NEF}.jpeg"
       exposure=$(dc <<< "2k $level 4 / 3.5-p")  # 10 to 30 -> -1 to 4 in .25 steps
       if [[ ! -s "$out" ]];then
-        ufraw-batch --out-type=jpeg \
-                    --green="$GREEN" \
-                    --temperature="$TEMPERATURE" \
-                    --compression="$JPEGCOMPRESSION" \
-                    --exposure="$exposure" \
-                    --output="$out" \
-                    "$f"
+        pics-run-ufraw "$exposure" "$f" "$out"
       fi
       if [[ ! -s "sm/$out" ]];then
         convert "$out" -geometry "x$SMALLHEIGHT" "sm/$out"
       fi
       if [[ ! -s "sm/$out" ]];then
         convert "$out" -geometry "x$SMALLHEIGHT" "sm/$out"
diff --git a/pics-run-ufraw b/pics-run-ufraw
new file mode 100755 (executable)
index 0000000..dc35b99
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+GREEN=1.105
+TEMPERATURE=5500
+JPEGCOMPRESSION=95
+
+exposure=$1
+file=$2
+out=$3
+rotate=$4
+
+ufraw-batch --out-type=jpeg \
+           --green="$GREEN" \
+           --temperature="$TEMPERATURE" \
+           --compression="$JPEGCOMPRESSION" \
+           --exposure="$exposure" \
+           --output="$out" \
+           $( [[ "$rotate" ]] && echo --rotate="$rotate" ) \
+           "$file"