diff --git a/texture/chara_animal/ai.png b/texture/chara_animal/ai.png new file mode 100644 index 0000000..fb31001 Binary files /dev/null and b/texture/chara_animal/ai.png differ diff --git a/texture/chara_animal/chara_animal.zsh b/texture/chara_animal/chara_animal.zsh index 4c013e3..4c4b496 100755 --- a/texture/chara_animal/chara_animal.zsh +++ b/texture/chara_animal/chara_animal.zsh @@ -1,6 +1,6 @@ #!/bin/zsh - +function download_character_jpeg(){ t=( "https://sketchfab.com/3d-models/cerberus-quirky-series-4379b571b5a440119d1ebaddb0711142" "https://sketchfab.com/3d-models/chinese-dragon-quirky-series-a383d3cf5b004978ac620806558b2924" @@ -31,7 +31,80 @@ for i in $t; do array+=(`echo $tt|sed "1,2d"|cut -d ";" -f 2|cut -d '&' -f 1|tr '\n' ' '`) echo $name for ((i=1; i<=$#array; i++)); do - echo "Index: $i, Value: ${array[$i]}" + #echo "Index: $i, Value: ${array[$i]}" #curl -sL ${array[$i]} -o ${name}-${i}.jpeg done done +} + +handle_yui=yui.syui.ai +did_yui=did:plc:4hqjfn7m6n5hno3doamuhgef +token_yui=`cat ~/.config/ai/token.json|jq -r .accessJwt` +host=bsky.social +day=`date --iso-8601=seconds` + +function create_game_chara() { + t=( + ai chinese kirin leviathan phoenix wyvern cerberus dragon kitsune pegasus + ) + + for ((i=1; i<=$#t; i++)); do + created=2001-01-01T00:00:00+09:00 + col=ai.syui.game.character + req=com.atproto.repo.putRecord + url=https://$host/xrpc/$req + + id=$i + name=${t[$i]} + chara=$name + nickname=$name + fullname=$name + 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 + group=origin + else + group=fantasy + fi + echo $jj + link=`echo $jj|jq -r ".blob.ref.[]"` + size=`echo $jj|jq -r .blob.size` + mtype=`echo $jj|jq -r .blob.mimeType` + json=" + { + \"repo\": \"$handle_yui\", + \"did\": \"$did_yui\", + \"collection\": \"$col\", + \"rkey\": \"$chara\", + \"record\": { + \"id\": $id, + \"name\": \"$name\", + \"fullname\": \"$fullname\", + \"nickname\": \"$nickname\", + \"group\": \"$group\", + \"embed\": { + \"\$type\": \"app.bsky.embed.external\", + \"external\": { + \"uri\": \"$uri\", + \"thumb\": { + \"\$type\": \"blob\", + \"ref\": { + \"\$link\": \"$link\" + }, + \"mimeType\": \"$mtype\", + \"size\": $size + } } }, \"createdAt\": \"$created\", \"updatedAt\": \"$day\" } }" + + if echo $json|jq . ;then + curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token_yui" -d $json $url + fi + done + +} + +#download_character_jpeg +#create_game_chara