fiatjaf on Nostr: #!/usr/bin/env fish set next (head -n 1 _next_frame) echo "[eng] publishing frame ...
#!/usr/bin/env fish
set next (head -n 1 _next_frame)
echo "[eng] publishing frame $next"
# upload the image
set url (satellite-upload --sec $SECRET_KEY --base-name 'noi-' $next.png)
# format the timestamp
set minute (jq -n "$next / 60 | floor | . % 60" | string pad -w 2 -c 0)
set second (jq -n "$next % 60" | string pad -w 2 -c 0)
set timestamp "$(echo -n $minute)min$(echo -n $second)s"
# publish the event
set content "$timestamp
$url"
set event (nak event --sec $SECRET_KEY -k 1 -c $content $RELAY)
# print reference
set nevent (nak encode nevent -r $RELAY -a (nak key public $SECRET_KEY) (echo $event | jq -r .id))
echo "[eng]
https://njump.me/$nevent";
# increase count for the next run
set next (echo $next | jq 'tonumber | . + 1' | string pad -w 4 -c 0)
echo "[eng] next is $next"
echo $next > _next_frame
# update picture
nak event --sec $SECRET_KEY -k 0 -c "{\"name\":\"emperor's new groove\",\"about\":\"we are playing the entire thing\",\"picture\":\"$url\"}" $RELAY purplepag.es relay.damus.io nos.lol relay.nos.social user.kindpag.es
Published at
2024-09-26 18:52:10Event JSON
{
"id": "00008fa9de061c8a24d856de9208b6ef6e9a8eff5bd7df816d4c7aa07bad2d1f",
"pubkey": "3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d",
"created_at": 1727376730,
"kind": 1,
"tags": [
[
"client",
"gossip"
],
[
"p",
"9ca0bd7450742d6a20319c0e3d4c679c9e046a9dc70e8ef55c2905e24052340b"
],
[
"p",
"8f91d62576cfe7d1f55ec1a9ae62e61e806626a3ea2490e4e0dfe1fd56ce1a62"
],
[
"e",
"52e51539731d45eba9ccf9013e57013a0e578e1ad2829c92177bf2bc07b936cc",
"wss://nos.lol/",
"root"
],
[
"nonce",
"9223372036854779703",
"16"
]
],
"content": "#!/usr/bin/env fish\n\nset next (head -n 1 _next_frame)\necho \"[eng] publishing frame $next\"\n\n# upload the image\nset url (satellite-upload --sec $SECRET_KEY --base-name 'noi-' $next.png)\n\n# format the timestamp\nset minute (jq -n \"$next / 60 | floor | . % 60\" | string pad -w 2 -c 0)\nset second (jq -n \"$next % 60\" | string pad -w 2 -c 0)\nset timestamp \"$(echo -n $minute)min$(echo -n $second)s\"\n\n# publish the event\nset content \"$timestamp\n$url\"\nset event (nak event --sec $SECRET_KEY -k 1 -c $content $RELAY)\n\n# print reference\nset nevent (nak encode nevent -r $RELAY -a (nak key public $SECRET_KEY) (echo $event | jq -r .id))\necho \"[eng] https://njump.me/$nevent\"\n\n# increase count for the next run\nset next (echo $next | jq 'tonumber | . + 1' | string pad -w 4 -c 0)\necho \"[eng] next is $next\"\necho $next \u003e _next_frame\n\n# update picture\nnak event --sec $SECRET_KEY -k 0 -c \"{\\\"name\\\":\\\"emperor's new groove\\\",\\\"about\\\":\\\"we are playing the entire thing\\\",\\\"picture\\\":\\\"$url\\\"}\" $RELAY purplepag.es relay.damus.io nos.lol relay.nos.social user.kindpag.es\n",
"sig": "a7be91f8b39c734cecb43ab048f8a11c2f2a6766ff94cfcebdb224f0687adc6b503482dce235c8a26979884bf57a162124ab297e501507ce8006bd2267066bf5"
}