import json
M = "/media/"


def ja(ep, title, desc, calt, alts, body, pub, v2c=False):
    return {"slug": f"ep{ep}", "title": title, "label": f"MANGA EP{ep}", "character": "ハコブくん", "description": desc, "published": pub,
            "cover": M + (f"manga_ep{ep}_cover_v2_c24b.webp" if v2c else f"manga_ep{ep}_cover_c24b.webp"), "comic": "", "cover_alt": calt, "comic_alt": "",
            "format": "vertical", "panels": [M + f"manga_ep{ep}_p{k}_c24b.webp" for k in range(1, 5)], "panel_alts": alts, "body": body}


def en(ep, title, desc, calt, alts, body, pub, v2c=False):
    return {"slug": f"ep{ep}", "title": title, "label": f"MANGA EP{ep}EN", "character": "ハコブくん", "description": desc, "published": pub,
            "cover": M + (f"manga_ep{ep}en_cover_v2_enw.webp" if v2c else f"manga_ep{ep}en_cover_enw.webp"), "comic": "", "cover_alt": calt, "comic_alt": "",
            "format": "vertical", "panels": [M + f"manga_ep{ep}en_p{k}_enw.webp" for k in range(1, 5)], "panel_alts": alts, "body": body}


J = []; E = []
J.append(ja(8, "見慣れた形は、見慣れた使い方を呼ぶ",
 "病室のベッドで、森田久美子さんがリモコンを向けたのはテレビではなくハコブくん。カチカチ押しても、チャンネルは変わらない。画面と台がそろうと、人はテレビだと思う。形が呼ぶ使い方を描く4コマ漫画、第8話。",
 "第8話 最新鋭と最年長の表紙。リモコンを向けられて、きょとんとするハコブくん",
 ["病室のベッドで、リモコンを手に黙り込む久美子さん", "久美子さんのそばへ、ハコブくんがスッと来る", "ハコブくんにリモコンを向けて、カチカチ押す久美子さん", "首をかしげるハコブくんと、戸口で笑う大城さん"],
 '<p>■ 画面があれば、テレビに見える<br>病室のベッドで、森田久美子さんがリモコンを手に黙り込んでいる。そこへハコブくんがスッと来る。久美子さんはハコブくんにリモコンを向けて、カチカチ押す。あらやだ、全然チャンネル変わらないわねぇ。？？？。戸口の大城さんが笑う。森田さん、それテレビじゃないのよ…。</p><p></p><p>■ 人は知っている物に当てはめて見る<br><a href="https://pure.psu.edu/en/publications/mental-models-of-robots-among-senior-citizens-an-interview-study--2/">高齢者45人へのインタビュー調査（ペンシルベニア州立大学）</a>では、ロボットについての思い描き方は、最近使った通信機器やメディアで見たロボットの姿から作られていた。</p><p></p><p>■ 結論：見慣れた形は、見慣れた使い方を呼ぶ<br>画面と台があれば、人はテレビだと思う。ロボットの形を決めるときは、何に見えるか、どう使えそうに見えるかまで確かめる。</p>',
 "2026-11-23T02:10:00.000Z"))
E.append(en(8, "A Familiar Shape Invites a Familiar Use",
 "In a hospital room, Mrs. Morita points the remote not at the TV but at Hakobukun. Click, click. \"The channel won't change.\" A screen on a stand looks like a TV. A manga on what a robot's shape invites people to do.",
 "Episode 8 cover: It's not a TV. Hakobukun is puzzled as a remote is pointed at it",
 ["Mrs. Morita sits silently in bed holding a remote", "Hakobukun glides up beside her", "Mrs. Morita points the remote at Hakobukun and clicks", "Hakobukun is puzzled as Nurse Oshiro laughs at the door"],
 '<p>■ A screen looks like a TV<br>In a hospital room, Mrs. Morita sits in bed with a remote in her hand. Hakobukun glides over. She points the remote at it and clicks. "Oh my, the channel won\'t change at all." "???" Nurse Oshiro laughs at the door. "Mrs. Morita, that\'s not a TV…"</p><p></p><p>■ People read new things through things they know<br>In <a href="https://pure.psu.edu/en/publications/mental-models-of-robots-among-senior-citizens-an-interview-study--2/">an interview study of 45 senior citizens (Penn State)</a>, their ideas of robots were shaped by recent experiences with communication technologies and by robots in popular culture.</p><p></p><p>■ Conclusion: A familiar shape invites a familiar use<br>A screen on a stand looks like a TV. When choosing a robot\'s shape, check what it looks like and how people will expect to use it.</p>',
 "2026-11-23T02:11:00.000Z"))
