Subversion Repositories pub

Compare Revisions

Ignore whitespace Rev 431 → Rev 432

/video-contact-sheet/trunk/pkg/vcs
31,7 → 31,7
# The full changelog can be found at <http://p.outlyer.net/vcs/files/CHANGELOG>
 
 
declare -r VERSION="1.12.1"
declare -r VERSION="1.12.2"
declare -r RELEASE=1
 
set -e
83,7 → 83,8
# - INTERNAL_*: Used internally to adapt messages and the like to the input
# - UNDFLAG_*: Undocumented flags. Used internally to keep track of undocumented modes (-Z)
# - USR_*: Holds values of variables as set by the user, either from overrides or from the
# command-line
# command-line.
# implementation
# * Optimisations:
# - Reduce the number of forks
# }}} # TO-DO
124,8 → 125,6
declare -ri DEFAULT_EXT_FACTOR=4
# see $verbosity
declare -ri V_ALL=5 V_NONE=-1 V_ERROR=1 V_WARN=2 V_INFO=3
# see $font_filename
declare -ri FF_DEFAULT=5 FF_NONLATIN=7
# Indexes in $VID
declare -ri W=0 H=1 FPS=2 LEN=3 VCODEC=4 ACODEC=5 VDEC=6 CHANS=7 ASPECT=8 VCNAME=9 ACNAME=10
# Exit codes, same numbers as /usr/include/sysexits.h
182,15 → 181,6
declare font_tstamps=DejaVu-Sans-Book # Used for timestamps over the thumbnails
declare font_heading=DejaVu-Sans-Book # Used for the meta info heading
declare font_sign=$font_heading # Used for the signature box
# Unlike other font_ variables this doesn't take a font name directly
# but is restricted to the $FF_ values. This is to allow overrides
# from the command line to be placed anywhere, i.e. in
# $ vcs -I file.avi -O 'FONT_MINCHO=whatever'
# as the font is overridden is after requesting its use, it wouldn't be
# affected
# The other font_ variables are only affected by overrides and not command
# line options that's why this one is special.
declare font_filename=$FF_DEFAULT # Used to print only the filename in the heading
declare font_title=$font_heading # Used for the title (see -T)
# Font sizes, in points
declare -i pts_tstamps=14 # Used for the timestamps
237,6 → 227,11
# The automatic picks a semi-random one from the fonts believed to support CJK/Cyrillic
#+characters.
declare FONT_MINCHO= # Filename or font name as known to ImageMagick (identify -list font)
# Introduced in 1.12.2:
# When true (1) uses $FONT_MINCHO to print the filename, otherwise the same
#+font as the heading is used.
# See -I and --nonlatin
declare -i NONLATIN_FILENAMES=0
# Output of capturing programs is redirected here
declare stdout=/dev/null stderr=/dev/null
 
413,6 → 408,8
#+ believed to be no longer needed
#+ "gone": Variable removed in the current version
#+ "alias": Marks an alias, duplicate name intended to stay
#+ "meta": Special variable that will modify other variables (e.g. font_all
#+ modifies all font_ variables.
#+ "=": ignore
#+ type constraints: a character indicating accepted values:
# n -> Number (Natural, positive Integer)
458,6 → 455,9
"font_sign::"
"font_tstamps::"
"font_title::"
"font_all:=:meta" # see parse_override
"bg_all:=:meta"
"fg_all:=:meta"
"pts_tstamps::"
"pts_meta::"
"pts_sign::"
506,6 → 506,7
 
"nonlatin_font:FONT_MINCHO:"
"FONT_MINCHO::deprecated=nonlatin_font"
"NONLATIN_FILENAMES:=:=:b"
 
