]> git.scottworley.com Git - picsort/commitdiff
Support .jpeg files mixed in with .NEF files
authorScott Worley <scottworley@scottworley.com>
Fri, 28 Feb 2014 19:27:11 +0000 (11:27 -0800)
committerScott Worley <scottworley@scottworley.com>
Fri, 28 Feb 2014 19:27:11 +0000 (11:27 -0800)
pics-make-inputjs
pics-preprocess
picsorter.js

index 73bff759c38a5a63dff9d421c18d247b19719554..e1182b87fcf6c467efb6d9d855f89858ed366b23 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/bash
 
 cat > picstosort.js <<EOF
 #!/bin/bash
 
 cat > picstosort.js <<EOF
-files =  [ $(ls 10 | ql | tr \\n , | sed 's/,$//' ) ];
+files =  [ $(ls -rt *.NEF *.jpeg | ql | tr \\n , | sed 's/,$//' ) ];
 EOF
 EOF
index fde35d14f9f70630ee8468d5499a8013b8ebdfcb..780acdc794657b6f875e7aaee07d0c9f53fa2e90 100755 (executable)
@@ -1,7 +1,8 @@
 #!/bin/bash
 
 #!/bin/bash
 
-# Pass .NEF files as $@.
-# This makes many variants of each one at different exposure levels. 
+# Pass .NEF and .jpeg files as $@.
+# 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
 
 GREEN=1.105
 TEMPERATURE=5500
@@ -10,22 +11,28 @@ SMALLHEIGHT=700
 
 
 for f;do
 
 
 for f;do
-  for level in {10..30};do
-    mkdir -p {,sm/}"$level"
-    base="$(basename "$f")"
-    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"
+  if [[ "$f" == *.NEF ]];then
+    for level in {10..30};do
+      mkdir -p {,sm/}"$level"
+      base="$(basename "$f")"
+      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"
+      fi
+      if [[ ! -s "sm/$out" ]];then
+        convert "$out" -geometry "x$SMALLHEIGHT" "sm/$out"
+      fi
+    done
+  else
+    if [[ ! -s "sm/$f" ]];then
+      convert "$f" -geometry "x$SMALLHEIGHT" "sm/$f"
     fi
     fi
-    if [[ ! -s "sm/$out" ]];then
-      convert "$out" -geometry "x$SMALLHEIGHT" "sm/$out"
-    fi
-  done
+  fi
 done
 done
index db81f058b13c4a4d0a08bf9fc383d87325039956..b1c1bdf5b726220f97adf9af55c47d533f21d6ec 100644 (file)
@@ -28,13 +28,19 @@ function stripFromEnd(str, suffix) {
 }
 
 function setpic() {
 }
 
 function setpic() {
-  if ("exposure" in picinfo[files[input_index]]) {
-    exposure = picinfo[files[input_index]].exposure;
+  var display_filename;
+  if (endsWith(files[input_index], ".NEF")) {
+    if ("exposure" in picinfo[files[input_index]]) {
+      exposure = picinfo[files[input_index]].exposure;
+    } else {
+      picinfo[files[input_index]].exposure = exposure;
+      save_picinfo();
+    }
+    display_filename = zoom + exposure + "/" + stripFromEnd(files[input_index], ".NEF") + ".jpeg";
   } else {
   } else {
-    picinfo[files[input_index]].exposure = exposure;
-    save_picinfo();
+    display_filename = zoom + files[input_index];
   }
   }
-  $("#pic").attr("src", zoom + exposure + "/" + files[input_index]);
+  $("#pic").attr("src", display_filename);
 }
 
 function say(message) {
 }
 
 function say(message) {