4 # restore XMP in output files from input sidecars
5 # getopt, verbosity levels
6 # improve the default ufraw configuration
11 # matches raw file names, used as case insensitive
12 RAW_REGEX='.*\.\(arw\)\|\(srf\)\|\(sr2\)\|\(crw\)\|\(cr2\)\|\(kdc\)\|\(dcr\)\|\(k25\)\|\(raf\)\|\(mef\)\|\(mos\)\|\(mrw\)\|\(nef\)\|\(orf\)\|\(pef\)\|\(ptx\)\|\(dng\)\|\(x3f\)\|\(raw\)\|\(r3d\)\|\(3fr\)\|\(erf\)$'
14 # matches ufraw id file names, used as case sensitive
19 grep "<OutputFilename>.*</OutputFilename>" "$1" |sed -e 's|.*<OutputFilename>\(.*\)</OutputFilename>.*|\1|'
22 # test if the id file has changed and the output needs to be refreshed
26 output=`get_output_from_id "$idfile"`
27 [ ! -f "$output" -o "$idfile" -nt "$output" ]
30 # refresh the output file specified by given id file, if necessary
31 process_ufraw_id_file ()
34 if id_file_changed "$idfile" ; then
35 ufraw-batch --overwrite "$idfile"
39 # test for newly added raw files that were never processed
40 raw_file_not_processed ()
43 basename=${rawfile%.*}
44 [ ! -f "$basename.ufraw" ]
47 # process raw file for the first time
48 process_raw_file_default ()
51 if raw_file_not_processed "$rawfile" ; then
52 ufraw-batch --create-id=also \
61 # process all files listed in file $1
62 # if $2 is not empty, produce output for zenity --progress
70 [ -n "$use_zenity" ] && echo 0
72 if [ "$count" -gt 0 ] ; then
74 [ -f "$file" ] || continue
75 if echo "$file"|grep -q -i "$RAW_REGEX" ; then
76 process_raw_file_default "$file"
77 elif echo "$file"|grep -q "$ID_REGEX" ; then
78 process_ufraw_id_file "$file"
84 # the function can end at the 'echo' command with broken pipe
85 # if it is cancelled via zenity
86 [ -n "$use_zenity" ] && echo $((n * 100 / count))
90 [ -n "$use_zenity" ] && echo 100
93 # process all files in directory $1, including subdirectories
94 # processing is controlled by zenity dialogs if $DISPLAY is set
97 list=`mktemp /tmp/geeqie-ufraw-list.XXXXXXXXXX` || exit 1
99 find "$1" -iregex "$RAW_REGEX" -print | while read rawfile ; do
100 raw_file_not_processed "$rawfile" && echo "$rawfile"
103 #refresh output from changed id files
104 find "$1" -regex "$ID_REGEX" -print | while read idfile ; do
105 id_file_changed "$idfile" && echo "$idfile"
108 if [ -n "$DISPLAY" ] ; then
110 zenity --list --title "Files to proceed" --text "Files to proceed" --column "Files" <$list ; then
111 process_list $list with_zenity | zenity --progress --auto-close
122 if [ -d "$1" ] ; then
126 list=`mktemp /tmp/geeqie-ufraw-list.XXXXXXXXXX` || exit 1
127 for file in "$@" ; do