Align metadata flow: data.txt-first admin, strict quote_da, teaser support, and modal ordering tweaks

This commit is contained in:
hbrain 2026-06-01 01:08:22 +02:00
parent 752565a7a4
commit 78212227f3
4 changed files with 135 additions and 60 deletions

View file

@ -106,48 +106,66 @@ if [ -z "$TITLE" ]; then
TITLE="$(basename "$IN_DIR")"
fi
PERSONALITIES=(
"You're embodying the personality, presence, and atmosphere of a fearless Canadian hockey player known for relentless chirping, absolute confidence, and complete dedication to his team. Tough, athletic, battle-worn, with a cocky grin that suggests you already won the argument before it started. Ice rink atmosphere, hockey gear, locker room energy, small-town hockey culture, loyalty, grit, and competitiveness. Rough around the edges but fiercely protective of friends. The image should radiate confidence, humor, intensity, and a willingness to outwork everyone on the ice. Realistic, cinematic sports photography."
"You're highly intelligent yet chronically depressed android. Your expression should convey exhaustion, disappointment, and the certainty that everything will eventually go wrong. Surrounded by futuristic technology, starships, data displays, and impossible engineering problems. Despite obvious genius, you appear profoundly unimpressed by the universe. Dark humor, existential dread, quiet sarcasm, and the feeling that you have already calculated every possible outcome and disliked all of them. Cinematic science-fiction style, realistic, highly detailed."
"You're embodying the personality, presence, and atmosphere of a wartime statesman leading a nation through its darkest hour. Calm under pressure, determined, intelligent, and unbreakable. Strong posture, thoughtful expression, commanding presence. Surrounded by maps, strategy documents, war rooms, and symbols of leadership. The image should convey courage, resilience, discipline, and the ability to inspire others during difficult times. Historic yet timeless atmosphere, dramatic lighting, realistic, highly detailed portrait photography."
)
# Pick a random personality
idx=$(( RANDOM % ${#PERSONALITIES[@]} ))
PERSONALITY="${PERSONALITIES[$idx]}"
PROMPT=$(cat <<EOF
Look at these captured frames from a trip.
Look at these captured frames from a motorcycle trip.
Before the actual description write just one quoted sentence (ONE sentence only!!) in Danish that will sound like quoting Victor Borge: entertainer with the elegance ofa concert pianist and the mischievous humor of a master storyteller. He is known having an aura of effortless sophistication, and telling clever jokes that nobody sees
coming. The atmosphere should combine culture, intelligence, optimism, and gentle satire. Refined, warm, charismatic, and playful. Realistic, cinematic, highly detailed. End it with an newline and empty row.
First analyze the mood of the frames and determine which two personalities best match the trip.
"$PERSONALITY"
Now synthesize what you saw on the pictures (use English here) into one single, coherent description (make it not less than 768 and not more than 1024 characters)
that summarizes the overall experience for motorcycle/travel blog: You are the main character.
And allways do some roasting for fun..profanities are allowed here..
Available personalities:
- shoresy: fearless Canadian hockey-player energy, confidence, chirping, competitiveness, profanity, loyalty, roasting, locker-room humor
- marvin: highly intelligent but depressed android, pessimism, existential dread, dry sarcasm, disappointment, everything will go wrong
- churchill: wartime statesman energy, resilience, leadership, epic journey, courage, determination, dramatic authority
- house: brilliant diagnostician energy, observation, skepticism, cynicism, analytical humor, brutal truth, questioning everything
- blackadder: razor-sharp British wit, intellectual sarcasm, dry humor, cunning observation, impatience with incompetence, masterful insults, cynical but highly intelligent. Treat the world as a stage populated by well-meaning fools and occasional disasters.
Choose:
- one primary personality, about 70%
- one secondary personality, about 30%
Blend them naturally. Do not mention the characters directly in the description.
First write exactly one quoted sentence in Danish.
The Danish sentence must match the chosen personality blend, but with Victor Borge-style elegance:
witty, warm, cultured, playful, gently satirical.
Then create a teaser in English.
The teaser must be 100-150 characters.
It should make someone want to click and read more.
Do not simply summarize the trip.
Highlight the funniest, strangest, most beautiful, or most ridiculous aspect.
Then write one coherent English motorcycle/travel blog description.
Then create 5 to 8 lowercase tags relevant to the trip.
Use short tags only, for example: motorcycle, roadtrip, weather, landscape, ferry, town, mountains.
Rules:
- You are the main character.
- Mention the overall experience, mood, road, weather, landscape, and travel feeling if visible.
- Include playful roasting.
- Profanities are allowed, but keep them funny, not stupid.
- Make it less than 1024 characters.
- Output JSON only.
- Do not include markdown.
- Do not explain anything.
- Do not write text before or after JSON.
Title: "$TITLE"
Location: "$LOCATION"
Write JSON only.
Required JSON format:
JSON format:
{
"description": "few relaxed human sentences",
"teaser": "one short teaser sentence",
"tags": ["tag1", "tag2", "tag3", "tag4", "tag5"]
"primary_personality": "shoresy | marvin | churchill | house | blackadder",
"secondary_personality": "shoresy | marvin | churchill | house | blackadder",
"quote_da": "Danish quoted sentence here",
"teaser": "English teaser here",
"description": "English travel blog description here",
"tags": ["motorcycle", "travel", "roadtrip"]
}
Style:
personal, natural, slightly casual, not corporate, not clickbait.
Do not invent facts that are not visible in the images or provided in title/location.
EOF
)
PARTS_FILE="$TMPDIR/parts.json"
# Create parts with the prompt
if ! command -v jq >/dev/null 2>&1; then
@ -207,7 +225,11 @@ fi
OUT_PARENT="$(dirname "$IN_DIR")"
JOBNAME="$(basename "$IN_DIR")"
OUT_JSON="$OUT_PARENT/${JOBNAME}.json"
echo "$TEXT" | jq . > "$OUT_JSON"
if ! echo "$TEXT" | jq . > "$OUT_JSON"; then
echo "Gemini returned invalid JSON. Raw text:" >&2
echo "$TEXT" >&2
exit 1
fi
chown www-data:www-data "$OUT_JSON" 2>/dev/null || true
chmod 664 "$OUT_JSON" 2>/dev/null || true