Revision: 1750
          http://geeqie.svn.sourceforge.net/geeqie/?rev=1750&view=rev
Author:   nadvornik
Date:     2009-06-18 20:46:33 +0000 (Thu, 18 Jun 2009)

Log Message:
-----------
ufraw-batch script

added a more complicated script that demonstrates advanced
features of external editors:
- create a jpeg + ufraw id file for each raw file
- update the jpeg if the id file was modified

Modified Paths:
--------------
    trunk/configure.in
    trunk/plugins/Makefile.am

Added Paths:
-----------
    trunk/plugins/ufraw/
    trunk/plugins/ufraw/Makefile.am
    trunk/plugins/ufraw/geeqie-ufraw
    trunk/plugins/ufraw/geeqie-ufraw-recursive.desktop.in
    trunk/plugins/ufraw/geeqie-ufraw.desktop.in

Modified: trunk/configure.in
===================================================================
--- trunk/configure.in  2009-06-17 18:41:10 UTC (rev 1749)
+++ trunk/configure.in  2009-06-18 20:46:33 UTC (rev 1750)
@@ -412,6 +412,7 @@
     plugins/Makefile
     plugins/symlink/Makefile
     plugins/rotate/Makefile
+    plugins/ufraw/Makefile
     geeqie.spec
 ])
 

Modified: trunk/plugins/Makefile.am
===================================================================
--- trunk/plugins/Makefile.am   2009-06-17 18:41:10 UTC (rev 1749)
+++ trunk/plugins/Makefile.am   2009-06-18 20:46:33 UTC (rev 1750)
@@ -1,4 +1,6 @@
-SUBDIRS = rotate symlink
+#FIXME enable or disable individual plugins from configure
+
+SUBDIRS = rotate symlink ufraw
 qq_desktoptemplatedir = $(pkgdatadir)
 qq_desktoptemplate_DATA = template.desktop
 

Added: trunk/plugins/ufraw/Makefile.am
===================================================================
--- trunk/plugins/ufraw/Makefile.am                             (rev 0)
+++ trunk/plugins/ufraw/Makefile.am     2009-06-18 20:46:33 UTC (rev 1750)
@@ -0,0 +1,9 @@
+dist_pkglib_SCRIPTS = geeqie-ufraw
+
+gq_desktopdir = $(pkgdatadir)/applications
+gq_desktop_in_files = geeqie-ufraw-recursive.desktop.in geeqie-ufraw.desktop.in
+gq_desktop_DATA = $(gq_desktop_in_files:.desktop.in=.desktop)
+...@intltool_desktop_rule@
+
+EXTRA_DIST = $(qq_desktop_DATA)
+

