summaryrefslogtreecommitdiff
path: root/contrib/image_pregen.sh
diff options
context:
space:
mode:
authorAndreas Brachold <vdr07@deltab.de>2005-07-19 15:09:05 +0000
committerAndreas Brachold <vdr07@deltab.de>2005-07-19 15:09:05 +0000
commitf897f2aa7055c493db6391c50c8d19da970078e8 (patch)
treed13a515b24c149d7da4e9828cc9e9c73d4916f00 /contrib/image_pregen.sh
downloadvdr-plugin-image-f897f2aa7055c493db6391c50c8d19da970078e8.tar.gz
vdr-plugin-image-f897f2aa7055c493db6391c50c8d19da970078e8.tar.bz2
Initial import with release 0.2.3
Diffstat (limited to 'contrib/image_pregen.sh')
-rwxr-xr-xcontrib/image_pregen.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/contrib/image_pregen.sh b/contrib/image_pregen.sh
new file mode 100755
index 0000000..8a89fd6
--- /dev/null
+++ b/contrib/image_pregen.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# image_pregen.sh
+#
+# call with file or dir to pregenerate the file or dir
+# if you set first param. to -at, the script will use at to start a job for
+# atd, so it runs asychonous in the background
+#
+# by Onno Kreuzinger, onno_AT_kreuzinger_DOT_biz
+# 2004-06-27 a.brachold - remove nocopy method
+# 2004-08-14 a.brachold - update for imageplugin.sh version 0.2.0
+#
+[ "z$DEBUG" = "zyes" ] && set -xv
+
+[ "z$1" = "z" ] && echo "start atleast with file or dir as argument, to pregenerate that file or dir." && exit 1
+[ "z$1" = "z-at" ] && echo "starting at job mode.." && echo "$0 $2 $3"|at now && exit 0
+[ "z$2" = "z-at" ] && echo "starting at job mode.." && echo "$0 $1 $3"|at now && exit 0
+[ "z$1" = "z-follow" ] && FOLLOWMODE="true" && shift
+[ "z$2" != "z" ] && shift
+
+CONVERT_SCRIPT="imageplugin.sh"
+CACHEFOLDER=${CACHEFOLDER:-"/tmp/image"}
+
+[ ! -e $CONVERT_SCRIPT ] && echo "Can't find our worker $CONVERT_SCRIPT, please adjust path or variable CONVERT_SCRIPT" && exit 1
+
+if [ -d "$1" ]
+ then
+ if [ "z$FOLLOWMODE" = "ztrue" ]
+ then
+ echo "$0 : recursive dir mode "$1""
+ find "$1" -follow -type f \
+ -name "*\.[jJbBtTpPmM][pPmMiInN][gGpPeEfFmM]" \
+ -exec $CONVERT_SCRIPT "{}" "$CACHEFOLDER{}.pnm" 688 544 0 0 0 \; 2> /dev/null
+ else
+ echo "$0 : dir mode "$1""
+ find "$1" -maxdepth 1 -follow -type f \
+ -name "*\.[jJbBtTpPmM][pPmMiInN][gGpPeEfFmM]" \
+ -exec $CONVERT_SCRIPT "{}" "$CACHEFOLDER{}.pnm" 688 544 0 0 0 \; 2> /dev/null
+ fi
+elif [ -e "$1" ]
+ then
+ echo "$0 : single file mode "$1""
+ $CONVERT_SCRIPT "$1" "$CACHEFOLDER$1.pnm" 688 544 0 0 0 2> /dev/null
+else
+ echo -e "$1 is no file or directory\n syntax: $0 [-at] [-follow] <file|folder>"
+fi
+echo "done"