Improved algorithm to be recursive

This commit is contained in:
Rendo 2026-04-12 21:10:51 +05:00
commit a4f344cf52

View file

@ -4,10 +4,10 @@ SOURCE_DIR=$(dirname -- "${BASH_SOURCE[0]}")
EXTRACTION_DIR=$SOURCE_DIR/selection/
SFW_DIR=$SOURCE_DIR/sfw/
EXTRACTED_FILE=$EXTRACTION_DIR$(ls $SOURCE_DIR/selection/ | shuf -n 1 -)
EXTRACTED_FILE=$(find -L $SOURCE_DIR/selection/ -type f | shuf -n 1)
magick $EXTRACTED_FILE $SOURCE_DIR/selected.jpg
if [ "$OVERRIDE_SFW" = "1" ]; then
cp $SFW_DIR$(ls $SFW_DIR | shuf -n 1 -) $SOURCE_DIR/selected.jpg
magick $(find -L $SFW_DIR -type f | shuf -n 1) $SOURCE_DIR/selected.jpg
fi