changeset 0:9f4fa0bc1584 0.3

initial commit
author meillo@marmaro.de
date Thu, 22 Nov 2007 21:13:25 +0100
parents
children 0947e06af4c4
files .hgignore COPYRIGHT Makefile TODO debian/changelog debian/compat debian/control debian/copyright debian/docs debian/rules genwebgallery genwebgallery.1
diffstat 12 files changed, 560 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Thu Nov 22 21:13:25 2007 +0100
@@ -0,0 +1,6 @@
+syntax: glob
+*~
+*.swp
+
+Packages
+*.tar.gz
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/COPYRIGHT	Thu Nov 22 21:13:25 2007 +0100
@@ -0,0 +1,22 @@
+License: MIT License
+
+Copyright: 2007 by markus schnalke
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile	Thu Nov 22 21:13:25 2007 +0100
@@ -0,0 +1,63 @@
+# genwebgallery by meillo@marmaro.de
+
+
+NAME=genwebgallery
+VERSION = 0.3
+NV=${NAME}-${VERSION}
+ 
+# paths 
+PREFIX = /usr
+BINDIR = ${PREFIX}/bin
+MANDIR = ${PREFIX}/share/man
+
+all:
+	@echo usage: make [un]install
+
+build:
+	@echo build unneeded
+
+dist:
+	@mkdir ${NV}
+	@cp -f ${NAME} ${NAME}.1 Makefile TODO COPYRIGHT ${NV}
+	@tar -czhof ${NV}.tar.gz ${NV}
+	@rm -rf ${NV}
+
+install:
+	@echo installing executable file to ${DESTDIR}${BINDIR}
+	@mkdir -p ${DESTDIR}${BINDIR}
+	@cp -f ${NAME} ${DESTDIR}${BINDIR}
+	@chmod 755 ${DESTDIR}${BINDIR}/${NAME}
+	@echo installing manual page to ${DESTDIR}${MANDIR}/man1
+	@mkdir -p ${DESTDIR}${MANDIR}/man1
+	@sed 's/VERSION/${VERSION}/g' < ${NAME}.1 > ${DESTDIR}${MANDIR}/man1/${NAME}.1
+	@chmod 644 ${DESTDIR}${MANDIR}/man1/${NAME}.1
+
+uninstall:
+	@echo removing executable file from ${DESTDIR}${BINDIR}
+	@rm -f ${DESTDIR}${BINDIR}/${NAME}
+	@echo removing manual page from ${DESTDIR}${MANDIR}/man1
+	@rm -f ${DESTDIR}${MANDIR}/man1/${NAME}.1
+
+deb: dist
+	@mkdir -p Packages
+	@cp ${NV}.tar.gz Packages/
+	( \
+		cd Packages/ ;\
+		tar -xzf ${NV}.tar.gz ;\
+		mv ${NV}.tar.gz ${NAME}_${VERSION}.orig.tar.gz ;\
+		cd ${NV}/ ;\
+		cp -r ../../debian/ . ;\
+		debuild ;\
+	 )
+
+clean:
+	@echo clean unneeded
+
+distclean: clean
+	@rm -f ${NAME}-*.tar.gz
+
+debclean:
+	@cd Packages/${NV}/ ; debuild clean ;
+
+
+.PHONY: all clean build install uninstall
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TODO	Thu Nov 22 21:13:25 2007 +0100
@@ -0,0 +1,4 @@
+TODO:
+
+- security checks
+- navigation in pic pages
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/changelog	Thu Nov 22 21:13:25 2007 +0100
@@ -0,0 +1,40 @@
+genwebgallery (0.3-1) unstable; urgency=low
+
+  * new upstream release
+
+ -- markus schnalke <meillo@marmaro.de>  Thu, 22 Nov 2007 20:23:10 +0100
+
+
+genwebgallery (0.2-3) unstable; urgency=low
+
+  * fixed man page
+
+ -- markus schnalke <meillo@marmaro.de>  Thu, 22 Nov 2007 00:10:10 +0100
+
+
+genwebgallery (0.2-2) unstable; urgency=low
+
+  * minor fixes in code
+
+ -- markus schnalke <meillo@marmaro.de>  Wed, 21 Nov 2007 23:53:10 +0100
+
+
+genwebgallery (0.2-1) unstable; urgency=low
+
+  * new upstream release
+
+ -- markus schnalke <meillo@marmaro.de>  Wed, 21 Nov 2007 23:13:10 +0100
+
+
+genwebgallery (0.1-2) unstable; urgency=low
+
+  * improved packaging
+
+ -- markus schnalke <meillo@marmaro.de>  Wed, 21 Nov 2007 22:07:54 +0100
+
+
+genwebgallery (0.1-1) unstable; urgency=low
+
+  * Initial release
+
+ -- markus schnalke <meillo@marmaro.de>  Tue, 20 Nov 2007 23:09:23 +0100
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/compat	Thu Nov 22 21:13:25 2007 +0100
@@ -0,0 +1,1 @@
+5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/control	Thu Nov 22 21:13:25 2007 +0100
@@ -0,0 +1,16 @@
+Source: genwebgallery
+Section: web
+Priority: extra
+Maintainer: markus schnalke <meillo@marmaro.de>
+Build-Depends: debhelper (>= 5)
+Standards-Version: 3.7.2
+
+Package: genwebgallery
+Architecture: all
+Depends: ${shlibs:Depends}, ${misc:Depends}, imagemagick
+Description: generates a web gallery with static html
+ *** unofficial package from meillo@marmaro.de ***
+ .
+ Very simple tool to generate static html pages to view pictures on the web.
+ .
+ Homepage: http://prog.marmaro.de
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/copyright	Thu Nov 22 21:13:25 2007 +0100
@@ -0,0 +1,33 @@
+This package was debianized by markus schnalke <meillo@marmaro.de> on
+Thu, 22 Nov 2007 20:24:08 +0100.
+
+It was downloaded from http://prog.marmaro.de
+
+Upstream Author: markus schnalke <meillo@marmaro.de>
+
+Copyright: 2007 by markus schnalke
+
+License: MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+The Debian packaging is (C) 2007, markus schnalke <meillo@marmaro.de> and
+is licensed under the GPL, see `/usr/share/common-licenses/GPL'.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/docs	Thu Nov 22 21:13:25 2007 +0100
@@ -0,0 +1,2 @@
+TODO
+COPYRIGHT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/rules	Thu Nov 22 21:13:25 2007 +0100
@@ -0,0 +1,98 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+	CFLAGS += -O0
+else
+	CFLAGS += -O2
+endif
+
+configure: configure-stamp
+configure-stamp:
+	dh_testdir
+	# Add here commands to configure the package.
+
+	touch configure-stamp
+
+
+build: build-stamp
+
+build-stamp: configure-stamp 
+	dh_testdir
+
+	# Add here commands to compile the package.
+	$(MAKE)
+	#docbook-to-man debian/genwebgallery.sgml > genwebgallery.1
+
+	touch $@
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+
+	# Add here commands to clean up after the build process.
+	-$(MAKE) clean
+
+	dh_clean 
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k 
+	dh_installdirs
+
+	# Add here commands to install the package into debian/genwebgallery.
+	$(MAKE) DESTDIR=$(CURDIR)/debian/genwebgallery install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs 
+	dh_installdocs
+	dh_installexamples
+#	dh_install
+#	dh_installmenu
+#	dh_installdebconf	
+#	dh_installlogrotate
+#	dh_installemacsen
+#	dh_installpam
+#	dh_installmime
+#	dh_python
+#	dh_installinit
+#	dh_installcron
+#	dh_installinfo
+	dh_installman
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+#	dh_perl
+#	dh_makeshlibs
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+# Build architecture-dependent files here.
+binary-arch: build install
+# We have nothing to do by default.
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/genwebgallery	Thu Nov 22 21:13:25 2007 +0100
@@ -0,0 +1,208 @@
+#!/bin/sh
+#
+# generates a web gallery of static web pages
+# requires: ImageMagick (convert)
+#
+# meillo@marmaro.de
+#
+
+
+targetDir="web"
+index="index.htm"
+sizePic=640
+sizeThumb=200
+galleryTitle="gallery title"
+copyright="please mind the copyright"
+
+verbose=""
+
+
+function checkCreateDir() {
+	if [ -d "$targetDir" ] ; then
+		echo "Target dir '$targetDir' already exists."
+		echo -n "remove it? [y/n] "
+
+		read remove
+		if [ $remove = "y" ] ; then
+			rm -r "$targetDir"
+			echo "removing '$targetDir' ..."
+		else
+			exit 1
+		fi
+	fi
+	mkdir -p "$targetDir"
+}
+
+
+
+function insertHeader() {
+  echo <<EOF
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<title>$titleName</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta name="Generator" content="genwebgallery - see http://prog.marmaro.de" />
+</head>
+<body>
+
+EOF
+}
+
+
+function insertFooter() {
+	echo <<EOF
+
+</body>
+</html>
+EOF
+}
+
+
+function log() {
+	if [ $verbose ] ; then
+		echo "$1";
+	fi
+}
+
+
+function checkConvert() {
+	log "checking convert installation"
+	(convert -version) 2> /dev/null > /dev/null
+	if [ $? -ne 0 ] ; then
+		echo "Error: Can not find 'convert' (package imagemagick)"
+		echo "ABORT!"
+		exit 2
+	fi
+	log "`convert -version`"
+}
+
+
+####
+
+
+
+if [ $# -eq 0 ] ; then
+	echo "usage: `basename $0` [OPTIONS] FILES"
+	exit 0
+fi
+
+
+while [  "$#" -ge 1  -a  "${1:0:1}" = '-'  ] ; do
+	case $1 in
+		'--version')
+			echo "genwebgallery version 0.3"
+			exit 0
+			;;
+		'--help')
+			echo "`basename $0`
+
+generates a web gallery consisting of html pages
+
+usage: `basename $0` [OPTIONS] FILES
+
+options:
+	--version: echo program version
+	--help: display this output
+	-v: be verbose
+	-o DIR: all generated content is copied to this folder
+	-i FILE: the name of the index file (index.htm)
+	-t TITLE: title of the gallery
+	-c COPYRIGHT: a copyright notice
+	-ps PIXELS: size of the pics
+	-ts PIXELS: size of the thumbnails
+
+author: meillo@marmaro.de
+homepage: http://prog.marmaro.de
+"
+			exit 0
+			;;
+		'-v' | '--verbose')
+			verbose=1
+			shift
+			;;
+		'-o' | '--output')
+			targetDir=$2
+			shift
+			shift
+			;;
+		'-i' | '--index')
+			index=$2
+			shift
+			shift
+			;;
+		'-t' | '--title')
+			galleryTitle=$2
+			shift
+			shift
+			;;
+		'-c' | '--copyright')
+			copyright=$2
+			shift
+			shift
+			;;
+		'-ps' | '--pic-size')
+			sizePic=$2
+			shift
+			shift
+			;;
+		'-ts' | '--thumb-size')
+			sizeThumb=$2
+			shift
+			shift
+			;;
+		*)
+			echo "invalid option: $1"
+			echo "see: `basename $0` --help"
+			exit 1
+	esac
+
+done
+
+if [ $# -eq 0 ] ; then
+	echo "usage: `basename $0` [OPTIONS] FILES"
+	exit 0
+fi
+
+
+# verbose output
+log "verbose on"
+log "output dir is: $targetDir"
+log "index file is: $index"
+log "gallery title is: $galleryTitle"
+log "copyright notice is: $copyright"
+log "picture size is: $sizePic"
+log "thumbnail size is: $sizeThumb"
+checkConvert
+log ""
+
+
+checkCreateDir
+
+insertHeader > "$targetDir/$index"
+echo "<h1>$galleryTitle</h1>" >> "$targetDir/$index"
+
+for i in "$@" ; do
+	file=`basename $i`
+	targetFile="$targetDir/$file.htm"
+	log "processing file: $file"
+
+	# generate pic page
+	insertHeader > "$targetFile"
+	echo "<h1>$galleryTitle</h1>" \
+	     "<p><a href=\"$index\"><img src=\"$file\" alt=\"$file\" /></a></p>" \
+	     "<p>$copyright</p>" >> "$targetFile"
+	insertFooter >> "$targetFile"
+
+	# copy and resize pics
+	convert "$i" -resize ${sizePic}x${sizePic} "$targetDir/$file"
+	convert "$i" -resize ${sizeThumb}x${sizeThumb} "$targetDir/_$file"
+
+	# generate content for index file
+	echo "    <a href=\"$file.htm\"><img src=\"_$file\" alt=\"$file\" /></a>" >> "$targetDir/$index"
+done
+
+echo "<p>$copyright</p>" >> "$targetDir/$index"
+insertFooter >> "$targetDir/$index"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/genwebgallery.1	Thu Nov 22 21:13:25 2007 +0100
@@ -0,0 +1,67 @@
+.TH GENWEBGALLERY 1 "genwebgallery-VERSION" "2007-11-21" "genwebgallery"
+
+.SH NAME
+genwebgallery
+
+.SH SYNOPSIS
+.B genwebgallery FILES
+
+.SH DESCRIPTION
+.B genwebgallery
+generates a web gallery of mentioned pictures.
+.PP
+Only static HTML pages are generated.
+.PP
+The
+.BR convert
+tool from ImageMagick is required.
+
+.SH OPTIONS
+.B genwebgallery
+.TP
+.B \-\-help
+Show summary of options.
+.TP
+.B \-\-version
+Show version of program
+.TP
+.B \-v, \-\-verbose
+Outputs more log data
+.TP
+.B \-o, \-\-output
+Specify output directory
+.TP
+.B \-i, \-\-index
+Specify index file (index.htm)
+.TP
+.B \-t, \-\-title
+Specify title of gallery
+.TP
+.B \-c, \-\-copyright
+Specify copyright notice
+.TP
+.B \-ps, \-\-pic-size
+Specify size of picture
+.TP
+.B \-ts, \-\-thumb-size
+Specify size of thumbnails
+
+.SH EXIT CODE
+.TP
+.B 1
+Any other error
+.TP
+.B 2
+The required program
+.B convert
+could not be found. It's probably not installed.
+Normally it is provided by the ImageMagick tool collection.
+
+.SH SEE ALSO
+.BR convert (1),
+.BR ImageMagick (1).
+
+.SH AUTHOR
+genwebgallery was written by markus schnalke <meillo@marmaro.de>
+.PP
+Website: http://prog.marmaro.de