idok-commit AT lists.psi.ch
Subject: Commit emails of the iDok project
List archive
- From: "AFS account Florian Huebner" <huebner AT savannah.psi.ch>
- To: idok-commit AT lists.psi.ch
- Subject: [idok-commit] idok commit r279 - trunk/sites/psi/oodaemon
- Date: Fri, 17 Oct 2008 09:25:53 +0200
- List-archive: <https://lists.web.psi.ch/pipermail/idok-commit/>
- List-id: Commit emails of the iDok project <idok-commit.lists.psi.ch>
Author: huebner
Date: Fri Oct 17 09:25:53 2008
New Revision: 279
Log:
Improved the handling of temporary files and the conversion of large jpg and
tiff files
Added:
trunk/sites/psi/oodaemon/convertIM.sh (contents, props changed)
trunk/sites/psi/oodaemon/convertOO.sh
- copied, changed from r276, /trunk/sites/psi/oodaemon/iDocConv.sh
Added: trunk/sites/psi/oodaemon/convertIM.sh
==============================================================================
--- (empty file)
+++ trunk/sites/psi/oodaemon/convertIM.sh Fri Oct 17 09:25:53 2008
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+DOCTYPESOURCE=$1
+DOCTYPEDEST=$2
+
+INTMPFILE=$(mktemp /tmp/idokConvert.XXXXXXXXXX)
+TMPFILE=$(mktemp /tmp/idokConvert.XXXXXXXXXX)
+OUTTMPFILE=$(mktemp /tmp/idokConvert.XXXXXXXXXX)
+
+cat > $INTMPFILE.$DOCTYPESOURCE
+
+FILESIZE=`stat -c%s $INTMPFILE.$DOCTYPESOURCE`
+
+if [[ $DOCTYPESOURCE = "tiff" && $FILESIZE -gt 20000 ]] ; then
+ /usr/bin/thumbnail -w 1024 -h 768 $INTMPFILE.$DOCTYPESOURCE
$TMPFILE.$DOCTYPESOURCE
+ /usr/bin/convert $TMPFILE.$DOCTYPESOURCE $OUTTMPFILE.$DOCTYPEDEST
+elif [[ $DOCTYPESOURCE = "jpg" && $FILESIZE -gt 5000000 ]] ; then
+ /usr/bin/convert size 600x800 $INTMPFILE.$DOCTYPESOURCE -thumbnail
600x800 $OUTTMPFILE.$DOCTYPEDEST
+else
+ /usr/bin/convert $INTMPFILE.$DOCTYPESOURCE $OUTTMPFILE.$DOCTYPEDEST
+fi
+
+
+
+
+
+cat $OUTTMPFILE.$DOCTYPEDEST
+
+
+
+rm -f $INTMPFILE
+rm -f $INTMPFILE.$DOCTYPESOURCE
+rm -f $TMPFILE
+rm -f $TMPFILE.$DOCTYPESOURCE
+rm -f $OUTTMPFILE
+rm -f $OUTTMPFILE.$DOCTYPEDEST
+
+
+exit 0
Copied: trunk/sites/psi/oodaemon/convertOO.sh (from r276,
/trunk/sites/psi/oodaemon/iDocConv.sh)
==============================================================================
--- /trunk/sites/psi/oodaemon/iDocConv.sh (original)
+++ trunk/sites/psi/oodaemon/convertOO.sh Fri Oct 17 09:25:53 2008
@@ -3,20 +3,26 @@
DOCTYPESOURCE=$1
DOCTYPEDEST=$2
+INTMPFILE=$(mktemp /tmp/idokConvert.XXXXXXXXXX)
+#TMPFILE=$(mktemp /tmp/idokConvert.XXXXXXXXXX)
+OUTTMPFILE=$(mktemp /tmp/idokConvert.XXXXXXXXXX)
-rm -f /tmp/tempfile.$DOCTYPEDEST
-rm -f /tmp/tempfile.$DOCTYPESOURCE
+cat > $INTMPFILE.$DOCTYPESOURCE
-cat > /tmp/tempfile.$DOCTYPESOURCE
-/opt/jdk1.6.0_01/bin/java \
+
+ /opt/jdk1.6.0_01/bin/java \
-Xbootclasspath/p:/opt/dms/commons-io.jar:/opt/dms/juh.jar:/opt/dms/jurt.jar:/opt/dms/ridl.jar:/opt/dms/slf4j-api.jar:/opt/dms/slf4j-jdk14.jar:/opt/dms/unoil.jar:/opt/dms/commons-cli.jar:/opt/dms/jodconverter.jar
\
-cp /opt/dms/jodconverter-cli.jar \
- com.artofsolving.jodconverter.cli.ConvertDocument
/tmp/tempfile.$DOCTYPESOURCE /tmp/tempfile.$DOCTYPEDEST
+ com.artofsolving.jodconverter.cli.ConvertDocument
$INTMPFILE.$DOCTYPESOURCE $OUTTMPFILE.$DOCTYPEDEST
+
-cat /tmp/tempfile.$DOCTYPEDEST
+cat $OUTTMPFILE.$DOCTYPEDEST
-rm -f /tmp/tempfile.$DOCTYPEDEST
-rm -f /tmp/tempfile.$DOCTYPESOURCE
+rm -f $INTMPFILE
+rm -f $INTMPFILE.$DOCTYPESOURCE
+rm -f $OUTTMPFILE
+rm -f $OUTTMPFILE.$DOCTYPEDEST
+exit 0
\ No newline at end of file
- [idok-commit] idok commit r279 - trunk/sites/psi/oodaemon, AFS account Florian Huebner, 10/17/2008
Archive powered by MHonArc 2.6.19.