"end_offset:=:=:I" # New, used to have a two-variables assignment before USR_*
"DEFAULT_END_OFFSET:end_offset:deprecated=end_offset:I"
544,13 → 545,11
varname=${por/% *} # Everything up to the first space...
tmp=${por#* } # Rest of string
flag=${tmp/% *}
bashcode=${tmp#* }
if [ "$flag" == '=' ]; then
# No need to override...
feedback="$varname(=)"
else
feedback=$varname
eval "$bashcode"
fi
ov="$ov, $feedback"
fi
670,15 → 669,13
return 0
}
 
# Parse an override
# Input should be a var=value assignment, result, stored in the global variable $RESULT,
# will be in the format:
# <variable name> <flag> <evaluable code> where
# Parse an override and set its value.
# Input should be a var=value assignment. Also sets USR_<variable>.
# The global variable $RESULT is set with the format:
# <variable name> <flag> where
# * variable name: is the name of the variable to be overridden
# * flag: is a character indicating the status: "+" for a possible override,
# "=" for an override that already has the same value
# * evaluable code: is a piece of bash code to be feed to eval to change
# the variable, it also sets the related USR_* variable
# Warnings and errors are buffered
# This function always returns true
# parse_override($1 = override assignment)
685,7 → 682,7
parse_override() {
local o="$1"
RESULT=''
 
if ! egrep -q '^[[:space:]]*[a-zA-Z_][a-zA-Z0-9_]*[[:space:]]*=.*' <<<"$o" ; then
return
fi
737,6 → 734,11
buffered error "Variable '$varname' is scheduled to be removed in the next release."
buffered error " Please contact the author if you absolutely need it."
;;
meta)
apply_meta_override "$varname" "$varval"
RESULT="$varname +"
return 0;
;;
*) return 0 ;;
esac
fi
757,12 → 759,43
# Escape single quotes, since it will be single-quoted:
varval=${varval//\'/\'\\\'\'} # <<'>> => <<'\''>>
evcode="$ivar='$varval'; USR_$ivar='$varval'"
eval "$evcode"
fi
 
# varname, as found in the config file
RESULT="$varname $retflag $evcode"
RESULT="$varname $retflag"
}
 
# Handle meta configuration variables, variables that, when set, modify the
# value of (various) others
# apply_meta_override($1 = actual variable name, $2 = value)
apply_meta_override() {
case "$1" in
font_all)
buffered inf "font_all => font_heading, font_sign, font_title, font_tstamps"
parse_override "font_heading=$2"
parse_override "font_sign=$2"
parse_override "font_title=$2"
parse_override "font_tstamps=$2"
;;
fg_all)
buffered inf "fg_all => fg_heading, fg_sign, fg_title, fg_tstamps"
parse_override "fg_heading=$2"
parse_override "fg_sign=$2"
parse_override "fg_tstamps=$2"
parse_override "fg_title=$2"
;;
bg_all)
buffered inf "bg_all => bg_heading, bg_contact, bg_sign, bg_title, bg_tstamps"
parse_override "bg_heading=$2"
parse_override "bg_contact=$2"
parse_override "bg_sign=$2"
parse_override "bg_title=$2"
parse_override "bg_tstamps=$2"
;;
esac
}
 
# Do an override from the command line
# cmdline_override($1 = override assignment)
#+e.g. cmdline_override 'decoder=$DEC_FFMPEG'
774,12 → 807,9
local varname=${r/% *} # See load_config()
local tmp=${r#* }
local flag=${tmp/% *}
local bashcode=${tmp#* }
 
if [ "$flag" == '=' ]; then
varname="$varname(=)"
else
eval "$bashcode"
fi
 
CMDLINE_OVERRIDES="$CMDLINE_OVERRIDES, $varname"
1447,7 → 1477,7
cleanup() {
if [ -z $TEMPSTUFF ]; then return 0 ; fi
inf "Cleaning up..."
rm -rf "${TEMPSTUFF[*]}"
rm -rf "${TEMPSTUFF[@]}"
unset VCSTEMPDIR
unset TEMPSTUFF ; declare -a TEMPSTUFF
}
2341,6 → 2371,7
theo) vcodec="Ogg Theora" ;;
tscc) vcodec="TechSmith SCC" ;;
VP6[012F]) vcodec="On2 Truemotion VP6" ;;
VP80) vcodec="VP8" ;;
WMV1) vcodec="WMV7" ;;
WMV2) vcodec="WMV8" ;;
WMV3) vcodec="WMV9" ;;
2394,6 → 2425,7
theora) mpid="theo" ;;
camtasia) mpid="tscc" ;;
vp6|vp6a|vp6f) mpid="VP60" ;;
vp8) mpid="VP80" ;;
# FIXME List of codec id's I translate but haven't test:
# svq3, rv40, theora, camtasia, vp6*
# MPlayer uses uppercase while FFmpeg uses lowercase
2901,7 → 2933,8
}
 
