1
by David D Lowe
Inital release. |
1 |
#!/bin/bash
|
2 |
#
|
|
3 |
# Copyright 2007 Erlend Davidson <Erlend.Davidson@gmail.com>
|
|
4 |
#
|
|
5 |
# This program is free software; you can redistribute it and/or modify
|
|
6 |
# it under the terms of the GNU General Public License as published by
|
|
7 |
# the Free Software Foundation; either version 2 of the License, or
|
|
8 |
# (at your option) any later version.
|
|
9 |
#
|
|
10 |
# This program is distributed in the hope that it will be useful,
|
|
11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
# GNU Library General Public License for more details.
|
|
14 |
#
|
|
15 |
# You should have received a copy of the GNU General Public License
|
|
16 |
# along with this program; if not, write to the Free Software
|
|
17 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
18 |
#
|
|
19 |
# modified by David D Lowe <DavidDLowe.flimm@gmail.com>, all his changes are released
|
|
20 |
# into the public domain http://creativecommons.org/licenses/publicdomain/
|
|
21 |
#
|
|
22 |
# ooo-thumbnailer
|
|
23 |
# usage:
|
|
24 |
# ooo-thumbnailer file outfile
|
|
25 |
||
26 |
# command line parameters
|
|
27 |
ifile=$1 |
|
28 |
ofile=$2 |
|
29 |
size=$3 |
|
30 |
||
31 |
test -f ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs && source ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs |
|
32 |
||
33 |
if [ `dirname $ifile` != ${XDG_TEMPLATES_DIR:-$HOME/Templates} ]; then |
|
34 |
if [ -e /usr/bin/convert ]; then |
|
35 |
unzip -p "$ifile" Thumbnails/thumbnail.png | convert - +matte "png:$ofile" #-scale "$sizex$size" |
|
36 |
else
|
|
37 |
cache=${XDG_CACHE_HOME:-$HOME/.cache} |
|
38 |
mkdir -p "$cache" |
|
39 |
unzip "$ifile" Thumbnails/thumbnail.png -d "${cache}" |
|
40 |
totem-gstreamer-video-thumbnailer "${cache}/Thumbnails/thumbnail.png" "$ofile" -s $size |
|
41 |
fi
|
|
42 |
# uncomment the following line to include the OpenOffice.org logo in the thumbnail, requires imagemagick
|
|
43 |
#composite -gravity SouthEast /usr/share/icons/hicolor/48x48/mimetypes/openofficeorg3-oasis-text.png "$ofile" "$ofile"
|
|
44 |
fi
|