J.append(ja(36, "練習の部屋は、スマホで撮って作れる",
 "どこで練習したのとハコブくんが聞くと、ツカムくんはノートパソコンを指した。画面の中には、スマホで撮って写した同じ部屋。そこで何度も失敗して、現実では一度でつかむ。R2R2R の考え方を描く4コマ漫画、第36話。",
 "第36話 なぜスマホから始まるのかの表紙。ノートパソコンに映った同じ部屋を見るハコブくんとツカムくん",
 ["どこで練習したのか聞くハコブくんと、作業台のツカムくん", "ノートパソコンの画面に、同じ部屋と同じ台が映っている", "画面の中のツカムくんが、積み木を何度も落とす", "現実のツカムくんが、積み木を一度でつかむ"],
 '<p>■ 練習した場所は、画面の中<br>ツカムクンッテ、ドコデ練習シタノ？ ツカムくんはノートパソコンを指す。画面には、この部屋とそっくりの部屋と台。コレ、ココ？ スマホで撮って、部屋ごと写した。画面の中のツカムくんは、積み木を何度も落とす。失敗バッカリ…。画面の中なら、壊れない。</p><p></p><p>■ スマホの映像からロボットの練習データを作る<br><a href="https://arxiv.org/abs/2505.09601">Real2Render2Real（カリフォルニア大学バークレー校ほか、2025年）</a>は、スマホで撮った物の3Dスキャンと、人が1回やって見せた動画から、ロボットの練習データを何千通りも作る。ロボットの実機も、物理の計算も使わない。</p><p></p><p>■ 結論：練習の部屋は、スマホで撮って作れる<br>現実のツカムくんは、積み木を一度でつかむ。スマホカラ始メレバ、誰デモ練習ノ部屋ガ作レル。まず、撮るところから。</p>',
 "2026-11-23T02:12:00.000Z"))
E.append(en(36, "Build a Practice Room With a Phone Camera",
 "Hakobukun asks where Tsukamukun practiced. Tsukamukun points to a laptop: inside is the same room, copied from phone photos. It fails there again and again, then grabs the block on its first real try.",
 "Episode 36 cover: Start with a phone. Hakobukun and Tsukamukun look at the same room on a laptop",
 ["Hakobukun asks Tsukamukun on its work table where it practiced", "The laptop screen shows the same room and the same table", "On screen, the digital Tsukamukun drops blocks again and again", "The real Tsukamukun grabs the block on the first try"],
 '<p>■ It practiced inside the screen<br>"Tsukamu, where did you practice?" Tsukamukun points to the laptop. On the screen is a room just like this one. "Is this… here?" "I took photos with a phone and copied the whole room." On screen, the digital Tsukamukun drops the blocks again and again. "All failures…" "Inside the screen, nothing breaks."</p><p></p><p>■ Robot training data from phone footage<br><a href="https://arxiv.org/abs/2505.09601">Real2Render2Real (UC Berkeley and others, 2025)</a> takes a smartphone scan of objects and one video of a person doing the task, and generates thousands of robot training demonstrations without robot hardware or physics simulation.</p><p></p><p>■ Conclusion: Build a practice room with a phone camera<br>The real Tsukamukun grabs the block on its first try. "Start with a phone, and anyone can build a practice room." "First, take the photos."</p>',
 "2026-11-23T02:13:00.000Z"))
J.append(ja(158, "線の上なら迷わないが、線を空ける手間が増える",
 "迷わないように、床に貼った線の上だけを走らせることにしたハコブくん。ところが線の上にワゴンが置かれると、横が空いていても進めない。決まった道を走らせる代わりに増える手間を描く4コマ漫画、第158話。",
 "第158話 線の上の表紙。線の上のワゴンの前で止まるハコブくんと、腰に手を当てる寺島さん",
 ["床に黒い線を貼る槙原さん", "線の上に置かれたワゴンの前で止まるハコブくんと、電話中の寺島さん", "横が空いていても進めないハコブくんと、あきれる寺島さん", "線の上に物を置かないよう貼り紙をする槙原さんと、苦笑いの寺島さん"],
 '<p>■ 線の上しか走れない<br>槙原さんが床に線を貼る。この線の上だけ走らせれば、迷いません。次の日、寺島さんが電話の間、線の上に空のワゴンを置いた。線ノ上ニ、物ガアリマス。横は空いている。よければいいじゃない。線ノ外ハ、走レマセン。</p><p></p><p>■ 床の線で導く方式の弱み<br><a href="https://www.control.eee.dendai.ac.jp/study2.pdf">東京電機大学の研究室の資料（PDF）</a>は、床の磁気テープで導く無人搬送車について、レイアウトの変更や障害物への対応が難しいと説明している。</p><p></p><p>■ 結論：線の上なら迷わないが、線を空ける手間が増える<br>槙原さんは、線の上に物を置かないよう貼り紙をした。迷わない代わりに、線を空けておく仕事が私たちに来たのね。その仕事も、数に入れて選びます。</p>',
 "2026-11-23T02:14:00.000Z"))
