diff options
| author | root <root@elwms02.(none)> | 2010-04-06 16:13:08 +0200 |
|---|---|---|
| committer | root <root@elwms02.(none)> | 2010-04-06 16:13:08 +0200 |
| commit | 0e7005fcc7483c01aa102fbea358c5ac65a48d62 (patch) | |
| tree | 11517ce0d3d2977c6732b3aa583b0008083e0bd3 /plugins/image | |
| download | x-vdr-0e7005fcc7483c01aa102fbea358c5ac65a48d62.tar.gz x-vdr-0e7005fcc7483c01aa102fbea358c5ac65a48d62.tar.bz2 | |
hello world
Diffstat (limited to 'plugins/image')
| -rw-r--r-- | plugins/image/imagecmds.conf | 25 | ||||
| -rw-r--r-- | plugins/image/imageplugin.sh | 165 | ||||
| -rw-r--r-- | plugins/image/magickplugin.sh | 166 | ||||
| -rw-r--r-- | plugins/image/patches/image-0.3.0_ffmpeg.diff | 10 | ||||
| -rw-r--r-- | plugins/image/patches/image-0.3.0_plug-man.diff | 36 | ||||
| -rw-r--r-- | plugins/image/plugin.sh | 75 |
6 files changed, 477 insertions, 0 deletions
diff --git a/plugins/image/imagecmds.conf b/plugins/image/imagecmds.conf new file mode 100644 index 0000000..f5022dd --- /dev/null +++ b/plugins/image/imagecmds.conf @@ -0,0 +1,25 @@ +# +# Kommandos für Image plugins +# +# Format: see also man vdr(5) +# +## Menutext ?: Kommando %s +# +# ? - Bestätigung anfordern, (optional) +# %s - Platzhalter für Dateinamen (optional) +# +Informationen über das Bild : identify -verbose +Größe des Bildes : du -chs %s +Exif Informationen des JPEG-Bildes ausgeben : jpegtopnm -dumpexif %s >/dev/null 2> $CONVERT_TEMPDIR/exif.tmp && cat $CONVERT_TEMPDIR/exif.tmp && rm -f $CONVERT_TEMPDIR/exif.tmp +Rotatiere JPEG Bildes verlustlos um 90° nach Rechts : jpegtran -rotate 90 %s > $CONVERT_TEMPDIR/tmp.jpg && mv $CONVERT_TEMPDIR/tmp.jpg %s +Rotatiere JPEG Bildes verlustlos um 90° nach Links : jpegtran -rotate 270 %s > $CONVERT_TEMPDIR/tmp.jpg && mv $CONVERT_TEMPDIR/tmp.jpg %s +Lösche Bild ?: rm -f %s +# burn-bc +Blend Only : echo "burn-bc -f draw-storke -w default -i %s"|at now +Resize Only : echo "burn-bc -f 'resize draw-storke unsharp' -w default -i %s"|at now +Simple Cropping : echo "burn-bc -f 'crop resize resize draw-storke unsharp' -w default -i %s"|at now +Zoom Center : echo "burn-bc -f 'zoom-center resize draw-storke unsharp' -w default -i %s"|at now +Zoom Left : echo "burn-bc -f 'crop zoom-left resize draw-storke unsharp' -w default -i %s"|at now +Zoom Right : echo "burn-bc -f 'crop zoom-right resize draw-storke unsharp' -w default -i %s"|at now +#Symlink anlegen : echo ln -fs '%s' '$(dirname %s)/menu-bg.png' | sh +Symlink anlegen : echo ln -fs '%s' /var/lib/vdr/plugins/burn/menu-bg.png | sh diff --git a/plugins/image/imageplugin.sh b/plugins/image/imageplugin.sh new file mode 100644 index 0000000..ee19b89 --- /dev/null +++ b/plugins/image/imageplugin.sh @@ -0,0 +1,165 @@ +#!/bin/bash +# script for vdr-imageplugin to convert the selected image to pnm-image +# needs : netpbm-progs > anytopnm pnmscalefixed pnmfile pnmcut pnmflip +# +# History: +# 2005-07-26 add commando for rotate 180 +# 2005-07-18 wrong lookup for pnmscale and really are pnmscalefixed used +# 2004-08-12 Initalrelease, Andreas Brachold <anbr at users.berlios.de> +# base on prior work for convert.sh +# by Onno Kreuzinger <o.kreuzinger-at-kreuzinger.biz> +# Andreas Holzhammer and <Interpohl-at-vdr-portal.de> +# +################################################################################ +# Userconfig: +################################################################################ +# if your install external software like netpbm outside /bin:/usr/bin, adjust folder +PATH=/usr/local/bin:$PATH +# Set to "yes" to speedup reviewed image +TMPCACHE=no +# Set to "no" if this script work and your don't need success messages +VERBOSE=yes +# Set to "yes" if this script don't work, only usable if your self execute the script from shell +DEBUG=no + +################################################################################ +# and now the script +################################################################################ +[ "z$DEBUG" = "zyes" ] && set -xv +SCRIPTNAME=$(basename "$0") +{ +[ "z$VERBOSE" = "zyes" ] && echo "called '$SCRIPTNAME $*'" + +if [ $# -lt 7 ] ; then + echo "Usage: $SCRIPTNAME infile outfile WIDTH HEIGHT ZOOMFACTOR LEFTPOS TOPPOS [FLIPCMD]" 1>&2 + echo " e.g.: $SCRIPTNAME in.png out.pnm 720 576 0 0 0" 1>&2 + echo " or .: $SCRIPTNAME in.png out.pnm 720 576 3 360 360 left" 1>&2 + echo "" 1>&2 + echo "WIDTH - Width of TVScreen (720)" 1>&2 + echo "HEIGHT - Height of TVScreen (480..576)" 1>&2 + echo "ZOOMFACTOR - Zoomfactor (0....10)" 1>&2 + echo "LEFTPOS - Offset from left on Zoommode (0......)" 1>&2 + echo "TOPPOS - Offset from top on Zoommode (0......)" 1>&2 + echo "FLIPCMD - optional should image flip (left,right,rotated,original)" 1>&2 + exit 1 +fi + + # Defaultvalue, overwrite with env from plugin + ASPECT_RATIO="${ASPECT_RATIO:-"4:3"}" + + # check requirement external programs + REQUIREMENTS="anytopnm pnmscalefixed pnmfile pnmcut pnmflip" + for i in $REQUIREMENTS + do + type "$i" > /dev/null 2>&1 + [ $? -ne 0 ] && echo -e "$SCRIPTNAME: Error ! External required program: \"$i\" not found !\n Please adjust PATH or install it inside follow Folder \"$PATH\" \n" && exit 1 + done + + INFILE="$1" + OUTFILE="$2" + OUT_DISPLAY_X=$3 + OUT_DISPLAY_Y=$4 + ZOOMFACTOR=$5 + LEFTPOS=$6 + TOPPOS=$7 + FLIPCMD="$8" + + OUTDIR=$(dirname "$OUTFILE") + [ ! -d "$OUTDIR" ] && mkdir -p "$OUTDIR" + + TMPFILE="$OUTFILE.tmp" + PARFILE="$OUTFILE.par" + + # remove precreated files if called with flip "left","right" or "original" + [ -s "$OUTFILE" -a "$FLIPCMD" != "" ] && rm -f "$OUTFILE" + [ -s "$TMPFILE" -a "$FLIPCMD" != "" ] && rm -f "$TMPFILE" + + if [ -s "$OUTFILE" ] ; then + [ "z$VERBOSE" = "zyes" ] && echo "Success! Convert not required, $OUTFILE exists already ! " + exit 0 + else + + # Convert Image to PNM File + [ ! -s "$TMPFILE" ] && anytopnm "$INFILE" > "$TMPFILE" + # if success + if [ -s "$TMPFILE" ] ; then + + # Get image resolution + RES=`echo $( pnmfile < "$TMPFILE" -)` # checked with netpbm 10.0, + # Parse pnmfile output "-: PPM raw, 768 by 576 maxval 255" => 768 x 576 + X_RES=$(echo -e "$RES"| cut -d " " -f 4) + Y_RES=$(echo -e "$RES"| cut -d " " -f 6) + + # set flip command + case "$FLIPCMD" in + right ) + FLIP="pnmflip -rotate270" + SWAPRES=$X_RES;X_RES=$Y_RES;Y_RES=$SWAPRES + ;; + left ) + FLIP="pnmflip -rotate90"; + SWAPRES=$X_RES;X_RES=$Y_RES;Y_RES=$SWAPRES + ;; + rotated ) + FLIP="pnmflip -rotate180"; + ;; + *) + FLIP="cat"; + ;; + esac + # Save config for plugin as readable file + echo "$X_RES" "$Y_RES" "$FLIPCMD" > "$PARFILE" + + # define aspect ratio depends plugin setup + if [ $ASPECT_RATIO = "16:9" ] ; then + SCALE_MIN_ASP=163 + SCALE_MAX_ASP=178 + else + SCALE_MIN_ASP=125 + SCALE_MAX_ASP=133 + fi + + # if zoom image, zoom it with factor + if [ "$ZOOMFACTOR" -gt 0 ] ; then + + ZOOM_X=$(($X_RES*$ZOOMFACTOR)) + ZOOM_Y=$(($Y_RES*$ZOOMFACTOR)) + + $FLIP < "$TMPFILE" | pnmscalefixed -xysize $ZOOM_X $ZOOM_Y | \ + pnmcut -pad -left $LEFTPOS -top $TOPPOS -width $OUT_DISPLAY_X -height $OUT_DISPLAY_Y \ + > "$OUTFILE" + + # else scale image to TV Screensize + else + + if [ "$((${X_RES}00 / ${Y_RES}))" -lt $SCALE_MIN_ASP ] ; then + OUT_DISPLAY_X=$((${OUT_DISPLAY_Y}000 / $Y_RES * $X_RES / 1000)) + elif [ "$((${X_RES}00 / ${Y_RES}))" -gt $SCALE_MAX_ASP ] ; then + OUT_DISPLAY_Y=$((${OUT_DISPLAY_X}000 / $X_RES * $Y_RES / 1000)) + fi + + $FLIP < "$TMPFILE" | \ + pnmscalefixed -xysize $OUT_DISPLAY_X $OUT_DISPLAY_Y \ + > "$OUTFILE" + + fi + # if'nt tmpfile use for next view, remove tmp file + [ "z$TMPCACHE" = "zno" ] && rm -f "$TMPFILE" + fi + fi + + if [ -s "$OUTFILE" ] ; then + [ "z$VERBOSE" = "zyes" ] && echo "Success! Stopped with created $OUTFILE" + exit 0 # Creation seem success, tell it with 'exit 0' to plugin + fi + [ "z$VERBOSE" = "zyes" ] && echo "Error! Stopped without found created $OUTFILE, converting should failed ! " + exit 1 # Hmm, created is failed tell it with 'exit 1' to plugin + + +###### >>>>>>> !!! Only one of the follow lines are allowed (begins always with 2>&1 ) !!! +### Dump any message to syslog to see use cat /var/log/messages | grep imageplugin +} 2>&1 | logger -s -t "$SCRIPTNAME" +### If your wish don't any message logging +# 2>&1 > /dev/null +### If your wish old style message logging +# 2>&1 > /tmp/image/convert.log diff --git a/plugins/image/magickplugin.sh b/plugins/image/magickplugin.sh new file mode 100644 index 0000000..3f65899 --- /dev/null +++ b/plugins/image/magickplugin.sh @@ -0,0 +1,166 @@ +#!/bin/bash +# script for vdr-imageplugin to convert the selected image to pnm-image +# needs : imagemagick > identify convert +# +# History: +# 2005-08-19 better resolution retrieval (provided by kc_captain-at-vdr-portal de) +# 2005-07-26 add commando for rotate 180 +# 2005-07-18 Reimplement with imagemagick +# 2004-08-12 Initalrelease, Andreas Brachold <anbr at users.berlios.de> +# base on prior work for convert.sh +# by Onno Kreuzinger <o.kreuzinger-at-kreuzinger.biz> +# Andreas Holzhammer and <Interpohl-at-vdr-portal.de> +# +################################################################################ +# Userconfig: +################################################################################ +# if your install external software like netpbm outside /bin:/usr/bin, adjust folder +PATH=/usr/local/bin:$PATH +# Set to "no" if this script work and your don't need success messages +VERBOSE=yes +# Set to "yes" if this script don't work, only usable if your self execute the script from shell +DEBUG=no + +################################################################################ +# and now the script +################################################################################ +[ "z$DEBUG" = "zyes" ] && set -xv +SCRIPTNAME=$(basename "$0") +{ +[ "z$VERBOSE" = "zyes" ] && echo "called '$SCRIPTNAME $*'" + +if [ $# -lt 7 ] ; then + echo "Usage: $SCRIPTNAME infile outfile WIDTH HEIGHT ZOOMFACTOR LEFTPOS TOPPOS [FLIPCMD]" 1>&2 + echo " e.g.: $SCRIPTNAME in.png out.pnm 720 576 0 0 0" 1>&2 + echo " or .: $SCRIPTNAME in.png out.pnm 720 576 3 360 360 left" 1>&2 + echo "" 1>&2 + echo "WIDTH - Width of TVScreen (720)" 1>&2 + echo "HEIGHT - Height of TVScreen (480..576)" 1>&2 + echo "ZOOMFACTOR - Zoomfactor (0....10)" 1>&2 + echo "LEFTPOS - Offset from left on Zoommode (0......)" 1>&2 + echo "TOPPOS - Offset from top on Zoommode (0......)" 1>&2 + echo "FLIPCMD - optional should image flip (left,right,rotated,original)" 1>&2 + exit 1 +fi + + # Defaultvalue, overwrite with env from plugin + ASPECT_RATIO="${ASPECT_RATIO:-"4:3"}" + + # check requirement external programs + REQUIREMENTS="identify convert" + for i in $REQUIREMENTS + do + type "$i" > /dev/null 2>&1 + [ $? -ne 0 ] && echo -e "$SCRIPTNAME: Error ! External required program: \"$i\" not found !\n Please adjust PATH or install it inside follow Folder \"$PATH\" \n" && exit 1 + done + + INFILE="$1" + OUTFILE="$2" + OUT_DISPLAY_X=$3 + OUT_DISPLAY_Y=$4 + ZOOMFACTOR=$5 + LEFTPOS=$6 + TOPPOS=$7 + FLIPCMD="$8" + + OUTDIR=$(dirname "$OUTFILE") + [ ! -d "$OUTDIR" ] && mkdir -p "$OUTDIR" + + PARFILE="$OUTFILE.par" + + # remove precreated files if called with flip "left","right" or "original" + [ -s "$OUTFILE" -a "$FLIPCMD" != "" ] && rm -f "$OUTFILE" + + if [ -s "$OUTFILE" ] ; then + [ "z$VERBOSE" = "zyes" ] && echo "Success! Convert not required, $OUTFILE exists already ! " + exit 0 + else + + # Get image resolution + RES=`echo $( identify -format "%wx%h" "$INFILE" )` # checked with imagemagick 6.0.6 ... + # Parse identify output image.jpg JPEG 3456x2304 DirectClass 4.7mb 3.720u 0:04 + X_RES=$(echo -e "$RES"| cut -d "x" -f 1) + Y_RES=$(echo -e "$RES"| cut -d "x" -f 2) + + # set flip command + case "$FLIPCMD" in + right ) + FLIP="-rotate 270" + SWAPRES=$X_RES;X_RES=$Y_RES;Y_RES=$SWAPRES + ;; + left ) + FLIP="-rotate 90"; + SWAPRES=$X_RES;X_RES=$Y_RES;Y_RES=$SWAPRES + ;; + rotated ) + FLIP="-rotate 180"; + ;; + *) + FLIP=""; + ;; + esac + # Save config for plugin as readable file + echo "$X_RES" "$Y_RES" "$FLIPCMD" > "$PARFILE" + + # define aspect ratio depends plugin setup + if [ $ASPECT_RATIO = "16:9" ] ; then + SCALE_MIN_ASP=163 + SCALE_MAX_ASP=178 + else + SCALE_MIN_ASP=125 + SCALE_MAX_ASP=133 + fi + + # if zoom image, zoom it with factor + if [ "$ZOOMFACTOR" -gt 0 ] ; then + + ZOOM_X=$(($X_RES*$ZOOMFACTOR)) + ZOOM_Y=$(($Y_RES*$ZOOMFACTOR)) + + if [ "$LEFTPOS" -ge 0 ] ; then + LEFTPOS=$(echo -e "+$(($LEFTPOS))") + fi + if [ "$TOPPOS" -ge 0 ] ; then + TOPPOS=$(echo -e "+$(($TOPPOS))") + fi + + convert "$INFILE" \ + -size $(($ZOOM_X))x$(($ZOOM_Y)) \ + -crop $(($OUT_DISPLAY_X/$ZOOMFACTOR))x$(($OUT_DISPLAY_Y/$ZOOMFACTOR))$LEFTPOS$TOPPOS \ + $FLIP \ + -filter "Box" \ + -resize $(($OUT_DISPLAY_X))x$(($OUT_DISPLAY_Y)) \ + "$OUTFILE" + + # else scale image to TV Screensize + else + + if [ "$((${X_RES}00 / ${Y_RES}))" -lt $SCALE_MIN_ASP ] ; then + OUT_DISPLAY_X=$((${OUT_DISPLAY_Y}000 / $Y_RES * $X_RES / 1000)) + elif [ "$((${X_RES}00 / ${Y_RES}))" -gt $SCALE_MAX_ASP ] ; then + OUT_DISPLAY_Y=$((${OUT_DISPLAY_X}000 / $X_RES * $Y_RES / 1000)) + fi + + convert -size $(($OUT_DISPLAY_X))x$(($OUT_DISPLAY_Y)) "$INFILE" \ + $FLIP \ + -filter "Box" \ + -resize $(($OUT_DISPLAY_X))x$(($OUT_DISPLAY_Y)) \ + "$OUTFILE" + fi + fi + + if [ -s "$OUTFILE" ] ; then + [ "z$VERBOSE" = "zyes" ] && echo "Success! Stopped with created $OUTFILE" + exit 0 # Creation seem success, tell it with 'exit 0' to plugin + fi + [ "z$VERBOSE" = "zyes" ] && echo "Error! Stopped without found created $OUTFILE, converting should failed ! " + exit 1 # Hmm, created is failed tell it with 'exit 1' to plugin + + +###### >>>>>>> !!! Only one of the follow lines are allowed (begins always with 2>&1 ) !!! +### Dump any message to syslog to see use cat /var/log/messages | grep imageplugin +} 2>&1 | logger -s -t "$SCRIPTNAME" +### If your wish don't any message logging +# 2>&1 > /dev/null +### If your wish old style message logging +# 2>&1 > /tmp/image/convert.log diff --git a/plugins/image/patches/image-0.3.0_ffmpeg.diff b/plugins/image/patches/image-0.3.0_ffmpeg.diff new file mode 100644 index 0000000..da06627 --- /dev/null +++ b/plugins/image/patches/image-0.3.0_ffmpeg.diff @@ -0,0 +1,10 @@ +--- Makefile~ ++++ Makefile +@@ -80,6 +80,7 @@ + INCLUDES += -I$(VDRDIR)/include -I. + + ifdef FFMDIR ++INCLUDES += -I$(FFMDIR) -I$(FFMDIR)/libavcodec -I$(FFMDIR)/libavformat -I$(FFMDIR)/libswscale + DEFINES += -DFFMDIR + LIBS += -L$(FFMDIR)/libavcodec -lavcodec -lz + ifeq ($(LIBAVCODECVERSION),51) diff --git a/plugins/image/patches/image-0.3.0_plug-man.diff b/plugins/image/patches/image-0.3.0_plug-man.diff new file mode 100644 index 0000000..42c78ca --- /dev/null +++ b/plugins/image/patches/image-0.3.0_plug-man.diff @@ -0,0 +1,36 @@ +--- menu-image.c ++++ menu-image.c.patch +@@ -17,6 +17,7 @@ + #include <sys/ioctl.h> + #include <sys/types.h> + #include <unistd.h> ++#include <libgen.h> + #include <typeinfo> + + #include "image.h" +@@ -25,7 +26,7 @@ + #include "menu-image.h" + #include "control-image.h" + #include <vdr/i18n.h> +- ++#include <vdr/plugin.h> + #include <vdr/status.h> + + +@@ -79,6 +80,8 @@ + char *full = source->BuildName(name); + cDirItem *item = cMenuBrowse::GetSelected(); + if(item) { ++ // check, whether we can use a different plugin for replay ++ if(!cPluginManager::CallFirstService("ReplayDirectoryImages", dirname(full))) { + + //FIXME use a nonblocking way + //OSD_InfoMsg(tr("Building slide show...")); +@@ -96,6 +99,7 @@ + } + lastselect = NULL; + } ++ } + free(full); + free(name); + } diff --git a/plugins/image/plugin.sh b/plugins/image/plugin.sh new file mode 100644 index 0000000..523c47e --- /dev/null +++ b/plugins/image/plugin.sh @@ -0,0 +1,75 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 12.03.2009 +# +# vdr-image + +# defaults +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +WEB="http://www.zulu-entertainment.de/files/vdr-image/vdr-image-0.3.0.tar.gz" +VERSION="image-0.3.0" +LINK="image" + +VAR=`basename $WEB` +DIR=`pwd` + +# plugin entfernen +function clean_plugin() { + cd $SOURCEDIR/VDR/PLUGINS/src + rm -rf $LINK* + rm -f $VDRLIBDIR/libvdr-$LINK* + rm -f $VDRSCRIPTDIR/imageplugin.sh + rm -f $VDRSCRIPTDIR/magickplugin.sh + rm -f $VDRCONFDIR/imagecmds.conf + rm -f $VDRCONFDIR/imagesources.conf + log "cleaning $LINK" +} + +# plugin installieren +function install_plugin() { + download_plugin + extract_plugin + cd $SOURCEDIR/VDR/PLUGINS/src + rm -f $LINK + ln -vfs $VERSION $LINK + patch_plugin + + ## plugin specials - start ## + # scripte + cp -f $DIR/imageplugin.sh $VDRSCRIPTDIR + cp -f $DIR/magickplugin.sh $VDRSCRIPTDIR + chmod 0744 $VDRSCRIPTDIR/imageplugin.sh $VDRSCRIPTDIR/magickplugin.sh + # imagecmds.conf + cp -f $DIR/imagecmds.conf $VDRCONFDIR/plugins + # imagesources.conf + if [ -f $DIR/imagesources.conf ]; then + cp -f $DIR/imagesources.conf $VDRCONFDIR/plugins + else + { + echo "$PICTUREDIR;Fotos;0;*.jpg *.JPG" + echo "$VDRCONFDIR/plugins/burn;Hintergruende fuer Burn;0;*.png" + echo "/tmp;Screenshots;0;*.jpg *.JPG" + echo "/media/usb;USB-Stick;1;*.jpg *.JPG" + echo "" + } > $VDRCONFDIR/plugins/imagesources.conf + fi + + chown $VDRUSER:$VDRGROUP $VDRSCRIPTDIR/imageplugin.sh $VDRSCRIPTDIR/magickplugin.sh $VDRCONFDIR/plugins/imagecmds.conf $VDRCONFDIR/plugins/imagesources.conf + ## plugin specials - ende ## +} + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_plugin +else + install_plugin + log "install-plugin fuer $VERSION ist fertig" +fi + +exit 0 |
