[bglug] Comix Viewer

k|b|s kbs@bglug.it
Ven 17 Lug 2009 18:26:30 CEST


On Fri, Jul 17, 2009 at 06:13:40PM +0200, Alessandro Lorenzi wrote:
> ah ecco.. estrae e poi apre qiv :)
Con questo vedi anche i pdf ;)

--8<-- CUT HERE --8<-- 
#!/bin/bash
# cbview
# Using qiv to view comic books or compressed image archives
# Time-stamp: <cbview,  17/7/2009 18:23:45 joe Exp>
# Joe Galaxy fecit MMIX

# OPTIONS
# Erase temp dir? (yes|no)
tmperase="yes"
# qiv extra options
# example "-s -d 5" 
# make a slideshow with delay of 5 sec
# man qiv for more
qivextra="-s -d 5"
# qiv default
qivdefault="-fm"

### Let's go ###
TNAME="`echo "$1" |tr ' ' '_' | tr -d '[{}(),\!#^]' | tr -d "\'" | tr '[A-Z]' '[a-z]' | sed 's/_-_/_/g'`"
NAME=`basename ${TNAME%.[^.]*}`

TMP="/tmp/cbview/"$NAME""
if [ ! -d $TMP ]; then
 mkdir -p $TMP
fi

gz="gunzip"
bz="bunzip2"
zip="unzip -qo"
rar="unrar x -id -y"
tar="tar xf"
z7="7z e"

if [ $# -eq 0 ]; then
    echo "Usage: cbview file">&2
    exit 1
fi

for name
do
	if [ ! -f "$name" ] ; then
		echo "$0: file $name not found." >&2
		continue
	fi

	if [ "$(echo $name | egrep '(\.gz$|\.bz2$|\.zip$|\.rar$|\.tar$|\.tgz$|\.7z$|\.cbz$|\.cbr$|\.pdf$)')" = "" ] ; then
		echo "$0: file $name is not a valid archive" 
      		continue
	fi

	extension=${name##*.}

	case "$extension" in
		gz ) $gz "$name" $TMP
		      ;;
		bz2 ) $bz "$name" $TMP
		      ;;
		zip|cbz ) $zip -j -d $TMP "$name"
		      ;;
		rar|cbr ) $rar "$name" $TMP
		      ;;
		tar|tgz ) $tar "$name" -C "$TMP"
                      ;;
        7z ) $z7 -o $TMP "$name"
			  ;;
	    pdf ) convert "$name" $TMP/image-%02d.jpg
		      ;;
	esac

done

qiv -u $qivdefault $qivextra $TMP

if [ $tmperase = "yes" ]; then
#rm -rf $TMP
rm -rf /tmp/cbview
else

exit 0
fi
--8<-- CUT HERE --8<--

> é noioso quotare decentemente xD
Perchè non usate un editor vero.
Passa a mutt.

-- 
★ ميكائيل ★



Maggiori informazioni sulla lista bglug