E.append(en(158, "Following a Line Means Keeping the Line Clear",
 "To keep Hakobukun from getting lost, it now runs only on a line taped to the floor. But when a wagon is left on the line, it cannot move, even with room to go around. A manga on the extra work a fixed path creates.",
 "Episode 158 cover: Only on the line. Hakobukun stops before a wagon on the line as Nurse Terashima stands with a hand on her hip",
 ["Makihara tapes a black line on the floor", "Hakobukun stops before a wagon left on the line while Terashima is on the phone", "Hakobukun cannot go around even with space beside it; Terashima is exasperated", "Makihara puts up a notice to keep the line clear as Terashima smiles wryly"],
 '<p>■ It can only run on the line<br>Makihara tapes a line on the floor. "If it only runs on this line, it won\'t get lost." The next day, Terashima leaves an empty wagon on the line during a call. "Something is on the line." There is room beside it. "Just go around it!" "I can\'t run off the line."</p><p></p><p>■ The weak spot of floor-guided robots<br><a href="https://www.control.eee.dendai.ac.jp/study2.pdf">Material from a lab at Tokyo Denki University (PDF, Japanese)</a> explains that vehicles guided by magnetic tape on the floor have trouble with layout changes and obstacles.</p><p></p><p>■ Conclusion: Following a line means keeping the line clear<br>Makihara puts up a notice not to leave things on the line. "So keeping the line clear became our job." "I\'ll count that work too when we choose."</p>',
 "2026-11-23T02:15:00.000Z"))
J.append(ja(159, "近づいたら知らせる仕組みで、操作する人の手を空ける",
 "外来の受付に立つピカリくん。操作する人は、案内しながら書類も片付けるつもりだった。でも、いつ人が来るか分からず、一日じゅう画面の番に。待つ時間の使い方を描く4コマ漫画、第159話。",
 "第159話 画面ばかり見てしまうの表紙。受付で待つピカリくんと、ペンが止まった操作する人の手",
 ["受付で待つピカリくんと、窓口の寺島さん。小窓には書類の山の前の操作する人", "ロビーを見張るピカリくん。小窓では、ペンが紙の上で止まっている", "夕方のロビーで、寺島さんとピカリくん。小窓では、白紙の前で肩を落とす操作する人", "呼ばれたら戻ると告げるピカリくん。小窓では、書類を書き進める手"],
 '<p>■ 画面から目が離せない<br>外来の受付に立つピカリくん。操作する人は、案内しながら、書類も片付けちゃおう、と思っていた。でもペンが止まる。…今、誰か来た？ 夕方。今日、ピカリくん暇そうだったね。一日、画面の番をしてただけ…。</p><p></p><p>■ 1人で何台も受け持つ<br><a href="https://aismiley.co.jp/ai_news/ai-lab-robot-15/">サイバーエージェントの AI Lab の実証（2026年）</a>では、大型商業施設に15体の接客アバターを置き、ふだんは自律で動かして、1人のオペレーターがまとめて遠隔で受け持った。</p><p></p><p>■ 結論：近づいたら知らせる仕組みで、操作する人の手を空ける<br>次の週から、人がピカリくんに近づくと操作する人に音が届き、回線が切れたら窓口のランプが光るようにした。呼バレタラ、スグ戻リマス。</p>',
 "2026-11-23T02:16:00.000Z", v2c=True))
E.append(en(159, "Free the Operator's Hands With an Alert When Someone Comes",
 "Pikarikun stands at outpatient reception. Its operator planned to do paperwork while guiding. But with no way to know when someone will come, she ends up watching the screen all day.",
 "Episode 159 cover: Watching the screen. Pikarikun waits at reception as the operator's pen stays frozen",
 ["Pikarikun waits at reception beside Nurse Terashima; in the inset, the operator faces a stack of papers", "Pikarikun watches the lobby; in the inset, the pen stays frozen above the paper", "Terashima and Pikarikun in the evening lobby; in the inset, the operator slumps over blank papers", "Pikarikun says it will be right back when called; in the inset, a hand writes quickly"],
 '<p>■ Can\'t look away from the screen<br>Pikarikun stands at outpatient reception. Its operator thinks, "I\'ll clear the paperwork while I guide." But the pen stops. "…Did someone come?" In the evening: "Pikari looked bored today." "I just watched the screen all day…"</p><p></p><p>■ One operator for many robots<br>In <a href="https://aismiley.co.jp/ai_news/ai-lab-robot-15/">a 2026 trial by CyberAgent\'s AI Lab (Japanese)</a>, 15 customer-service avatars were placed in a large shopping complex, ran autonomously, and were overseen remotely by a single operator.</p><p></p><p>■ Conclusion: Free the operator\'s hands with an alert when someone comes<br>From the next week, a sound reaches the operator when someone approaches Pikarikun, and a lamp lights at the counter if the connection drops. "If you call me, I\'ll be right back."</p>',
 "2026-11-23T02:17:00.000Z", v2c=True))
