Created
July 20, 2024 14:29
-
-
Save okinjp/a37c2b523abdb78a6e8dd670af50c04c to your computer and use it in GitHub Desktop.
Misskey/Firefish派生向け絵文字インポートzip用meta.json生成スクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
## 使い方 ## | |
# 1. インポートしたい絵文字画像を一つのフォルダに置く | |
# 2. 絵文字画像ファイルの名前を登録名にする | |
# 3. このシェルスクリプトのlicenseとcategoryを修正してフォルダで実行する | |
# 4. 作成されたmeta.jsonと画像ファイルをzip圧縮する | |
# 5. Misskey/Firefish派生でインポートする | |
## End ## | |
array=($(echo $(ls -1|grep -v "json"))) | |
category=$(basename $(pwd)) | |
jsonfile="meta.json" | |
license="<Fill License text>" | |
category="<Fill category name>" | |
printf '{\n "emojis": [\n' > "$jsonfile" | |
length=${#array[@]} | |
for ((i=0; i<length; i++)); do | |
fileName=${array[$i]} | |
name=$(basename $fileName .${fileName##*.}) | |
name=${name,,} | |
aliases=() | |
printf ' {\n "downloaded": true,\n "fileName": "%s",\n "emoji": {\n "name": "%s",\n "category": "%s",\n "license": "%s",\n "aliases": []\n }\n }' "$fileName" "$name" "$category" "$license">> "$jsonfile" | |
if [ $i -lt $((length-1)) ]; then | |
printf ',\n' >> "$jsonfile" | |
fi | |
done | |
printf '\n ]\n}\n' >> "$jsonfile" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment