Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d6f580d24 | ||
|
|
af05f19301 | ||
|
|
3201369470 | ||
|
|
05197378b3 | ||
|
|
f3b3152f07 | ||
|
|
22364f2f1b |
No files matched your search
@@ -0,0 +1,46 @@
|
||||
name: Build cinematic Markdown-to-execution video
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [docs/markdown-execution-cinematic-v2]
|
||||
paths:
|
||||
- "scripts/render-markdown-execution-promo.py"
|
||||
- ".github/workflows/build-markdown-execution-video.yml"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
video:
|
||||
if: github.ref_name == 'docs/markdown-execution-cinematic-v2'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 25
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: true
|
||||
- name: Prepare fonts, Chrome and Python tools
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq ffmpeg fonts-noto-cjk
|
||||
python -m pip install --quiet pillow numpy markdown-it-py selenium
|
||||
google-chrome --version
|
||||
- name: Render promo video from two original images and Marqdo source
|
||||
run: python scripts/render-markdown-execution-promo.py
|
||||
- name: Check resulting video
|
||||
run: |
|
||||
test -s assets/marketing/marqdo-2.7.1-markdown-to-execution.mp4
|
||||
test -s assets/marketing/marqdo-2.7.1-markdown-to-execution-cover.jpg
|
||||
test -s assets/marketing/marqdo-2.7.1-markdown-to-execution.srt
|
||||
ffprobe -v error -show_entries format=duration,size:stream=codec_name,width,height -of json assets/marketing/marqdo-2.7.1-markdown-to-execution.mp4
|
||||
- name: Commit compiled video, poster and subtitles
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add assets/marketing/marqdo-2.7.1-markdown-to-execution.mp4 \
|
||||
assets/marketing/marqdo-2.7.1-markdown-to-execution-cover.jpg \
|
||||
assets/marketing/marqdo-2.7.1-markdown-to-execution.srt \
|
||||
assets/marketing/marqdo-procurement-standard-markdown.png
|
||||
git diff --cached --quiet || git commit -m "docs: publish cinematic Markdown-to-execution promotional film"
|
||||
git push origin HEAD:docs/markdown-execution-cinematic-v2
|
||||
@@ -0,0 +1,43 @@
|
||||
name: Build Marqdo promotional video
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [docs/promo-video-271]
|
||||
paths:
|
||||
- scripts/make-procurement-promo.py
|
||||
- .github/workflows/promo-video.yml
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build-video:
|
||||
if: github.ref_name == 'docs/promo-video-271'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: true
|
||||
- name: Prepare video environment
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -qq -y ffmpeg fonts-noto-cjk
|
||||
python -m pip install --quiet --disable-pip-version-check pillow numpy
|
||||
ffmpeg -version | head -n 2
|
||||
- name: Compose 32-second Marqdo video
|
||||
run: python scripts/make-procurement-promo.py
|
||||
- name: Verify deliverable
|
||||
run: |
|
||||
test -s assets/marketing/marqdo-2.7.1-promo.mp4
|
||||
test -s assets/marketing/marqdo-2.7.1-poster.jpg
|
||||
test -s assets/marketing/marqdo-2.7.1-promo.srt
|
||||
ffprobe -v error -show_entries format=duration,size -of default=noprint_wrappers=1 assets/marketing/marqdo-2.7.1-promo.mp4
|
||||
- name: Commit video into promotional branch
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add assets/marketing/marqdo-2.7.1-promo.mp4 assets/marketing/marqdo-2.7.1-poster.jpg assets/marketing/marqdo-2.7.1-promo.srt
|
||||
git diff --cached --quiet || git commit -m "docs: render Marqdo 2.7.1 promotional video from existing assets"
|
||||
git push origin HEAD:docs/promo-video-271
|
||||
@@ -15,6 +15,7 @@
|
||||
**Not a prompt wrapper.** The document is interpreted as a program by Marqdo; its tool functions are not merely natural-language instructions.
|
||||
|
||||
<p align="center">
|
||||
<a href="#one-markdown-file-three-views-real-execution">56s film</a> ·
|
||||
<a href="#quickstart--one-function-one-command">Quickstart</a> ·
|
||||
<a href="#a-procurement-skill-with-a-600-budget">Procurement demo</a> ·
|
||||
<a href="#explore-the-view">View</a> ·
|
||||
@@ -23,9 +24,26 @@
|
||||
<a href="doc/releases/v2.7.1.md">Release notes</a>
|
||||
</p>
|
||||
|
||||

|
||||
## One Markdown file. Three views. Real execution.
|
||||
|
||||
[](assets/marketing/marqdo-2.7.1-markdown-to-execution.mp4)
|
||||
|
||||
**[▶ Watch the 56-second film](assets/marketing/marqdo-2.7.1-markdown-to-execution.mp4)** · [Bilingual captions](assets/marketing/marqdo-2.7.1-markdown-to-execution.srt) · [Reproducible video source](scripts/render-markdown-execution-promo.py)
|
||||
|
||||
> **The point is not to invent a new document format.** A `.mq.md` file uses Markdown headings, paragraphs and tables. Ordinary Markdown renderers still show a readable document. Marqdo adds explicit execution semantics and a View that can inspect functions, values and their relationships on the same document.
|
||||
|
||||

