From: Scott Worley Date: Fri, 28 Feb 2014 19:27:11 +0000 (-0800) Subject: Support .jpeg files mixed in with .NEF files X-Git-Url: http://git.scottworley.com/picsort/commitdiff_plain/cd368e974b63917e537306af77de71ded9f8e1ef?ds=inline;hp=a5ef285705b4a65abe7d6527b2e727eebd111aba Support .jpeg files mixed in with .NEF files --- diff --git a/pics-make-inputjs b/pics-make-inputjs index 73bff75..e1182b8 100755 --- a/pics-make-inputjs +++ b/pics-make-inputjs @@ -1,5 +1,5 @@ #!/bin/bash cat > picstosort.js < -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 - if [[ ! -s "sm/$out" ]];then - convert "$out" -geometry "x$SMALLHEIGHT" "sm/$out" - fi - done + fi done diff --git a/picsorter.js b/picsorter.js index db81f05..b1c1bdf 100644 --- a/picsorter.js +++ b/picsorter.js @@ -28,13 +28,19 @@ function stripFromEnd(str, suffix) { } 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 { - 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) {