J.append(ja(160, "受け取りに出る手間まで、運ぶ仕事に数える",
 "検体を届けたハコブくん。でも検査室の槙原さんは、そのたびに手袋を外して廊下へ取りに出る。本番なら一日に何十回。届いた先の受け取りまでを描く4コマ漫画、第160話。",
 "第160話 取りに出るの表紙。壁の受け渡し口から検体を受け取るツカムくんと、伸びをする槙原さん",
 ["廊下で検体を届けたと告げるハコブくんと、扉の奥の槙原さん", "手袋を外して廊下に出て、ハコブくんの引き出しから検体を取る槙原さん", "鳴る機械と廊下の間を走る槙原さんと、待ちぼうけのツカムくん", "壁の受け渡し口から検体を受け取るツカムくんと、椅子で伸びをする槙原さん"],
 '<p>■ 届いても、取りに出る<br>模擬の検体で配送を試す検査室。廊下でハコブくんが止まる。検体ヲ、オ届ケシマシタ。槙原さんは手袋を外して廊下に出て、引き出しから容器を取る。本番だと、これが1日に何十回…。次の到着の知らせと、機械の呼び出し音が重なる。</p><p></p><p>■ 受け取りの手間を減らす作り<br><a href="https://www.panasonic.com/jp/company/ppe/hospitrail.html">パナソニックの搬送ロボット HOSPI Trail</a>は、導入した病院の要望から、搬送先でカートを切り離して置いていく形を作った。</p><p></p><p>■ 結論：受け取りに出る手間まで、運ぶ仕事に数える<br>壁に、指を守るふた付きの受け渡し口を付けた。止まったハコブくんから、中のツカムくんが容器を受け取る。中マデ、届キマシタ。出なくていいって、いいな。</p>',
 "2026-11-23T02:18:00.000Z"))
E.append(en(160, "Count Going Out to Collect as Part of the Delivery",
 "Hakobukun delivers samples. But each time, Makihara in the lab takes off his gloves and goes out to the corridor to collect them. In real use, dozens of times a day.",
 "Episode 160 cover: Going out to get it. Tsukamukun takes a sample through a wall hatch as Makihara stretches",
 ["Hakobukun announces the delivery in the corridor; Makihara works inside", "Makihara takes off his gloves and takes the sample from Hakobukun's drawer", "Makihara runs between a beeping analyzer and the corridor while Tsukamukun waits", "Tsukamukun takes the sample through a wall hatch as Makihara stretches on a stool"],
 '<p>■ Delivered, but someone still has to go out<br>The lab is testing deliveries with mock samples. Hakobukun stops in the corridor. "Samples delivered." Makihara takes off his gloves, goes out, and takes the container from the drawer. "In real use, this is dozens of times a day…" The next arrival notice overlaps with the analyzer\'s alarm.</p><p></p><p>■ Designing to cut the receiving work<br><a href="https://www.panasonic.com/jp/company/ppe/hospitrail.html">Panasonic\'s HOSPI Trail delivery robot (Japanese)</a> was built from hospital requests to detach and leave its cart at the destination.</p><p></p><p>■ Conclusion: Count going out to collect as part of the delivery<br>A pass-through hatch with a finger-safe cover is built into the wall. Tsukamukun takes the container from the stopped Hakobukun. "All the way inside." "Not having to go out—nice."</p>',
 "2026-11-23T02:19:00.000Z"))

for d in J: json.dump(d, open(f'src/data/manga/{d["slug"]}.json', 'w'), ensure_ascii=False)
for d in E: json.dump(d, open(f'src/data/english/{d["slug"]}.json', 'w'), ensure_ascii=False)
CK = ['slug', 'title', 'label', 'character', 'description', 'published', 'cover', 'comic', 'cover_alt', 'comic_alt']
for fn, L in [('src/data/mangaCards.json', J), ('src/data/englishCards.json', E)]:
    cards = json.load(open(fn)); have = {c['slug'] for c in cards}
    new = [{k: d[k] for k in CK} for d in sorted(L, key=lambda x: x['published'], reverse=True) if d['slug'] not in have]
    open(fn, 'w').write(json.dumps(new + cards, ensure_ascii=False, indent=0) + "\n")
print('ok')