Added: trunk/plugins/ufraw/geeqie-ufraw
===================================================================
--- trunk/plugins/ufraw/geeqie-ufraw                            (rev 0)
+++ trunk/plugins/ufraw/geeqie-ufraw    2009-06-18 20:46:33 UTC (rev 1750)
@@ -0,0 +1,132 @@
+#!/bin/bash
+
+# FIXME TODO:
+# restore XMP in output files from input sidecars
+# getopt, verbosity levels
+# improve the default ufraw configuration
+# localization?
+# help
+
+
+# matches raw file names, used as case insensitive
+RAW_REGEX='.*\.\(arw\)\|\(srf\)\|\(sr2\)\|\(crw\)\|\(cr2\)\|\(kdc\)\|\(dcr\)\|\(k25\)\|\(raf\)\|\(mef\)\|\(mos\)\|\(mrw\)\|\(nef\)\|\(orf\)\|\(pef\)\|\(ptx\)\|\(dng\)\|\(x3f\)\|\(raw\)\|\(r3d\)\|\(3fr\)\|\(erf\)$'
+
+# matches ufraw id file names, used as case sensitive
+ID_REGEX='.*\.ufraw$'
+
+get_output_from_id ()
+{
+    grep "<OutputFilename>.*</OutputFilename>" "$1" |sed -e 
's|.*<OutputFilename>\(.*\)</OutputFilename>.*|\1|'
+}
+
+# test if the id file has changed and the output needs to be refreshed
+id_file_changed ()
+{
+    idfile=$1
+    output=`get_output_from_id "$idfile"`
+    [ ! -f "$output" -o "$idfile" -nt "$output" ]
+}
+
+# refresh the output file specified by given id file, if necessary
+process_ufraw_id_file ()
+{
+    idfile=$1
+    if id_file_changed "$idfile" ; then
+        ufraw-batch --overwrite "$idfile"
+    fi
+}
+
+# test for newly added raw files that were never processed
+raw_file_not_processed ()
+{
+    rawfile=$1
+    basename=${rawfile%.*}
+    [ ! -f "$basename.ufraw" ]
+}
+
+# process raw file for the first time
+process_raw_file_default ()
+{
+    rawfile=$1
+    if raw_file_not_processed "$rawfile" ; then
+        ufraw-batch --create-id=also \
+                    --wb=camera \
+                    --exposure=auto \
+                    --out-type=jpeg \
+                    --compression=96 \
+                    "$rawfile"
+    fi
+}
+
+# process all files listed in file $1
+# if $2 is not empty, produce output for zenity --progress
+process_list ()
+{
+    list=$1
+    use_zenity=$2
+    
+    count=`wc -l <$list`
+    n=0
+    [ -n "$use_zenity" ] && echo 0
+
+    if [ "$count" -gt 0 ] ; then
+        while read file; do
+            [ -f "$file" ] || continue
+            if echo "$file"|grep -q -i "$RAW_REGEX" ; then
+                process_raw_file_default "$file" 
+            elif echo "$file"|grep -q "$ID_REGEX" ; then
+                process_ufraw_id_file "$file"
+
+            fi
+
+            n=$((n + 1))
+            
+            # the function can end at the 'echo' command with broken pipe
+            # if it is cancelled via zenity
+            [ -n "$use_zenity" ] && echo $((n * 100 / count))
+
+        done <$list
+    fi
+    [ -n "$use_zenity" ] && echo 100
+}
+
+# process all files in directory $1, including subdirectories
+# processing is controlled by zenity dialogs if $DISPLAY is set
+process_tree ()
+{
+    list=`mktemp /tmp/geeqie-ufraw-list.XXXXXXXXXX` || exit 1
+
+    find "$1" -iregex "$RAW_REGEX" -print | while read rawfile ; do
+        raw_file_not_processed "$rawfile" && echo "$rawfile" 
+    done >>$list
+    
+    #refresh output from changed id files
+    find "$1" -regex "$ID_REGEX" -print | while read idfile ; do
+        id_file_changed "$idfile" && echo "$idfile"
+    done >>$list
+
+    if [ -n "$DISPLAY" ] ; then
+        if [ -s $list ] && \
+           zenity --list --title "Files to proceed" --text "Files to proceed" 
--column "Files" <$list ; then
+            process_list $list with_zenity | zenity --progress --auto-close
+        fi
+    else 
+        # no DISPLAY
+        process_list $list
+    fi
+    rm $list
+}
+
+
+
+if [ -d "$1" ] ; then
+    # $1 is a directory
+    process_tree "$1"
+else
+    list=`mktemp /tmp/geeqie-ufraw-list.XXXXXXXXXX` || exit 1
+    for file in "$@" ; do
+        echo $file
+    done >>$list
+    process_list $list
+    rm $list
+fi


Property changes on: trunk/plugins/ufraw/geeqie-ufraw
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/plugins/ufraw/geeqie-ufraw-recursive.desktop.in
===================================================================
--- trunk/plugins/ufraw/geeqie-ufraw-recursive.desktop.in                       
        (rev 0)
+++ trunk/plugins/ufraw/geeqie-ufraw-recursive.desktop.in       2009-06-18 
20:46:33 UTC (rev 1750)
@@ -0,0 +1,18 @@
+[Desktop Entry]
+Version=1.0
+Type=Application
+_Name=Process folder with UFRaw Batch
+
+# call the helper script with current directory as an argument
+Exec=geeqie-ufraw .
+
+# Desktop files that are usable only in Geeqie should be marked like this:
+Categories=X-Geeqie;
+OnlyShowIn=X-Geeqie;
+
+# Show in menu "Edit"
+X-Geeqie-Menu-Path=EditMenu
+
+# It can be made verbose
+# X-Geeqie-Verbose=true
+

Added: trunk/plugins/ufraw/geeqie-ufraw.desktop.in
===================================================================
--- trunk/plugins/ufraw/geeqie-ufraw.desktop.in                         (rev 0)
+++ trunk/plugins/ufraw/geeqie-ufraw.desktop.in 2009-06-18 20:46:33 UTC (rev 
1750)
@@ -0,0 +1,20 @@
+[Desktop Entry]
+Version=1.0
+Type=Application
+_Name=UFRaw Batch
+
+# call the helper script on each file individually 
+# - this allows a better controll over processing
+Exec=geeqie-ufraw %f
+
+# Desktop files that are usable only in Geeqie should be marked like this:
+Categories=X-Geeqie;
+OnlyShowIn=X-Geeqie;
+
+# Show in menu "Edit"
+X-Geeqie-Menu-Path=EditMenu
+
+# It can be made verbose
+X-Geeqie-Verbose=true
+
+MimeType=application/x-ufraw;image/x-dcraw;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn

Reply via email to