From 9db0a8a4d43b30bf508f38bcbfdd2ab5f3298118 Mon Sep 17 00:00:00 2001 From: selfrelease Date: Sun, 14 Jun 2026 19:31:42 +0800 Subject: [PATCH] =?UTF-8?q?demo(seed):=20=E9=80=81=E5=AE=A1=E6=90=BA?= =?UTF-8?q?=E5=B8=A6=E5=88=86=E9=9B=86=E5=93=88=E5=B8=8C=EF=BC=8C=E6=BC=94?= =?UTF-8?q?=E7=A4=BA=E4=B8=80=E5=89=A7=E4=B8=80=E7=A0=81+=E9=9B=86?= =?UTF-8?q?=E7=BA=A7=E5=93=88=E5=B8=8C=E8=90=BD=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - seed_demo.sh: 每剧提交6集独立哈希(file/merkle/perceptual+分辨率/时长) - 修复演示数据只有整剧哈希、无集级绑定的问题 - 验证: 3剧×6集集级哈希落 hash_binding(episode>0),集级验真 match/mismatch 正常 --- tcs-iptv/scripts/seed_demo.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tcs-iptv/scripts/seed_demo.sh b/tcs-iptv/scripts/seed_demo.sh index f860fe5..d7337fb 100644 --- a/tcs-iptv/scripts/seed_demo.sh +++ b/tcs-iptv/scripts/seed_demo.sh @@ -21,12 +21,24 @@ call() { # key secret method path body } field() { echo "$1" | sed -n "s/.*\"$2\":\"\([^\"]*\)\".*/\1/p"; } -# 一条内容完整流转:title category fhash cp_id cp_name op_id op_name cdn +# episodes_json base_hash count → 构造分集哈希数组(一剧一码 + 集级独立哈希) +episodes_json() { + local fh="$1" n="${2:-6}" i out="" + for i in $(seq 1 "$n"); do + [ -n "$out" ] && out="$out," + out="$out{\"episode\":$i,\"file_sha256\":\"$fh-E$i\",\"merkle_root\":\"mr-$fh-E$i\",\"perceptual_hash\":\"ph-$fh-E$i\",\"resolution\":\"1080p\",\"duration\":2400}" + done + echo "[$out]" +} + +# 一条内容完整流转:title category fhash cp_id cp_name op_id op_name cdn [episodes] flow() { local title="$1" cat="$2" fh="$3" cpid="$4" cpname="$5" opid="$6" opname="$7" cdn="$8" - echo ">>> [$title] CP=$cpname" + local n="${9:-6}" + echo ">>> [$title] CP=$cpname ($n 集,每集独立哈希)" + local eps; eps=$(episodes_json "$fh" "$n") local reg; reg=$(call ak-cp sk-cp POST /content/register \ - "{\"title\":\"$title\",\"episode_count\":24,\"category\":\"$cat\",\"file_sha256\":\"$fh\",\"merkle_root\":\"mr-$fh\",\"perceptual_hash\":\"ph-$fh\",\"cp_media_id\":\"$cpid\",\"cp_name\":\"$cpname\"}") + "{\"title\":\"$title\",\"episode_count\":$n,\"category\":\"$cat\",\"file_sha256\":\"$fh\",\"merkle_root\":\"mr-$fh\",\"perceptual_hash\":\"ph-$fh\",\"episodes\":$eps,\"cp_media_id\":\"$cpid\",\"cp_name\":\"$cpname\"}") local rid ctid; rid=$(field "$reg" review_id); ctid=$(field "$reg" content_twin_id) # CSPS 合规审核(发码前)