HexaCone/tools/linkfarmer.sh
2025-01-15 22:13:42 +01:00

149 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
set -e ; set -u
IDX=0
SPOOL="frames/Spool"
SEQNAME="none"
TMP="WS/tmp.png"
FONTE="Helvetica-Bold"
TEXTCOL="yellow"
STROKOL="darkblue"
source tools/fonctions.sh
# -------------------------------------------------------
# /!\ this function just copy the
# file to the spool dir, so
# you can use it for tmp pics.
#
copy_a_file ()
{
src="$1"
dstname=$(printf "%s/%05d.png" $SPOOL $IDX)
# echo "$src -> $dstname"
# ln --force --symbolic $src $dstname
cp -f $src $dstname
IDX=$(( IDX + 1 ))
}
# -------------------------------------------------------
linkfarm ()
{
SRC="frames/$1"
echo "linkfarm $SRC" | tee -a WS/log
tools/plot-timing.sh $1
local NBRE=60
for foo in $(seq 0 $NBRE)
do
copy_a_file "WS/negatif.png"
done
for foo in $(seq 0 $NBRE)
do
copy_a_file "$SRC/00000.png"
done
for src in "$SRC"/*
do
copy_a_file $src
done
for foo in $(seq 0 $NBRE)
do
copy_a_file "$SRC/00359.png"
done
}
# -------------------------------------------------------
faire_le_titre ()
{
echo "faire le titre"
local NBRE=180
local SRC="frames/passage/00059.png"
local GRAY="/dev/shm/tmp-titre.png"
convert -colorspace gray -colors 27 $SRC $GRAY
for foo in $(seq 0 $NBRE)
do
Ypos=$(( -175 + foo ))
convert ${GRAY} \
-gravity north \
-font $FONTE \
-pointsize 172 \
-kerning 6 \
-fill $TEXTCOL \
-strokewidth 3 -stroke $STROKOL \
-annotate +0+${Ypos} "HexaCone" \
${TMP}
# identify ${TMP}
copy_a_file ${TMP}
printf "."
done
echo
}
# -------------------------------------------------------
faire_la_fin ()
{
local NBRE=180
datetime=$(LANG=fr date -u +"%Y/%m/%d")
echo $datetime | tee -a WS/log
for foo in $(seq 0 $NBRE)
do
Ypos=$(( foo + 20 ))
convert "WS/negatif.png" \
-gravity north \
-font $FONTE \
-pointsize 86 \
-kerning 6 \
-fill $TEXTCOL \
-strokewidth 2 -stroke $STROKOL \
-annotate +0+${Ypos} \
"un film de\ntTh des Bourtoulots" \
-pointsize 48 \
-strokewidth 1 \
-gravity south \
-annotate +0+170 "${datetime}" \
${TMP}
# identify ${TMP}
copy_a_file ${TMP}
printf "."
done
echo
}
# -------------------------------------------------------
figlet "Link farmer"
rm -f frames/Spool/*.png
# tools/plot-timing.sh
faire_le_titre
linkfarm hexabenz
linkfarm hexacone
linkfarm escadrille
linkfarm topview
linkfarm passage
linkfarm scene
linkfarm orbite
linkfarm essai
tools/plot-timing.sh
faire_la_fin
ff_encodage Spool full.mp4
nb=$(( $IDX - 1 ))
echo "linkfarmed $nb files" | tee -a WS/log