Compare commits

...

2 commits

Author SHA1 Message Date
6f428d6a63 LARGE modus complete 2024-01-05 04:28:37 +01:00
ba5e40a603 wip large mode, slide pixlist into multiple fields 2024-01-05 03:56:53 +01:00
2 changed files with 56 additions and 15 deletions

View file

@ -48,7 +48,7 @@ available env vars to configure:
IPFLOOT(string), FLOOTPORT(int), USECACHE(bool), FLOOTFORKS(int)
SIZE(int), TEXT(string), FONTSIZE(int), BGCOLOR(hex), COLOR(hex)
BORDERCOLOR(hex), X(int), Y(int), X_MAX(int), Y_MAX(int), H(int), W(int)
RESIZE(int), ALPHACOLOR(hex), BOUNCESTEP(int)
RESIZE(int), ALPHACOLOR(hex), BOUNCESTEP(int), LARGE(bool)
```
Running on my Ryzen 4700G with [wellenbrecher](https://github.com/bits0rcerer/wellenbrecher) 1280x720 and three workers,

View file

@ -294,17 +294,19 @@ flootworker()
{
while true
do
#FLOOTSRUNNING=$((FLOOTSRUNNING+1))
#test $FLOOTSRUNNING -le $FLOOTFORKS &&
if [ $LARGE ]
then
xymode
echo "$OFFSET"
for i in $(seq 0 $1 | shuf)
do
echo "${LOL[$i]}"
done
else
xymode
echo "$OFFSET
${LOL[$1]}" #> /dev/tcp/$IPFLOOT/$FLOOTPORT || message warn "transmission in worker ${YELLOW}$1${ENDCOLOR} ${RED}failed${ENDCOLOR} - maybe you need to decrease ${YELLOW}FLOOTFORKS${ENDCOLOR} or expand/tune your uplink"
#FLOOTSRUNNING=$((FLOOTSRUNNING-1))
#echo "${LOL[$i]}" > /dev/tcp/127.0.0.1/1337 &
#echo "worker $i PID ${LOLPID[$i]}"
${LOL[$1]}"
fi
done > /dev/tcp/$IPFLOOT/$FLOOTPORT || message warn "transmission in worker ${YELLOW}$1${ENDCOLOR} ${RED}failed${ENDCOLOR} - maybe you need to decrease ${YELLOW}FLOOTFORKS${ENDCOLOR} or expand/tune your uplink"
}
@ -320,6 +322,34 @@ checkfile() {
loadLOL() {
# when LARGE true, then we slize the large pixlist into smaller pieces
# max 64k each one
if [ $LARGE ]
then
LOL_org="$(echo "$LOL_org" | shuf)"
LOLFIELDSIZE=64000
# line counter
L=1
LINES="$(echo "$LOL_org" | wc -l )"
LOLFIELDS="$(( ( $LINES / $LOLFIELDSIZE ) ))"
message "LARGE mode: slicing ${YELLOW}${IMGFILE}${ENDCOLOR} - ${YELLOW}${LINES}${ENDCOLOR} into ${YELLOW}${LOLFIELDS}${ENDCOLOR} fields"
i=0
while [ $i -le $LOLFIELDS ]
do
LN=$(($L+$LOLFIELDSIZE+1))
message "field ${YELLOW}${i}${ENDCOLOR}, lines ${YELLOW}${L}${ENDCOLOR} - ${YELLOW}${LN}${ENDCOLOR}"
LOL[$i]="$(echo "$LOL_org" | sed -n "${L},$(($LN-1))p;${LN}q" )"
L=$LN
i=$(($i+1))
done
#~ echo "${LOL[14]}"
#~ echo STOP
#~ read
else
for i in $(seq 1 $FLOOTFORKS)
do
if [ -z "$ALPHACOLOR" ]
@ -332,6 +362,8 @@ loadLOL() {
fi
done
fi
}
floot() {
@ -410,6 +442,8 @@ floot() {
esac
message "starting $FLOOTFORKS workers"
while true
do
for i in $(seq $FLOOTFORKS)
@ -420,13 +454,20 @@ floot() {
message "worker ${YELLOW}$i${ENDCOLOR} is not running, starting it"
#if [ "$FLOOTSRUNNING" -le "$FLOOTFORKS" ]
#then
if [ $LARGE ]
then
flootworker $LOLFIELDS &
LOLPID[$i]=$!
else
flootworker $i &
LOLPID[$i]=$!
fi
#fi
fi
done
done
}
case $1 in
@ -511,7 +552,7 @@ case $1 in
echo "IPFLOOT(string), FLOOTPORT(int), USECACHE(bool), FLOOTFORKS(int)"
echo "SIZE(int), TEXT(string), FONTSIZE(int), BGCOLOR(hex), COLOR(hex)"
echo "BORDERCOLOR(hex), X(int), Y(int), X_MAX(int), Y_MAX(int), H(int), W(int)"
echo "RESIZE(int), ALPHACOLOR(hex), BOUNCESTEP(int)"
echo "RESIZE(int), ALPHACOLOR(hex), BOUNCESTEP(int), LARGE(bool)"
exit 1
;;