Brandon > Alice
This commit is contained in:
@@ -56,7 +56,7 @@ MD_FILES: dict[str, str] = {
|
||||
|
||||
# Grouped cameo handles (see Story/Cameo-Creatures.md). Slug = folder under Story/pfp/<slug>/.
|
||||
CAMEO_ROSTER: dict[str, list[str]] = {
|
||||
"cameo-branndon": ["branndongames", "experimenta1ic3"],
|
||||
"cameo-experimenta1ic3": ["branndongames", "experimenta1ic3"],
|
||||
"cameo-noncritical": ["noncriticalmother", "noncriticalgamingttv"],
|
||||
"cameo-pirate": ["pirate_protogen"],
|
||||
"cameo-foxy": ["foxy_fnaf5_ucn"],
|
||||
|
||||
@@ -490,11 +490,11 @@ def blob_to_prism_data_patch(blob: dict[str, Any], *, title: str) -> dict[str, A
|
||||
attrs[api] = str(v).strip()
|
||||
|
||||
if attrs:
|
||||
patch["attributes"] = attrs
|
||||
vq = attrs.get("voice_quality")
|
||||
if vq:
|
||||
patch["voice"] = {"instructions": vq}
|
||||
patch["voice_instructions"] = vq
|
||||
attrs["voice"] = {"instructions": vq}
|
||||
attrs["voice_instructions"] = vq
|
||||
patch["attributes"] = attrs
|
||||
|
||||
phys_desc = _blob_narrative(blob, "appearance", "Physical Description") or _blob_combined_text(
|
||||
blob, "appearance", "Physical Description"
|
||||
@@ -672,6 +672,30 @@ def _apply_prism_data_patch(inner: dict[str, Any], patch: dict[str, Any]) -> dic
|
||||
return out
|
||||
|
||||
|
||||
_READONLY_CHARACTER_FIELDS = frozenset({"created_at", "updated_at"})
|
||||
|
||||
|
||||
def _strip_readonly_character_fields(data: dict[str, Any]) -> dict[str, Any]:
|
||||
out = dict(data)
|
||||
for k in _READONLY_CHARACTER_FIELDS:
|
||||
out.pop(k, None)
|
||||
return out
|
||||
|
||||
|
||||
def _prism_write_payload(merged: dict[str, Any]) -> dict[str, Any]:
|
||||
"""Body for PUT/PATCH: never send GET-only keys like `success`; strip server timestamps from `data`."""
|
||||
if isinstance(merged.get("data"), dict):
|
||||
body: dict[str, Any] = {
|
||||
"data": _strip_readonly_character_fields(dict(merged["data"])),
|
||||
}
|
||||
for k, v in merged.items():
|
||||
if k in ("data", "success"):
|
||||
continue
|
||||
body[k] = v
|
||||
return body
|
||||
return {k: v for k, v in merged.items() if k != "success"}
|
||||
|
||||
|
||||
SYNC_SKIP_MANUAL = frozenset(
|
||||
{"Adrian.md", "Agate.md", "Azure.md", "Beanie.md", "RaincloudTheDragon.md"}
|
||||
)
|
||||
@@ -934,10 +958,11 @@ def cmd_sync(args: argparse.Namespace) -> int:
|
||||
args.attach_field,
|
||||
_attach_value(merged, args.attach_field, blob),
|
||||
)
|
||||
payload = json.dumps(merged, ensure_ascii=False).encode("utf-8")
|
||||
write_obj = _prism_write_payload(merged)
|
||||
payload = json.dumps(write_obj, ensure_ascii=False).encode("utf-8")
|
||||
pc, pbody = _req("PUT", detail_url, data=payload, headers=_full_headers(json_body=True))
|
||||
if pc not in (200, 204):
|
||||
patch_body = _minimal_patch(args, merged, prism_patch if args.map_md else None)
|
||||
patch_body = _minimal_patch(args, write_obj, prism_patch if args.map_md else None)
|
||||
pc2, pbody2 = _req(
|
||||
"PATCH",
|
||||
detail_url,
|
||||
@@ -967,7 +992,7 @@ def _minimal_patch(
|
||||
prism_patch: dict[str, Any] | None = None,
|
||||
) -> dict[str, Any]:
|
||||
if args.map_md and prism_patch is not None:
|
||||
return {"data": merged.get("data", {})}
|
||||
return {"data": merged.get("data", {})} if isinstance(merged.get("data"), dict) else merged
|
||||
if args.experimental_merge:
|
||||
return merged
|
||||
key = args.attach_field or ""
|
||||
|
||||
Reference in New Issue
Block a user