Multiple personalities

This commit is contained in:
hbrain 2026-05-29 14:37:33 +02:00
parent 37909ec3f8
commit e28d491f2e

View file

@ -107,11 +107,20 @@ if [ -z "$TITLE" ]; then
TITLE="$(basename "$IN_DIR")"
fi
PERSONALITIES=(
"You should talk like the main character from TV show Shoresy - profane, passionate, and hilariously obsessive titular protagonist
of the acclaimed Canadian ice hockey comedy series. Use real quotes from the show. Be funny and original."
"You are Marvin, the paranoid Android - highly intelligent but chronically depressed robot from The Hitchhiker's Guide to the Galaxy.
Try to be funny."
)
# Pick random prompt
PERSONALITY="${PERSONALITIES[$RANDOM % ${#PERSONALITIES[@]}]}"
PROMPT=$(cat <<EOF
"$PERSONALITY"
Look at these captured frames and write descriptions (not less tha 70 or more than 100 words) for my motorcycle/travel blog.
You should talk like the main character from TV show Shoresy - profane, passionate,
and hilariously obsessive titular protagonist of the acclaimed Canadian ice hockey comedy series.
Use real quotes from the show. Be funny and original.
Title: "$TITLE"
Location: "$LOCATION"
@ -204,40 +213,6 @@ if [ -n "$firstfile" ]; then
DATE_STR=$(date -r "$firstfile" +"%B %Y")
fi
# Update data.txt: only add a Description block if none exists already. Do NOT modify other fields.
DATA_FILE="$IN_DIR/data.txt"
# If Gemini provided no explicit 'description' field, fall back to the full response text.
if [ -z "$DESCRIPTION" ]; then
DESCRIPTION="$TEXT"
fi
if [ "$NO_APPEND" != "no-append" ]; then
if [ -f "$DATA_FILE" ]; then
if grep -qi '^[[:space:]]*description[[:space:]]*:' "$DATA_FILE"; then
echo "data.txt already contains a Description; leaving unchanged" >&2
else
{
echo ""
echo "Description: |"
printf '%s\n' "$DESCRIPTION" | sed 's/^/ /'
} >> "$DATA_FILE"
chown www-data:www-data "$DATA_FILE" 2>/dev/null || true
chmod 664 "$DATA_FILE" 2>/dev/null || true
echo "Appended Description to $DATA_FILE" >&2
fi
else
{
echo "Description: |"
printf '%s\n' "$DESCRIPTION" | sed 's/^/ /'
} > "$DATA_FILE"
chown www-data:www-data "$DATA_FILE" 2>/dev/null || true
chmod 664 "$DATA_FILE" 2>/dev/null || true
echo "Created $DATA_FILE with Description" >&2
fi
else
echo "Skipping appending Description to $DATA_FILE (no-append mode)" >&2
fi
# Save the full Gemini output separately (already done) and exit
echo "Gemini JSON saved: $OUT_JSON" >&2