|
||||
|
||||
<sub>**Concept artwork** showing the design principle: **source → ordinary Markdown rendering → Marqdo View**. Illustrative labels are not a live execution trace. The video includes [a real View screenshot](assets/marketing/user-procurement-view.png), [a standard Markdown rendering](assets/marketing/marqdo-procurement-standard-markdown.png) produced from the actual procurement source, and a business example verified with the 2.7.1 CLI.</sub>
|
||||
|
||||
**One `.mq.md` source, three ways to interact:**
|
||||
|
||||
| Source | Standard Markdown | Marqdo runtime + View |
|
||||
|---|---|---|
|
||||
| Edit the same Markdown text | Read headings, prose and data tables | Inspect the same document's calls, values and effects |
|
||||
| No separate prompt or tool implementation specification needed | Works as ordinary readable documentation | Call named functions with `marqdo call` |
|
||||
|
||||
|
||||
<sub>Animated walkthrough assembled from **real Marqdo 2.7.1 function-call results**, including the accepted **simulated** order and an over-budget refusal. Curated frames, not a recording of typing or a production transaction. [Reproduce the capture](scripts/capture-procurement-showcase.py) · [CI run](https://github.com/cflmy/marqdo/actions/runs/43358103498).</sub>
|
||||
|
||||
## Quickstart — one function, one command
|
||||
|
||||
@@ -44,6 +62,10 @@ The function heading is the callable name. The function's explanation, parameter
|
||||
|
||||
This is a **seven-tool, offline demonstration**. It knows the local supplier directory, queries a static price catalog, checks the budget, and conditionally creates a **simulated** work order. It also documents receipt handling, negotiation and supplier switching as unconnected stubs.
|
||||
|
||||

|
||||
|
||||
<sub>**Real CLI results**, edited into a short animation; the accepted order is explicitly **simulated** and never sent. [Capture workflow](scripts/capture-procurement-showcase.py) · [Passing checks](https://github.com/cflmy/marqdo/actions/runs/43358288563).</sub>
|
||||
|
||||
```bash
|
||||
# 1. Approve suppliers: paused or blacklisted entries are excluded.
|
||||
marqdo call examples/procurement/index.mq.md 查询采购商 "采购商状态='正常'" --json
|
||||
@@ -79,9 +101,9 @@ Marqdo 2.7.1 improves the interactive reading experience: implementation details
|
||||
marqdo view examples/procurement --no-open
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
<sub>**Actual screenshot** captured in Chromium from a Marqdo **2.7.1** View static export, scrolled to `向采购商发工单`. It shows the real rendered document, not a promotional mockup. [Screenshot generation source](scripts/capture-procurement-showcase.py).</sub>
|
||||
<sub>**Original View screenshot provided by the project author.** Notice the natural document typography, values in the margins, and curved connections originating from function calls in the prose. [Additional automated View capture](assets/marketing/procurement-view.png) · [Static Markdown rendering](assets/marketing/marqdo-procurement-standard-markdown.png).</sub>
|
||||
|
||||
## One document, multiple uses
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 132 KiB |
Binary file not shown.
@@ -0,0 +1,35 @@
|
||||
1
|
||||
00:00:00,000 --> 00:00:04,800
|
||||
Your SKILL is now a TOOL.
|
||||
让 Markdown 直接承载可执行语义。
|
||||
|
||||
2
|
||||
00:00:04,800 --> 00:00:11,600
|
||||
源码态:标题、段落、表格都沿用 Markdown。
|
||||
执行逻辑就在文档之中。
|
||||
|
||||
3
|
||||
00:00:11,600 --> 00:00:18,000
|
||||
渲染态:同一份代码也能成为普通 Markdown 文档。
|
||||
|
||||
4
|
||||
00:00:18,000 --> 00:00:25,000
|
||||
源码态、标准 Markdown 渲染态、Marqdo View 态。
|
||||
三种视图,同一份源文件。
|
||||
|
||||
5
|
||||
00:00:25,000 --> 00:00:32,500
|
||||
一份 .mq.md,既可以阅读,也可以编译执行。
|
||||
|
||||
6
|
||||
00:00:32,500 --> 00:00:42,000
|
||||
真实 View 截图:函数调用和值沿着优雅曲线呈现。
|
||||
|
||||
7
|
||||
00:00:42,000 --> 00:00:50,800
|
||||
预算校验不是文字承诺,而是函数执行。
|
||||
模拟订单通过或拒绝,均由运行时返回结果。
|
||||
|
||||
8
|
||||
00:00:50,800 --> 00:00:56,000
|
||||
Marqdo 2.7.1 · github.com/cflmy/marqdo
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 78 KiB |
Binary file not shown.
@@ -0,0 +1,29 @@
|
||||
1
|
||||
00:00:00,000 --> 00:00:03,900
|
||||
Your SKILL is now a TOOL.
|
||||
让 SKILL 真正成为工具。
|
||||
|
||||
2
|
||||
00:00:03,900 --> 00:00:09,000
|
||||
One readable document. Callable business logic.
|
||||
规则、数据、工具在同一份文档里。
|
||||
|
||||
3
|
||||
00:00:09,000 --> 00:00:17,400
|
||||
Five verified CLI calls, from quote to decision.
|
||||
真实 CLI 结果:询价、预算、模拟发单。
|
||||
|
||||
4
|
||||
00:00:17,400 --> 00:00:23,400
|
||||
¥120 spent: mock order. ¥360 spent: rejected.
|
||||
¥120 时模拟通过;¥360 时预算不足。
|
||||
|
||||
5
|
||||
00:00:23,400 --> 00:00:29,000
|
||||
Inspect the actual document in Marqdo View.
|
||||
查看 Marqdo 真实 View 页面。
|
||||
|
||||
6
|
||||
00:00:29,000 --> 00:00:32,000
|
||||
github.com/cflmy/marqdo
|
||||
开源 · Marqdo 2.7.1
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 161 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.9 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 523 KiB |
@@ -0,0 +1,369 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Make a 16:9 Marqdo promotional video from checked-in repository assets.
|
||||
|
||||
Inputs: GIF generated from actual v2.7.1 CLI results, and screenshot captured
|
||||
from actual v2.7.1 View. The budget scenario is explicitly simulated.
|
||||
Everything used to reproduce this movie is in the repository.
|
||||
No third-party soundtrack or music clips are used.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import math
|
||||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
import wave
|
||||
from bisect import bisect_right
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
from PIL import Image, ImageDraw, ImageFont, ImageOps
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
ASSETS = ROOT / "assets" / "marketing"
|
||||
GIF = ASSETS / "procurement-cli.gif"
|
||||
VIEW = ASSETS / "procurement-view.png"
|
||||
PROC = ROOT / "examples" / "procurement" / "index.mq.md"
|
||||
OUT = ASSETS / "marqdo-2.7.1-promo.mp4"
|
||||
POSTER = ASSETS / "marqdo-2.7.1-poster.jpg"
|
||||
SUBTITLES = ASSETS / "marqdo-2.7.1-promo.srt"
|
||||
W, H, FPS = 1280, 720, 24
|
||||
DURATION = 32.0
|
||||
CUTS = [0.0, 3.9, 9.0, 17.4, 23.4, 29.0, DURATION]
|
||||
DARK = (11, 19, 32)
|
||||
GOLD = (232, 187, 123)
|
||||
LIGHT = (248, 246, 238)
|
||||
MUTED = (155, 174, 197)
|
||||
GREEN = (125, 224, 174)
|
||||
RED = (251, 151, 155)
|
||||
|
||||
def rgb(c):
|
||||
return tuple(c)
|
||||
|
||||
def choose_font(size, bold=False, serif=False):
|
||||
paths = [
|
||||
"/usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc" if serif and bold else "",
|
||||
"/usr/share/fonts/opentype/noto/NotoSerifCJK-Regular.ttc" if serif else "",
|
||||
"/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc" if bold else "/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc",
|
||||
"/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf" if bold else "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf",
|
||||
]
|
||||
for p in paths:
|
||||
if not p:
|
||||
continue
|
||||
try:
|
||||
return ImageFont.truetype(p, size)
|
||||
except OSError:
|
||||
continue
|
||||
return ImageFont.load_default()
|
||||
|
||||
F = {
|
||||
"hero": choose_font(72, True),
|
||||
"big": choose_font(55, True),
|
||||
"h1": choose_font(42, True),
|
||||
"h2": choose_font(31, True),
|
||||
"mid": choose_font(25, True),
|
||||
"code": choose_font(23),
|
||||
"body": choose_font(22),
|
||||
"small": choose_font(17),
|
||||
"micro": choose_font(14),
|
||||
"zh": choose_font(28, serif=True),
|
||||
}
|
||||
|
||||
def text(draw, xy, msg, font, color=LIGHT, anchor=None):
|
||||
draw.text(xy, str(msg), font=font, fill=color, anchor=anchor)
|
||||
|
||||
def panel(draw, xy, fill=(24,35,54), outline=(51,67,89), rad=23, width=2):
|
||||
draw.rounded_rectangle(xy, radius=rad, fill=fill, outline=outline, width=width)
|
||||
|
||||
def mix(a, b, t):
|
||||
return a + (b-a)*t
|
||||
|
||||
def ease(x):
|
||||
u = max(0., min(1., x))
|
||||
return u*u*(3-2*u)
|
||||
|
||||
def appear(t, delay=0., span=.65):
|
||||
return ease((t-delay)/span)
|
||||
|
||||
def xshift(t, delay=.0):
|
||||
return int(38*(1-appear(t,delay)))
|
||||
|
||||
def opacity_overlay(base, overlay, alpha):
|
||||
return Image.blend(base, overlay, max(0.,min(1.,alpha)))
|
||||
|
||||
def clipped(src, size, center=(.5,.5), zoom=1):
|
||||
w,h=size
|
||||
if zoom > 1:
|
||||
p=ImageOps.fit(src,(int(w*zoom),int(h*zoom)),method=Image.Resampling.LANCZOS,centering=center)
|
||||
z=(p.width-w)//2
|
||||
v=(p.height-h)//2
|
||||
return p.crop((z,v,z+w,v+h))
|
||||
return ImageOps.fit(src,size,method=Image.Resampling.LANCZOS,centering=center)
|
||||
|
||||
def background(seed=0):
|
||||
im = Image.new("RGB",(W,H),DARK)
|
||||
pix=im.load()
|
||||
for y in range(H):
|
||||
for x in range(W):
|
||||
glow= max(0,1-math.hypot((x-1090)/1.3,(y-95)/1.1)/520)
|
||||
edge= max(0,1-math.hypot((x-25),y-690)/500)
|
||||
pix[x,y]=(int(11+14*glow+7*edge),int(19+9*glow+7*edge),int(32+13*glow+10*edge))
|
||||
d=ImageDraw.Draw(im)
|
||||
for x in range(45,W,82):
|
||||
d.line((x,0,x,H),fill=(18,29,45),width=1)
|
||||
for y in range(48,H,82):
|
||||
d.line((0,y,W,y),fill=(18,29,45),width=1)
|
||||
return im
|
||||
|
||||
BG=background()
|
||||
|
||||
def base_frame(t,scene):
|
||||
im=BG.copy()
|
||||
d=ImageDraw.Draw(im)
|
||||
# top identity, bottom running progress
|
||||
text(d,(63,35),"MARQDO",F["small"],GOLD)
|
||||
text(d,(168,36),"/ EXECUTABLE AI SKILLS",F["micro"],MUTED)
|
||||
d.rounded_rectangle((1079,21,1211,57),radius=15,fill=(40,51,68))
|
||||
text(d,(1095,30),"v2.7.1",F["small"],LIGHT)
|
||||
d.line((62,76,1214,76),fill=(48,61,80),width=2)
|
||||
d.line((62,694,1214,694),fill=(47,61,80),width=2)
|
||||
d.line((62,694,62+int((1152)*(t/DURATION)),694),fill=GOLD,width=4)
|
||||
text(d,(64,705),"DOCUMENT → FUNCTION → TOOL",F["micro"],(104,120,141))
|
||||
text(d,(1115,705),"%02d / 06" % (scene+1),F["micro"],(104,120,141))
|
||||
return im,d
|
||||
|
||||
def scene_hero(local,global_t):
|
||||
im,d=base_frame(global_t,0)
|
||||
a=appear(local,.07)
|
||||
yy=xshift(local,.08)
|
||||
text(d,(69,167+yy),"Your SKILL",F["hero"],LIGHT)
|
||||
text(d,(69,264+yy),"is now a",F["hero"],LIGHT)
|
||||
text(d,(69,361+yy),"TOOL.",F["hero"],GOLD)
|
||||
# typographic bar
|
||||
x=69
|
||||
d.rounded_rectangle((x,485,x+min(643,int(643*a)),489),radius=2,fill=GOLD)
|
||||
text(d,(71,520),"Write it. Inspect it. Call it.",F["mid"],LIGHT)
|
||||
text(d,(71,573),"让可读文档中的函数,真正成为可调用工具。",F["zh"],(224,219,205))
|
||||
d.rounded_rectangle((975,207,1169,493),radius=25,fill=(26,37,57),outline=(84,99,118),width=2)
|
||||
text(d,(1017,276),".mq.md",F["h2"],GOLD)
|
||||
text(d,(1017,357),"01 Read",F["small"],MUTED)
|
||||
text(d,(1017,399),"02 Call",F["small"],MUTED)
|
||||
text(d,(1017,441),"03 Check",F["small"],MUTED)
|
||||
return im
|
||||
|
||||
SOURCE_LINES=[
|
||||
"## 向采购商发工单",
|
||||
"采购商标识符 数量 单价 已花费",
|
||||
"",
|
||||
"正常商户 = 查询采购商(...)",
|
||||
"报价 = 查询采购商价格(...)",
|
||||
"预算 = 查询余额(已花费=...)",
|
||||
"",
|
||||
"1. 剩余额度 < 本单金额",
|
||||
" → 拒绝模拟工单",
|
||||
]
|
||||
def scene_source(local,global_t):
|
||||
im,d=base_frame(global_t,1)
|
||||
text(d,(71,110),"ONE DOCUMENT.",F["h1"],LIGHT)
|
||||
text(d,(71,159),"Contract, data, policy and implementation in the same .mq.md.",F["body"],MUTED)
|
||||
panel(d,(67,205,842,642),fill=(18,28,44),outline=(72,91,113))
|
||||
d.rounded_rectangle((67,205,842,254),radius=17,fill=(35,48,67))
|
||||
text(d,(93,218),"index.mq.md / procurement skill",F["small"],GOLD)
|
||||
ready=int(len(SOURCE_LINES)*ease((local-.40)/3.8))
|
||||
for i,ln in enumerate(SOURCE_LINES[:ready]):
|
||||
clr=GOLD if i in (0,7) else GREEN if i==8 else (178,204,232)
|
||||
text(d,(101,279+i*37),ln,F["code"],clr)
|
||||
panel(d,(863,205,1214,642),fill=(24,35,55),outline=(74,88,107))
|
||||
for j,(label,desc) in enumerate([
|
||||
("01 READ","human-readable"),
|
||||
("02 CHECK","typed contracts"),
|
||||
("03 CALL","marqdo call"),
|
||||
("04 RETURN","structured values")
|
||||
]):
|
||||
y=268+j*96
|
||||
d.rounded_rectangle((888,y,1187,y+66),radius=13,fill=(30,48,65))
|
||||
text(d,(907,y+11),label,F["small"],GOLD)
|
||||
text(d,(907,y+34),desc,F["micro"],(186,203,220))
|
||||
text(d,(71,662),"Excerpt simplified for screen layout; the full source is linked in the repository.",F["micro"],(110,135,154))
|
||||
return im
|
||||
|
||||
GIF_FRAMES=[]
|
||||
GIF_DURATIONS=[]
|
||||
if GIF.exists():
|
||||
im=Image.open(GIF)
|
||||
for i in range(getattr(im,"n_frames",1)):
|
||||
im.seek(i)
|
||||
GIF_FRAMES.append(im.convert("RGB").copy())
|
||||
GIF_DURATIONS.append(max(.3, im.info.get("duration",1600)/1000))
|
||||
if len(GIF_FRAMES) < 5:
|
||||
raise RuntimeError(f"Expected >= 5 real CLI demonstration frames, found {len(GIF_FRAMES)}")
|
||||
else:
|
||||
raise FileNotFoundError(GIF)
|
||||
GIF_CUM=[0.]
|
||||
for dur in GIF_DURATIONS:
|
||||
GIF_CUM.append(GIF_CUM[-1]+dur)
|
||||
GIF_CYCLE=GIF_CUM[-1]
|
||||
GIF_FITTED=[clipped(im,(1136,620)) for im in GIF_FRAMES]
|
||||
|
||||
def scene_cli(local,global_t):
|
||||
im,d=base_frame(global_t,2)
|
||||
# The 5 panels are constructed from real calls and validated in the original capture script.
|
||||
k=min(len(GIF_FITTED)-1,bisect_right(GIF_CUM,(local+.3)%GIF_CYCLE)-1)
|
||||
im.paste(GIF_FITTED[k],(72,73))
|
||||
d=ImageDraw.Draw(im)
|
||||
d.rectangle((73,73,1210,113),fill=(15,24,37))
|
||||
text(d,(91,82),"REAL CLI RETURNS / CURATED ANIMATED WALKTHROUGH",F["small"],GOLD)
|
||||
d.rectangle((76,664,1206,688),fill=(15,24,37))
|
||||
text(d,(87,665),"Supplier → Quote → Balance → Mock order → Over-budget refusal",F["small"],LIGHT)
|
||||
return im
|
||||
|
||||
def scene_outcomes(local,global_t):
|
||||
im,d=base_frame(global_t,3)
|
||||
text(d,(70,113),"THE LIMIT IS EXECUTED.",F["h1"])
|
||||
text(d,(70,164),"Two calls. Same unit price. Different accumulated spend.",F["body"],MUTED)
|
||||
q=ease((local-.6)/1.5)
|
||||
left=120+int(288*q)
|
||||
right=360+int(288*q)
|
||||
panel(d,(70,219,616,610),fill=(17,49,43),outline=(69,124,102))
|
||||
panel(d,(652,219,1202,610),fill=(55,29,39),outline=(150,78,90))
|
||||
text(d,(99,253),"ALLOWED · SIMULATION",F["small"],GREEN)
|
||||
text(d,(681,253),"DENIED · RUNTIME CHECK",F["small"],RED)
|
||||
text(d,(99,304),"¥120 + ¥288",F["h2"],LIGHT)
|
||||
text(d,(681,304),"¥360 + ¥288",F["h2"],LIGHT)
|
||||
text(d,(99,396),"¥"+str(left),F["hero"],GREEN)
|
||||
text(d,(681,396),"¥"+str(right),F["hero"],RED)
|
||||
text(d,(103,445),"≤ ¥600",F["mid"],(196,239,212))
|
||||
text(d,(686,445),"> ¥600",F["mid"],(255,202,211))
|
||||
d.line((100,476,581,476),fill=(77,119,101),width=2)
|
||||
d.line((681,476,1170,476),fill=(135,80,90),width=2)
|
||||
text(d,(101,497),"ok: true",F["mid"],GREEN)
|
||||
text(d,(680,497),"ok: false",F["mid"],RED)
|
||||
text(d,(101,553),"本地模拟,未发送",F["body"],(211,233,220))
|
||||
text(d,(680,553),"采购金额超过剩余额度",F["body"],(251,213,217))
|
||||
text(d,(71,651),"The function re-checks its own budget constraints. This is an offline example, not a real purchase.",F["micro"],MUTED)
|
||||
return im
|
||||
|
||||
VIEW_IMAGE=Image.open(VIEW).convert("RGB")
|
||||
VIEW_PANEL=(101,195,1179,635)
|
||||
VIEW_MASK=Image.new("L",(VIEW_PANEL[2]-VIEW_PANEL[0],VIEW_PANEL[3]-VIEW_PANEL[1]),0)
|
||||
ImageDraw.Draw(VIEW_MASK).rounded_rectangle((0,0,VIEW_MASK.width-1,VIEW_MASK.height-1),radius=18,fill=255)
|
||||
|
||||
def scene_view(local,global_t):
|
||||
im,d=base_frame(global_t,4)
|
||||
text(d,(70,111),"THE SAME SOURCE, BEAUTIFULLY INSPECTABLE.",F["h2"])
|
||||
text(d,(71,158),"Marqdo 2.7.1 View — an actual screenshot of the procurement function.",F["body"],MUTED)
|
||||
factor=1+.06*ease(local/5)
|
||||
content=clipped(VIEW_IMAGE,(VIEW_MASK.width,VIEW_MASK.height),center=(.50,.38),zoom=factor)
|
||||
im.paste(content,(VIEW_PANEL[0],VIEW_PANEL[1]),VIEW_MASK)
|
||||
d=ImageDraw.Draw(im)
|
||||
d.rounded_rectangle(VIEW_PANEL,radius=18,outline=(199,165,118),width=3)
|
||||
text(d,(104,665),"From marqdo view output • function 向采购商发工单",F["small"],(187,207,222))
|
||||
return im
|
||||
|
||||
def scene_outro(local,global_t):
|
||||
im,d=base_frame(global_t,5)
|
||||
text(d,(71,163),"One .mq.md",F["hero"],LIGHT)
|
||||
text(d,(71,260),"Many ways to use it.",F["h1"],GOLD)
|
||||
d.rounded_rectangle((70,365,1212,436),radius=19,fill=(33,49,67),outline=(81,101,124),width=2)
|
||||
text(d,(107,381),"Write it. Inspect it. Call it.",F["h2"],LIGHT)
|
||||
text(d,(73,490),"github.com/cflmy/marqdo",F["h1"],GOLD)
|
||||
text(d,(73,548),"Marqdo 2.7.1 • Rust-based document-native runtime",F["body"],MUTED)
|
||||
text(d,(73,613),"Demo uses simulated supplier data. No ERP connection or actual purchase.",F["small"],(176,190,204))
|
||||
return im
|
||||
|
||||
SCENE_FNS=[scene_hero,scene_source,scene_cli,scene_outcomes,scene_view,scene_outro]
|
||||
def render(t):
|
||||
i=min(len(SCENE_FNS)-1,bisect_right(CUTS,t)-1)
|
||||
im=SCENE_FNS[i](t-CUTS[i],t)
|
||||
end=CUTS[i+1]
|
||||
if i<len(SCENE_FNS)-1 and t > end-.43:
|
||||
other=SCENE_FNS[i+1](0,t)
|
||||
im=Image.blend(im,other,ease((t-(end-.43))/.43))
|
||||
return im
|
||||
|
||||
def make_audio(path):
|
||||
sr=24000
|
||||
count=round(DURATION*sr)
|
||||
times=np.arange(count,dtype=np.float64)/sr
|
||||
signal=np.zeros(count,dtype=np.float64)
|
||||
chords=[(110.0,164.8,220.0),(123.5,185.0,246.9),(130.8,196.0,261.6),(110.0,174.6,220.0),(123.5,185.0,246.9),(130.8,196.0,261.6)]
|
||||
for idx in range(6):
|
||||
start,end=CUTS[idx],CUTS[idx+1]
|
||||
mask=(times>=start)&(times<end)
|
||||
t=times[mask]-start
|
||||
fade=np.minimum(1,np.minimum(t/.8, (end-start-t)/.85).clip(min=0))
|
||||
notes=chords[idx]
|
||||
wavepad=(np.sin(2*np.pi*notes[0]*t)*0.54+
|
||||
np.sin(2*np.pi*notes[1]*t)*0.18+
|
||||
np.sin(2*np.pi*notes[2]*t)*0.12)
|
||||
signal[mask] += 0.12*fade*wavepad
|
||||
for at in CUTS[:-1]:
|
||||
start=int(at*sr)
|
||||
length=int(.16*sr)
|
||||
n=np.arange(length,dtype=np.float64)/sr
|
||||
chirp=(np.sin(2*np.pi*(640*n+680*n*n))*np.exp(-24*n))*0.12
|
||||
signal[start:start+length] += chirp
|
||||
signal *= np.minimum(1,np.minimum(times/1.2, (DURATION-times)/1.2).clip(min=0))
|
||||
pcm=np.clip(signal*32767,-32767,32767).astype(np.int16)
|
||||
with wave.open(str(path),"wb") as wav:
|
||||
wav.setnchannels(1);wav.setsampwidth(2);wav.setframerate(sr)
|
||||
wav.writeframes(pcm.tobytes())
|
||||
|
||||
def make_srt():
|
||||
times=[("00:00:00,000","00:00:03,900","Your SKILL is now a TOOL.\n让 SKILL 真正成为工具。"),
|
||||
("00:00:03,900","00:00:09,000","One readable document. Callable business logic.\n规则、数据、工具在同一份文档里。"),
|
||||
("00:00:09,000","00:00:17,400","Five verified CLI calls, from quote to decision.\n真实 CLI 结果:询价、预算、模拟发单。"),
|
||||
("00:00:17,400","00:00:23,400","¥120 spent: mock order. ¥360 spent: rejected.\n¥120 时模拟通过;¥360 时预算不足。"),
|
||||
("00:00:23,400","00:00:29,000","Inspect the actual document in Marqdo View.\n查看 Marqdo 真实 View 页面。"),
|
||||
("00:00:29,000","00:00:32,000","github.com/cflmy/marqdo\n开源 · Marqdo 2.7.1")]
|
||||
txt="\n\n".join(f"{i+1}\n{a} --> {b}\n{c}" for i,(a,b,c) in enumerate(times))+"\n"
|
||||
SUBTITLES.write_text(txt,encoding="utf-8")
|
||||
|
||||
def main():
|
||||
if not PROC.exists() or not VIEW.exists():
|
||||
raise FileNotFoundError("Expected procurement source and actual View screenshot")
|
||||
source=PROC.read_text("utf-8")
|
||||
assert "## 向采购商发工单" in source and "查询余额" in source
|
||||
assert VIEW_IMAGE.width >= 1200 and VIEW_IMAGE.height >= 700
|
||||
OUT.parent.mkdir(parents=True,exist_ok=True)
|
||||
POSTER_IMG=render(1.8)
|
||||
POSTER_IMG.save(POSTER,quality=92,optimize=True)
|
||||
make_srt()
|
||||
frames=int(DURATION*FPS)
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
unscored=Path(tmp)/"silent.mp4"
|
||||
music=Path(tmp)/"music.wav"
|
||||
cmd=["ffmpeg","-y","-hide_banner","-loglevel","error","-f","rawvideo",
|
||||
"-pixel_format","rgb24","-video_size",f"{W}x{H}","-framerate",str(FPS),
|
||||
"-i","pipe:0","-an","-c:v","libx264","-preset","veryfast","-crf","21",
|
||||
"-pix_fmt","yuv420p","-movflags","+faststart",str(unscored)]
|
||||
proc=subprocess.Popen(cmd,stdin=subprocess.PIPE,stderr=subprocess.PIPE)
|
||||
try:
|
||||
for k in range(frames):
|
||||
fr=render(k/FPS)
|
||||
proc.stdin.write(fr.tobytes())
|
||||
if k%120==0:
|
||||
print("rendered",k,"/",frames,flush=True)
|
||||
finally:
|
||||
if proc.stdin:
|
||||
proc.stdin.close()
|
||||
stderr=proc.stderr.read().decode(errors="replace")
|
||||
rc=proc.wait(timeout=70)
|
||||
if rc:
|
||||
raise RuntimeError("Video encoder error: "+stderr)
|
||||
make_audio(music)
|
||||
subprocess.run(["ffmpeg","-y","-hide_banner","-loglevel","error",
|
||||
"-i",str(unscored),"-i",str(music),"-c:v","copy","-c:a",
|
||||
"aac","-b:a","128k","-shortest","-movflags","+faststart",
|
||||
str(OUT)],check=True,timeout=90)
|
||||
print("VIDEO_WRITTEN",OUT,OUT.stat().st_size,flush=True)
|
||||
print("POSTER_WRITTEN",POSTER,POSTER.stat().st_size,flush=True)
|
||||
print("SUBTITLES_WRITTEN",SUBTITLES,SUBTITLES.stat().st_size,flush=True)
|
||||
ffprobe=subprocess.run(["ffprobe","-v","error","-show_entries",
|
||||
"format=duration,size:stream=codec_name,width,height",
|
||||
"-of","json",str(OUT)],capture_output=True,text=True,check=True)
|
||||
print("FFPROBE",ffprobe.stdout,flush=True)
|
||||
assert OUT.stat().st_size>1000000, "Suspiciously small encoded video"
|
||||
|
||||
if __name__=="__main__":
|
||||
main()
|
||||
@@ -0,0 +1,251 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Rebuild the Marqdo Markdown → View → execution promotional film.
|
||||
|
||||
Source imagery:
|
||||
- assets/marketing/user-procurement-view.png: original user-provided View capture
|
||||
- assets/marketing/source-markdown-view-concept.png: original generated concept art
|
||||
Other images are generated from the repository's actual procurement source.
|
||||
The purchasing demo is simulated, not an ERP transaction.
|
||||
"""
|
||||
from pathlib import Path
|
||||
import math, subprocess, wave, tempfile
|
||||
import numpy as np
|
||||
from PIL import Image, ImageDraw, ImageFont, ImageFilter, ImageOps
|
||||
from markdown_it import MarkdownIt
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
A=ROOT/"assets"/"marketing"
|
||||
OUT=A/"marqdo-2.7.1-markdown-to-execution.mp4"
|
||||
POSTER=A/"marqdo-2.7.1-markdown-to-execution-cover.jpg"
|
||||
SRT=A/"marqdo-2.7.1-markdown-to-execution.srt"
|
||||
W,H=1600,900
|
||||
D=[4.8,6.8,6.4,7.0,7.5,9.5,8.8,5.2]
|
||||
IVORY=(249,247,242);INK=(37,35,34);GOLD=(191,146,81);PEARL=(242,232,214);DIM=(122,114,105);NIGHT=(18,23,32)
|
||||
REG="/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc"
|
||||
BOLD="/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc"
|
||||
SERIF="/usr/share/fonts/opentype/noto/NotoSerifCJK-Regular.ttc"
|
||||
SERIFB="/usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc"
|
||||
def f(size,mode="regular"):
|
||||
return ImageFont.truetype({"regular":REG,"bold":BOLD,"serif":SERIF,"serifbold":SERIFB}[mode],size)
|
||||
def txt(d,xy,s,size=26,color=INK,style="regular"):
|
||||
d.text(xy,str(s),font=f(size,style),fill=color)
|
||||
def card(d,box,fill=IVORY,stroke=(220,210,195),r=24):
|
||||
d.rounded_rectangle(box,radius=r,fill=fill,outline=stroke,width=2)
|
||||
def base(dark=False):
|
||||
im=Image.new("RGB",(W,H),NIGHT if dark else IVORY)
|
||||
d=ImageDraw.Draw(im)
|
||||
if dark:
|
||||
for j in range(8):
|
||||
d.arc((880+j*32,-200+j*26,1760+j*28,1030+j*25),158,268,fill=(68+j*7,60+j*6,51+j*4),width=2)
|
||||
else:
|
||||
for j in range(7):
|
||||
d.arc((-430+j*14,-500+j*14,500+j*25,520+j*25),35,150,fill=(238,224+j*2,207+j*2),width=2)
|
||||
return im
|
||||
def rounded_image(im,src,box,focus=(.5,.5)):
|
||||
x1,y1,x2,y2=box
|
||||
crop=ImageOps.fit(src,(x2-x1,y2-y1),method=Image.Resampling.LANCZOS,centering=focus)
|
||||
mask=Image.new("L",crop.size,0)
|
||||
ImageDraw.Draw(mask).rounded_rectangle((0,0,crop.width-1,crop.height-1),radius=18,fill=255)
|
||||
im.paste(crop,(x1,y1),mask)
|
||||
ImageDraw.Draw(im).rounded_rectangle(box,radius=18,outline=(200,177,145),width=2)
|
||||
def footer(d,text,dark=False):
|
||||
txt(d,(80,855),text,18,(148,158,171) if dark else DIM)
|
||||
def make_intro():
|
||||
im=base(True);d=ImageDraw.Draw(im)
|
||||
txt(d,(94,113),"MARQDO / v2.7.1",21,(233,197,146))
|
||||
txt(d,(90,221),"Your SKILL",83,IVORY,"serifbold")
|
||||
txt(d,(90,327),"is now a",83,IVORY,"serifbold")
|
||||
txt(d,(90,435),"TOOL.",91,(244,201,148),"serifbold")
|
||||
d.line((100,562,1040,562),fill=GOLD,width=3)
|
||||
txt(d,(102,613),"不只是让 AI 阅读文档。",35,(232,230,224),"serif")
|
||||
txt(d,(102,681),"让同一份 Markdown 承载可控执行流。",35,(232,230,224),"serif")
|
||||
footer(d,"WRITE ONCE · RENDER AS MARKDOWN · INSPECT AS RUNTIME",True)
|
||||
return im
|
||||
|
||||
source=(ROOT/"examples/procurement/index.mq.md").read_text(encoding="utf8")
|
||||
assert "## 查询采购商价格" in source
|
||||
section=source.split("## 查询采购商价格",1)[1].split("\n## ",1)[0]
|
||||
excerpt="## 查询采购商价格\n"+section
|
||||
lines=excerpt.splitlines()
|
||||
content=[]
|
||||
for line in lines:
|
||||
if len(content)>=18:break
|
||||
content.append(line)
|
||||
assert len(content)>10
|
||||
md=MarkdownIt("commonmark").enable("table")
|
||||
html=md.render("\n".join(content))
|
||||
document=f"""<!DOCTYPE html><html lang='zh'><head><meta charset='utf-8'>
|
||||
<style>html,body{{margin:0;background:#fcfbf6;color:#34302d}}
|
||||
body{{font-family:'Noto Serif CJK SC',serif;padding:64px 96px;font-size:26px;line-height:1.75}}
|
||||
h2{{font-size:43px;font-weight:700;margin:0 0 33px}}
|
||||
p{{margin:17px 0}}table{{font:20px/1.7 'Noto Sans CJK SC',sans-serif;width:100%;border-collapse:collapse;margin:26px 0}}
|
||||
td,th{{padding:12px 18px;border:1px solid #e1d7c8;text-align:left}}
|
||||
th{{background:#efe7d9}}tr:nth-child(even){{background:#f7f2e9}}em{{color:#8c704f}}
|
||||
</style></head><body>{html}</body></html>"""
|
||||
opts=Options()
|
||||
for arg in ["--headless=new","--no-sandbox","--disable-dev-shm-usage","--disable-gpu","--window-size=1450,1600"]:
|
||||
opts.add_argument(arg)
|
||||
browser=webdriver.Chrome(options=opts)
|
||||
try:
|
||||
browser.set_window_size(1450,1600)
|
||||
browser.get("data:text/html;charset=utf-8,"+__import__("urllib.parse",fromlist=["quote"]).quote(document))
|
||||
htmlscreen=A/"marqdo-procurement-standard-markdown.png"
|
||||
browser.save_screenshot(str(htmlscreen))
|
||||
assert htmlscreen.stat().st_size>20000
|
||||
finally:
|
||||
browser.quit()
|
||||
RENDER=Image.open(htmlscreen).convert("RGB")
|
||||
USER=Image.open(A/"user-procurement-view.png").convert("RGB")
|
||||
CONCEPT=Image.open(A/"source-markdown-view-concept.png").convert("RGB")
|
||||
|
||||
def make_source():
|
||||
im=base(True);d=ImageDraw.Draw(im)
|
||||
txt(d,(78,69),"01 / SOURCE",21,(226,192,141))
|
||||
txt(d,(77,123),"源码态:它本来就是 Markdown",54,IVORY,"serifbold")
|
||||
txt(d,(80,209),"普通段落保持可读,标题、参数表和返回契约仍是 Markdown。",28,(187,198,213))
|
||||
card(d,(75,265,1520,797),(28,38,51),(78,89,105),23)
|
||||
card(d,(76,265,1519,332),(43,53,70),(43,53,70),23)
|
||||
for j,col in enumerate([(190,97,91),(224,173,97),(109,173,130)]):
|
||||
d.ellipse((105+j*33,293,122+j*33,310),fill=col)
|
||||
txt(d,(256,282),"index.mq.md · 查询采购商价格",24,(227,227,222))
|
||||
for i,line in enumerate(content[:16]):
|
||||
value=line[:77].replace("\t"," ")
|
||||
clr=(232,193,133) if value.startswith("#") or "返回" in value else ((164,214,201) if "正常" in value else (221,226,230))
|
||||
txt(d,(106,358+i*25),f"{i+1:02d} {value}",20,clr)
|
||||
footer(d,"ACTUAL .mq.md EXCERPT · source: examples/procurement/index.mq.md",True)
|
||||
return im
|
||||
|
||||
def make_render():
|
||||
im=base();d=ImageDraw.Draw(im)
|
||||
txt(d,(81,69),"02 / STANDARD MARKDOWN",21,(170,126,67))
|
||||
txt(d,(77,128),"渲染态:它首先是一篇文档",56,INK,"serifbold")
|
||||
txt(d,(80,205),"同一段源码,无需定制语法高亮,也可以按 Markdown 阅读。",29,DIM)
|
||||
card(d,(80,265,1516,839),(255,254,251))
|
||||
rounded_image(im,RENDER,(120,290,1469,814),(.5,.19))
|
||||
txt(ImageDraw.Draw(im),(1145,280),"STANDARD MARKDOWN",18,(167,115,55))
|
||||
footer(ImageDraw.Draw(im),"A MARKDOWN-IT RENDER · FROM THE SAME SOURCE")
|
||||
return im
|
||||
|
||||
def make_triple():
|
||||
im=base();d=ImageDraw.Draw(im)
|
||||
txt(d,(75,60),"03 / THREE VIEWS, ONE FILE",21,(170,126,67))
|
||||
txt(d,(76,130),"同一份 .mq.md,三种视图",55,INK,"serifbold")
|
||||
txt(d,(81,211),"源码能编写,Markdown 能阅读,View 能看到函数、值和执行依赖。",27,DIM)
|
||||
screens=[("SOURCE / 源码",make_source()),("MARKDOWN / 渲染",RENDER),("VIEW / 执行",USER)]
|
||||
xlist=[75,578,1081]
|
||||
for i,(label,src) in enumerate(screens):
|
||||
x=xlist[i];tw=442
|
||||
card(d,(x,280,x+tw,777),(255,254,250))
|
||||
txt(d,(x+21,301),label,23,(130,95,56))
|
||||
rounded_image(im,src,(x+15,349,x+tw-15,749),(.50,.38))
|
||||
d=ImageDraw.Draw(im)
|
||||
for x in [523,1026]:
|
||||
d.line((x,530,x+49,530),fill=GOLD,width=4)
|
||||
d.polygon([(x+49,530),(x+32,519),(x+32,541)],fill=GOLD)
|
||||
footer(d,"NOT THREE FILES · ONE DOCUMENT + EXECUTION SEMANTICS")
|
||||
return im
|
||||
|
||||
def make_concept():
|
||||
im=base();d=ImageDraw.Draw(im)
|
||||
txt(d,(72,58),"04 / DESIGN LANGUAGE",21,(170,126,67))
|
||||
rounded_image(im,CONCEPT,(55,112,1545,850),(.5,.5))
|
||||
txt(ImageDraw.Draw(im),(92,855),"CONCEPT ART · Source → Rendered Markdown → Marqdo View",18,DIM)
|
||||
return im
|
||||
|
||||
def make_view():
|
||||
im=base();d=ImageDraw.Draw(im)
|
||||
txt(d,(78,62),"05 / REAL MARQDO VIEW",21,(170,126,67))
|
||||
txt(d,(78,127),"在文档上,看见它的执行流",58,INK,"serifbold")
|
||||
txt(d,(80,216),"自然语言依然是主体,执行信息沿优雅的曲线引出。",28,DIM)
|
||||
card(d,(70,278,1530,841),(255,254,250))
|
||||
rounded_image(im,USER,(88,295,1513,817),(.50,.50))
|
||||
footer(ImageDraw.Draw(im),"ACTUAL VIEW SCREENSHOT · PROVIDED BY THE PROJECT AUTHOR")
|
||||
return im
|
||||
|
||||
def make_execution():
|
||||
im=base(True);d=ImageDraw.Draw(im)
|
||||
txt(d,(80,66),"06 / EXECUTABLE FUNCTIONS",21,(230,192,137))
|
||||
txt(d,(80,132),"在哪里执行?就在同一份文档的函数里。",53,IVORY,"serifbold")
|
||||
txt(d,(84,216),"说明是可读的,规则却会通过函数调用实际检查。",28,(183,198,211))
|
||||
card(d,(76,275,1519,367),(30,42,57),(78,88,100))
|
||||
txt(d,(99,303),"marqdo call examples/procurement/index.mq.md 查询余额 已花费=120",25,(233,218,188))
|
||||
card(d,(76,418,760,775),(25,55,48),(70,124,96))
|
||||
card(d,(790,418,1520,775),(58,34,43),(154,85,96))
|
||||
txt(d,(110,455),"PASS / LOCAL SIMULATION",24,(150,227,185))
|
||||
txt(d,(822,455),"DENIED / BUDGET CHECK",24,(249,164,170))
|
||||
txt(d,(112,533),"¥120 + ¥288",43,IVORY)
|
||||
txt(d,(823,533),"¥360 + ¥288",43,IVORY)
|
||||
txt(d,(113,606),"¥408",86,(146,229,185),"bold")
|
||||
txt(d,(823,606),"¥648",86,(250,162,166),"bold")
|
||||
txt(d,(115,720),"ok: true · 本地模拟,未发送",23,(217,237,224))
|
||||
txt(d,(824,720),"ok: false · 超预算拒绝",23,(248,216,217))
|
||||
footer(d,"OUTCOMES VERIFIED WITH MARQDO 2.7.1 CLI · NO REAL ORDER WAS SENT",True)
|
||||
return im
|
||||
|
||||
def make_outro():
|
||||
im=base(True);d=ImageDraw.Draw(im)
|
||||
txt(d,(97,157),"Marqdo",90,IVORY,"serifbold")
|
||||
txt(d,(98,313),"Write it. Read it. Run it.",61,(238,195,136),"serifbold")
|
||||
d.line((99,431,1480,431),fill=GOLD,width=3)
|
||||
txt(d,(101,500),"A document-native runtime for executable AI skills.",31,(217,221,225))
|
||||
txt(d,(101,649),"github.com/cflmy/marqdo",43,IVORY)
|
||||
footer(d,"Marqdo v2.7.1 · Apache 2.0 · simulated procurement demo",True)
|
||||
return im
|
||||
|
||||
slides=[make_intro(),make_source(),make_render(),make_triple(),make_concept(),make_view(),make_execution(),make_outro()]
|
||||
A.mkdir(parents=True,exist_ok=True)
|
||||
slides[0].save(POSTER,quality=95)
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
tmp=Path(tmp);clips=[]
|
||||
for i,(still,dur) in enumerate(zip(slides,D)):
|
||||
imagefile=tmp/f"slide_{i:02d}.png"
|
||||
still.save(imagefile)
|
||||
clip=tmp/f"clip_{i:02d}.mp4"
|
||||
filt=f"scale=1280:720,zoompan=z='min(zoom+0.00016,1.02)':x='iw/2-iw/zoom/2':y='ih/2-ih/zoom/2':d=1:s=1280x720:fps=24,fade=t=in:st=0:d=0.4,fade=t=out:st={dur-.5}:d=0.5,format=yuv420p"
|
||||
cmd=["ffmpeg","-y","-hide_banner","-loglevel","error","-loop","1","-framerate","24","-t",str(dur),"-i",str(imagefile),"-vf",filt,"-an","-c:v","libx264","-preset","veryfast","-crf","19","-pix_fmt","yuv420p",str(clip)]
|
||||
subprocess.run(cmd,check=True,timeout=200)
|
||||
clips.append(clip)
|
||||
print("RENDERED_SLIDE",i,flush=True)
|
||||
playlist=tmp/"concat.txt"
|
||||
playlist.write_text("\n".join(f"file '{c}'" for c in clips)+"\n")
|
||||
silent=tmp/"silent.mp4"
|
||||
subprocess.run(["ffmpeg","-y","-hide_banner","-loglevel","error","-f","concat","-safe","0","-i",str(playlist),"-c","copy",str(silent)],check=True,timeout=90)
|
||||
sr=24000
|
||||
total=sum(D);ts=np.arange(int(total*sr))/sr
|
||||
sound=np.zeros(len(ts))
|
||||
at=0.
|
||||
for i,dur in enumerate(D):
|
||||
mask=(ts>=at)&(ts<at+dur);tt=ts[mask]-at
|
||||
a=np.minimum(np.minimum(tt/.8,(dur-tt)/.8),1).clip(0,1)
|
||||
note=[110.,123.47,130.81,146.83,110.,123.47,130.81,110.][i]
|
||||
sound[mask]+=a*.12*(.55*np.sin(2*np.pi*note*tt)+.2*np.sin(2*np.pi*note*1.5*tt)+.12*np.sin(2*np.pi*note*2*tt))
|
||||
at+=dur
|
||||
sound*=np.minimum(np.minimum(ts/1.2,(total-ts)/1.2),1).clip(0,1)
|
||||
wav=tmp/"ambience.wav"
|
||||
with wave.open(str(wav),"wb") as w:
|
||||
w.setnchannels(1);w.setsampwidth(2);w.setframerate(sr)
|
||||
w.writeframes((sound*32767).astype(np.int16).tobytes())
|
||||
subprocess.run(["ffmpeg","-y","-hide_banner","-loglevel","error","-i",str(silent),"-i",str(wav),"-c:v","copy","-c:a","aac","-b:a","160k","-shortest","-movflags","+faststart",str(OUT)],check=True,timeout=90)
|
||||
|
||||
times=[0,4.8,11.6,18,25,32.5,42,50.8,56]
|
||||
messages=[
|
||||
"Your SKILL is now a TOOL.\n让 Markdown 直接承载可执行语义。",
|
||||
"源码态:标题、段落、表格都沿用 Markdown。\n执行逻辑就在文档之中。",
|
||||
"渲染态:同一份代码也能成为普通 Markdown 文档。",
|
||||
"源码态、标准 Markdown 渲染态、Marqdo View 态。\n三种视图,同一份源文件。",
|
||||
"一份 .mq.md,既可以阅读,也可以编译执行。",
|
||||
"真实 View 截图:函数调用和值沿着优雅曲线呈现。",
|
||||
"预算校验不是文字承诺,而是函数执行。\n模拟订单通过或拒绝,均由运行时返回结果。",
|
||||
"Marqdo 2.7.1 · github.com/cflmy/marqdo"
|
||||
]
|
||||
def stamp(s):
|
||||
ms=int(round(s*1000))
|
||||
h=ms//3600000;ms%=3600000;m=ms//60000;ms%=60000
|
||||
return f"{h:02d}:{m:02d}:{ms//1000:02d},{ms%1000:03d}"
|
||||
SRT.write_text("\n\n".join(f"{i+1}\n{stamp(times[i])} --> {stamp(times[i+1])}\n{msg}" for i,msg in enumerate(messages))+"\n",encoding="utf-8")
|
||||
print("VIDEO",OUT,OUT.stat().st_size)
|
||||
print("COVER",POSTER,POSTER.stat().st_size)
|
||||
print("SRT",SRT,SRT.stat().st_size)
|
||||
assert OUT.stat().st_size>800000 and sum(D)==56
|
||||
Reference in new issue
Block a user