fix
This commit is contained in:
parent
adf700654b
commit
43175d3c62
@ -1,6 +1,11 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
function download_character_icon(){
|
function download_character_icon(){
|
||||||
|
|
||||||
|
t=(
|
||||||
|
"https://sketchfab.com/3d-models/super-9a80a6d6cf6f4b08906505c7f945d3ce"
|
||||||
|
)
|
||||||
|
|
||||||
t=(
|
t=(
|
||||||
"https://sketchfab.com/3d-models/cerberus-quirky-series-4379b571b5a440119d1ebaddb0711142"
|
"https://sketchfab.com/3d-models/cerberus-quirky-series-4379b571b5a440119d1ebaddb0711142"
|
||||||
"https://sketchfab.com/3d-models/chinese-dragon-quirky-series-a383d3cf5b004978ac620806558b2924"
|
"https://sketchfab.com/3d-models/chinese-dragon-quirky-series-a383d3cf5b004978ac620806558b2924"
|
||||||
@ -13,10 +18,6 @@ t=(
|
|||||||
"https://sketchfab.com/3d-models/wyvern-quirky-series-7baad217325a45b4877514b3f5924be9"
|
"https://sketchfab.com/3d-models/wyvern-quirky-series-7baad217325a45b4877514b3f5924be9"
|
||||||
)
|
)
|
||||||
|
|
||||||
t=(
|
|
||||||
"https://sketchfab.com/3d-models/super-9a80a6d6cf6f4b08906505c7f945d3ce"
|
|
||||||
)
|
|
||||||
|
|
||||||
for i in $t; do
|
for i in $t; do
|
||||||
name=`echo $i|cut -d / -f 5|cut -d - -f 1`
|
name=`echo $i|cut -d / -f 5|cut -d - -f 1`
|
||||||
tt=`curl -sL $i|tr ' ' '\n' |grep .jpeg|cut -d '"' -f 2`
|
tt=`curl -sL $i|tr ' ' '\n' |grep .jpeg|cut -d '"' -f 2`
|
||||||
@ -41,41 +42,79 @@ handle_yui=yui.syui.ai
|
|||||||
did_yui=did:plc:4hqjfn7m6n5hno3doamuhgef
|
did_yui=did:plc:4hqjfn7m6n5hno3doamuhgef
|
||||||
token_yui=`cat ~/.config/ai/token.json|jq -r .accessJwt`
|
token_yui=`cat ~/.config/ai/token.json|jq -r .accessJwt`
|
||||||
host=bsky.social
|
host=bsky.social
|
||||||
day=`date --iso-8601=seconds`
|
|
||||||
|
case $OSTYPE in
|
||||||
|
darwin*)
|
||||||
|
day=`gdate --iso-8601=seconds`
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
day=`date --iso-8601=seconds`
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
function create_game_character() {
|
function create_game_character() {
|
||||||
t=(
|
t=(
|
||||||
ai chinese kirin leviathan phoenix wyvern cerberus dragon kitsune pegasus
|
ai
|
||||||
|
chinese
|
||||||
|
kirin
|
||||||
|
leviathan
|
||||||
|
phoenix
|
||||||
|
wyvern
|
||||||
|
cerberus
|
||||||
|
dragon
|
||||||
|
kitsune
|
||||||
|
pegasus
|
||||||
)
|
)
|
||||||
|
|
||||||
for ((i=1; i<=$#t; i++)); do
|
for ((i=1; i<=$#t; i++)); do
|
||||||
created=2001-01-01T00:00:00+09:00
|
created=2001-01-01T00:00:00+09:00
|
||||||
col=ai.syui.game.character
|
col=ai.syui.game.character
|
||||||
req=com.atproto.repo.putRecord
|
req=com.atproto.repo.getRecord
|
||||||
url=https://$host/xrpc/$req
|
url=https://$host/xrpc/$req
|
||||||
|
|
||||||
id=$i
|
id=$i
|
||||||
name=${t[$i]}
|
name=${t[$i]}
|
||||||
chara=$name
|
chara=$name
|
||||||
|
rkey=$chara
|
||||||
|
repo=$did_yui
|
||||||
|
json="{\"collection\":\"$col\", \"rkey\":\"$rkey\", \"repo\":\"$repo\"}"
|
||||||
|
if [ $((RANDOM % 2)) -eq 0 ];then
|
||||||
|
sex=male
|
||||||
|
else
|
||||||
|
sex=female
|
||||||
|
fi
|
||||||
|
jj=`curl -sL "$url?repo=$repo&collection=$col&rkey=$rkey"`
|
||||||
|
|
||||||
|
echo $jj
|
||||||
|
link=`echo $jj|jq -r '.value.embed.external.thumb.ref.[]'`
|
||||||
|
size=`echo $jj|jq -r .value.embed.external.thumb.size`
|
||||||
|
mtype=`echo $jj|jq -r .value.embed.external.thumb.mimeType`
|
||||||
|
echo $mtype, $size, $link
|
||||||
|
|
||||||
|
## upload img
|
||||||
|
#if [ -f ./${name}.jpeg ];then
|
||||||
|
# jj=`ai img-upload ./${name}.jpeg`
|
||||||
|
#elif [ -f ./${name}.png ];then
|
||||||
|
# jj=`ai img-upload ./${name}.png`
|
||||||
|
#fi
|
||||||
|
#link=`echo $jj|jq -r ".blob.ref.[]"`
|
||||||
|
#size=`echo $jj|jq -r .blob.size`
|
||||||
|
#mtype=`echo $jj|jq -r .blob.mimeType`
|
||||||
|
|
||||||
|
req=com.atproto.repo.putRecord
|
||||||
|
url=https://$host/xrpc/$req
|
||||||
|
|
||||||
nickname=$name
|
nickname=$name
|
||||||
fullname=$name
|
fullname=$name
|
||||||
uri=at://${did_yui}/$col/$chara
|
uri=at://${did_yui}/$col/$chara
|
||||||
if [ -f ./${name}.jpeg ];then
|
|
||||||
jj=`ai img-upload ./${name}.jpeg`
|
|
||||||
elif [ -f ./${name}.png ];then
|
|
||||||
jj=`ai img-upload ./${name}.png`
|
|
||||||
fi
|
|
||||||
if [ "$name" = "ai" ];then
|
if [ "$name" = "ai" ];then
|
||||||
group=origin
|
group=origin
|
||||||
|
sex=none
|
||||||
else
|
else
|
||||||
group=fantasy
|
group=fantasy
|
||||||
fi
|
fi
|
||||||
echo $jj
|
|
||||||
link=`echo $jj|jq -r ".blob.ref.[]"`
|
json="{
|
||||||
size=`echo $jj|jq -r .blob.size`
|
|
||||||
mtype=`echo $jj|jq -r .blob.mimeType`
|
|
||||||
json="
|
|
||||||
{
|
|
||||||
\"repo\": \"$handle_yui\",
|
\"repo\": \"$handle_yui\",
|
||||||
\"did\": \"$did_yui\",
|
\"did\": \"$did_yui\",
|
||||||
\"collection\": \"$col\",
|
\"collection\": \"$col\",
|
||||||
@ -85,6 +124,7 @@ function create_game_character() {
|
|||||||
\"name\": \"$name\",
|
\"name\": \"$name\",
|
||||||
\"fullname\": \"$fullname\",
|
\"fullname\": \"$fullname\",
|
||||||
\"nickname\": \"$nickname\",
|
\"nickname\": \"$nickname\",
|
||||||
|
\"sex\": \"$sex\",
|
||||||
\"group\": \"$group\",
|
\"group\": \"$group\",
|
||||||
\"embed\": {
|
\"embed\": {
|
||||||
\"\$type\": \"app.bsky.embed.external\",
|
\"\$type\": \"app.bsky.embed.external\",
|
||||||
@ -97,7 +137,7 @@ function create_game_character() {
|
|||||||
},
|
},
|
||||||
\"mimeType\": \"$mtype\",
|
\"mimeType\": \"$mtype\",
|
||||||
\"size\": $size
|
\"size\": $size
|
||||||
} } }, \"createdAt\": \"$created\", \"updatedAt\": \"$day\" } }"
|
} } }, \"createdAt\": \"$created\", \"updatedAt\": \"$day\" } }"
|
||||||
|
|
||||||
if echo $json|jq . ;then
|
if echo $json|jq . ;then
|
||||||
curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token_yui" -d $json $url
|
curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token_yui" -d $json $url
|
||||||
@ -107,4 +147,5 @@ function create_game_character() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#download_character_icon
|
#download_character_icon
|
||||||
#create_game_character
|
create_game_character
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user