Compare commits

...

2 Commits

Author SHA1 Message Date
c138a278e2 better defaults generation...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2024-07-21 15:26:04 +03:00
1598873ff9 added naimation generator helper...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2024-07-21 14:28:19 +03:00
2 changed files with 144 additions and 0 deletions

90
misc/scripts/getpsdpaths Executable file
View File

@ -0,0 +1,90 @@
#!/bin/bash
# config...
MNT_PATH=/run/media/f_lynx/
ARCHIVE_PATTERN=*-P-*
EXT=psd
# this is here to avoid using windows find in some contexts...
FIND=/bin/find
printhelp () {
echo "Find source images"
echo "format:"
echo " $1 [ARGS] JPGS"
echo
echo "supported commands:"
echo " -h|--help - print this message."
echo " -e|--ext EXT - target extension (Default: $EXT)."
}
if [[ $1 == "" ]] ; then
echo Error: need a list of files to process...
exit 1
fi
# handle args...
while true; do
if [ -z $1 ]; then
break
fi
case $1 in
-h|--help)
printhelp
exit
;;
-e|--ext)
shift
EXT=$1
shift
;;
*)
break
;;
esac
done
# build pattern...
# clear the duplicate suffix...
PATTERN="${1//n/n?}"
PATTERN="${PATTERN/.jpg/}"
shift
while [[ "$1" != "" ]] ; do
# clear the duplicate suffix...
P="${1//n/n?}"
P="${1/-[0-9]/}"
P="${P/.jpg/}"
# grow the pattern...
PATTERN="$PATTERN\|$P"
shift
done
PATTERN=".*/\($PATTERN\)\.$EXT"
#echo $PATTERN 1>&2
#echo $PATTERN > .pattern
# do the actual find...
cd "$MNT_PATH"
for a in $ARCHIVE_PATTERN ; do
cd "$a"
if [[ $? != 0 ]] ; then
# can't cd -- unmounted dir...
echo Skipping unmounted: $a... 1>&2
continue
fi
echo Searching: $a... 1>&2
# find the files...
$FIND . -iregex "$PATTERN" \
-exec realpath \{\} \;
##for i in `$FIND . -iregex "$PATTERN"` ; do
## echo Found: `basename "$i"` 1>&2
## echo `cygpath -aw "$i"`
##done
cd ..
done
# vim:set sw=4 ts=4 :

54
misc/scripts/jpg2anim Executable file
View File

@ -0,0 +1,54 @@
#!/usr/bin/env bash
# XXX add help...
# XXX add better options...
FPS=${FPS:-8}
if [ $1 == "-r" ] ; then
FPS=$2
shift 2
fi
PATTERN=${PATTERN:-'*.jpg'}
# generate name...
LST=($PATTERN)
A=${LST[0]}
A=${A%.jpg}
B=${LST[$(( ${#LST[@]} - 1 ))]}
B=${B%.jpg}
NAME=${NAME:-${A}-${B}}
PALETTE=${PALETTE:-.palette.png}
# generate...
{
set -o noglob
# gif palette...
ffmpeg \
-pattern_type glob \
-i $PATTERN \
-vf palettegen \
"$PALETTE"
# gif...
ffmpeg \
-r $FPS \
-pattern_type glob \
-i $PATTERN \
-i "$PALETTE" \
-filter_complex paletteuse=dither=none \
"${NAME}".gif
# mkv...
ffmpeg \
-r $FPS \
-pattern_type glob \
-i $PATTERN \
"${NAME}".mkv
#set +o noglob
}