# Checks if the provided arguments make sense and are allowed to be used
# together
#+together. When an incoherence is found, sets some sane values if reasonable
#+or fails otherwise.
coherence_check() {
trace $FUNCNAME $@
# If -m is used then -S must be used
2987,6 → 3020,17
# Interval=0 == default interval
fptest "$interval" -eq 0 && interval=$DEFAULT_INTERVAL
 
# If in non-latin mode and no nonlatin font has been picked try to pick one.
# Should it fail, fallback to latin font.
if [ $NONLATIN_FILENAMES -eq 1 ] && [ -z "$FONT_MINCHO" ]; then
set_extended_font || {
# set_extended_font already warns about lack of fonts
warn " Falling back to latin font"
NONLATIN_FILENAMES=0
FONT_MINCHO="$font_heading"
}
fi
 
sanitise_rename_pattern
sanitise_fonts
}
2995,6 → 3039,7
#+*only* for fonts not overridden
sanitise_fonts() {
trace $FUNCNAME $@
 
# Any default font in use? If all of them are overridden, return
if [ "$USR_font_heading" -a "$USR_font_title" -a "$USR_font_tstamps" -a "$USR_font_sign" ]; then
return
3385,15 → 3430,12
"$output" -append "$output"
unset tlheight
fi
local fn_font= # see $font_filename
case $font_filename in
$FF_DEFAULT) fn_font="$font_heading" ;;
$FF_NONLATIN) fn_font="$FONT_MINCHO" ;;
*)
warn "\$font_filename was overridden with an incorrect value, using default."
fn_font="$font_heading"
;;
esac
local fn_font= # see $NONLATIN_FILENAMES
if [ $NONLATIN_FILENAMES -ne 1 ]; then
fn_font="$font_heading"
else
fn_font="$FONT_MINCHO"
fi
# Create a small image to see how tall are characters. In my tests, no matter
#+which character is used it's always the same height.
local lineheight=$(line_height "$font_heading" "$pts_meta")
3902,7 → 3944,8
esac # verbosity
;;
esac
echo "$f=$v"
# Print all names in lowercase
echo "$(tolower "$f")=$v"
}
done
echo "# vcs:conf:$NL# Generated on $(date)$NL# --- $n ENDS HERE --- "
4106,7 → 4149,8
# Unlike -I, --nonlatin does not accept a font name
--nonlatin)
if [ -z "$USR_FONT_MINCHO" ]; then
font_filename=$FF_NONLATIN
NONLATIN_FILENAMES=1
USR_NONLATIN_FILENAMES=1
set_extended_font
inf "Filename font set to '$FONT_MINCHO'"
fi
4126,7 → 4170,8
fi
# It isn't tested for existence because it could also be a font
# which convert would understand without giving the full path
font_filename=$FF_NONLATIN
NONLATIN_FILENAMES=1
USR_NONLATIN_FILENAMES=1
if [ ${#2} -gt 1 ]; then
# j=, k= syntax
FONT_MINCHO="${2:2}"
4428,7 → 4473,7
t=${ovname#*:}
if [ "$t" -a "$t" != "=" ]; then f="$t" ; fi
eval v=\$USR_$f
[ -z "$v" ] || echo "$f=$v"
[ -z "$v" ] || echo "$(tolower $f)=$v"
done
exit 0
;;
/video-contact-sheet/trunk/pkg/common.mk
15,6 → 15,8
DESTDIR:=/
TGZ=vcs-$(VERSION).tar.gz
 
MANDIR:=$(prefix)/share/man/man1/
 
all:
# Nothing to be done
 
28,14 → 30,18
install -m755 vcs $(DESTDIR)$(prefix)/bin/vcs
install -d $(DESTDIR)$(prefix)/share/vcs/profiles
install -m644 profiles/*.conf $(DESTDIR)$(prefix)/share/vcs/profiles/
install -d $(DESTDIR)$(MANDIR)
install -m644 vcs.1 $(DESTDIR)$(MANDIR)/
 
uninstall:
$(RM) $(DESTDIR)$(prefix)/bin/vcs
$(RM) $(DESTDIR)$(MANDIR)/vcs.1
for file in profiles/*.conf ; do \
$(RM) $(DESTDIR)$(prefix)/share/vcs/profiles/`basename $$file` ; \
done
-rmdir -p $(DESTDIR)$(prefix)/bin
-rmdir -p $(DESTDIR)$(prefix)/share/vcs/profiles
-rmdir -p $(DESTDIR)$(MANDIR)
 
examples/vcs.conf.example: examples/vcs.conf
sed -e 's/^/#/;s/^#$$//;s/^##/#/' < $< > $@
/video-contact-sheet/trunk/pkg/rpm/vcs.spec.in
95,12 → 95,15
%{prefix}/share/vcs/profiles/mosaic.conf
%{prefix}/share/vcs/profiles/white.conf
# Manpage
#%{_mandir}/man1/%{name}.1.gz
%{_mandir}/man1/%{name}.1.gz
%doc CHANGELOG
# Config example
%doc examples/vcs.conf.example
 
%changelog
* Tue Aug 24 2010 - outlyer (at) gmail (dot) com
- Install manpage
 
* Sat Apr 10 2010 - outlyer (at) gmail (dot) com
- Added profiles and example configuration
- Use %{prefix}
/video-contact-sheet/trunk/pkg/debian/changelog
1,3 → 1,9
vcs (1.12.2-upstream.1) experimental; urgency=medium
 
* New version. Medium priority due to temporary files cleanup bug.
 
-- Toni Corvera <outlyer@gmail.com> Tue, 24 Aug 2010 20:48:41 +0200
 
vcs (1.12.1-upstream.1) experimental; urgency=medium
 
* New version.
/video-contact-sheet/trunk/pkg/debian/rules
81,7 → 81,7
# dh_installinit
# dh_installcron
# dh_installinfo
dh_installman
dh_installman vcs.1
dh_link
dh_strip
dh_compress
/video-contact-sheet/trunk/pkg/profiles/mosaic.conf
1,6 → 1,7
# vcs:conf:
# vcs:desc: Tight, small, thumbnails
# <http://p.outlyer.net/dox/vcs:example_configs>
# $Id$
disable_timestamps=1
disable_shadows=1
height=160
/video-contact-sheet/trunk/pkg/profiles/black.conf
1,5 → 1,6
# vcs:conf:
# vcs:desc: White-on-Black
# $Id$
bg_contact=Black
bg_heading=$bg_contact
bg_sign=$bg_contact
/video-contact-sheet/trunk/pkg/profiles/white.conf
1,5 → 1,6
# vcs:conf:
# vcs:desc: Black-on-White profile
# $Id$
bg_contact=White
bg_heading=$bg_contact
bg_sign=$bg_contact
/video-contact-sheet/trunk/pkg/CHANGELOG
1,7 → 1,18
1.12.1:
1.12.2 (2010-08-24):
* BUGFIX: Fix cleanup of temporary files (regression since 1.11.2). [#167]
Submitted by Jason Tackaberry.
* FEATURES:
- Added 'fg_all', 'bg_all' and 'font_all' config variables. [#156]
- Added 'nonlatin_filenames' config variable. [#159]
- Added identification for VP8 (WebM). [#166]
* OTHER:
- Print variable names in lowercase when using --generate.
 
1.12.1 (2010-04-23):
* BUGFIXES:
- Workaround for cases in which GAWK uses comma as decimal separator.
Any OS with GAWK 3.1.3 to 3.1.5 was affected (e.g. Debian Lenny)
Any OS with GAWK 3.1.3 to 3.1.5 was affected (where the environment
language uses commas, e.g. Debian Lenny with many European languages)
- Don't try to go on in DVD mode with unreadable ISOs
 
1.12: (2010-04-10)