Merge branch 'master' into contentdb

This commit is contained in:
SmallJoker 2024-01-06 12:32:51 +01:00
commit 59f0dcaf3f
19 changed files with 157 additions and 137 deletions

2
API.md
View File

@ -91,7 +91,7 @@ The next metadata keys are filled or/and used interally in skinsdb framework
- name - A name for the skin
- author - The skin author
- license - THe skin texture license
- assignment - (obsolete) is "player:playername" in case the skin is assigned to be privat for a player
- assignment - (obsolete) is "player:playername" in case the skin is assigned to be private for a player
- playername - Player assignment for private skin. Set false for skins not usable by all players (like NPC-Skins), true or nothing for all player skins
- in_inventory_list - If set to false the skin is not visible in inventory skins selection but can be still applied to the player
- _sort_id - Thi skins lists are sorted by this field for output (internal key)

View File

@ -20,15 +20,16 @@ This Minetest mod offers changeable player skins with a graphical interface for
## Installing skins
### Download from the [database](http://minetest.fensta.bplaced.net/)
### Download from the [database](https://skinsdb.terraqueststudios.net/)
#### Ingame Downloader
1) Get Minetest 5.1.0-dev-cb00632 or newer
2) Start your world
3) Run `/skinsdb_download_skins <skindb start page> <amount of pages>`
4) Wait for the Minetest server to shut down
5) Start the server again
2) In the settings menu show advanced options, find the "Developer Options" tab and add "skinsdb" to "Trusted mods" (secure.trusted_mods in minetest.conf)
3) Start your world
4) Run `/skinsdb_download_skins <skindb start page> <amount of pages>`
5) Wait for the Minetest server to shut down
6) Start the server again
You might want to run `minetest` in a Terminal/Console window to check the log output instantly.

View File

@ -11,7 +11,7 @@ end
minetest.register_chatcommand("skinsdb", {
params = "[set] <skin key> | show [<skin key>] | list | list private | list public | [ui]",
params = S("[set] <skin key> | show [<skin key>] | list | list private | list public | [ui]"),
description = S("Show, list or set player's skin"),
func = function(name, param)
local player = minetest.get_player_by_name(name)

View File

@ -8,6 +8,12 @@ skins = {}
skins.modpath = minetest.get_modpath(minetest.get_current_modname())
skins.default = "character"
-- see skindsdb/textures/readme.txt to avoid playername with underscore problem
skins.fsep = minetest.settings:get("skinsdb_fsep") or "_"
if skins.fsep == "_" then
minetest.log("warning", "skinsdb filename seperator is set to " .. skins.fsep .. ", see skindsdb/textures/readme.txt to avoid problems with playernames containing underscore")
end
dofile(skins.modpath.."/skin_meta_api.lua")
dofile(skins.modpath.."/api.lua")
dofile(skins.modpath.."/skinlist.lua")

View File

@ -1,19 +1,19 @@
# textdomain: skinsdb
# Translation by Xanthin
Raw texture=Rohtextur
Name=Name
Author=Autor
Change=Wechseln
Page=Seite
License=Lizenz
Description=Beschreibung
[set] <skin key> | show [<skin key>] | list | list private | list public | [ui]=
Show, list or set player's skin=Anzeigen oder setzen der Spieler-Skins
Player not found=Spieler nicht da
unknown command=unbekannter Befehl
see /help skinsdb for supported parameters=Lese /help für erlaubte Parameter
skin set to=Skin ist jetzt
invalid skin=unbekannter Skin
unknown parameter=unbekannter Parameter
Skins=Aussehen
Requires skin key=Benötigt Skin-Name
unknown parameter=unbekannter Parameter
Raw texture=Rohtextur
Page=Seite
Name=Name
Author=Autor
License=Lizenz
<skindb start page> <amount of pages>=
Downloads the specified range of skins and shuts down the server=
Change=Wechseln
Skins=Aussehen

19
locale/skinsdb.eo.tr Normal file
View File

@ -0,0 +1,19 @@
# textdomain: skinsdb
[set] <skin key> | show [<skin key>] | list | list private | list public | [ui]=[set] <haŭtonomo> | show [<haŭtonomo>] | list | list private | list public | [ui]
Show, list or set player's skin=Montri haŭtojn («show»), listigi haŭtojn («list»), aŭ agordi onian haŭton («set»)
Player not found=Ludanto ne trovita
unknown command=nekonata ordono
see /help skinsdb for supported parameters=rulu «/help skinsdb» por vidi subtenatajn parametrojn
skin set to=haŭto agordita al
invalid skin=nevalida haŭto
Requires skin key=Postulas haŭtonomon
unknown parameter=nekonata parametro
Raw texture=Kruda bildo
Page=Paĝo
Name=Nomo
Author=Aŭtoro
License=Permesilo
<skindb start page> <amount of pages>=<komenca paĝo> <paĝokvanto>
Downloads the specified range of skins and shuts down the server=Elŝutinte haŭtojn el skindb inter la donitaj paĝoj, restartigas la servilon
Change=Ŝanĝi
Skins=Haŭtoj

View File

@ -1,18 +1,19 @@
# textdomain: skinsdb
Raw texture=Texture
Name=Nom
Author=Auteur
Change=Changer
Page=Page
License=Licence
Description=Description
[set] <skin key> | show [<skin key>] | list | list private | list public | [ui]=
Show, list or set player's skin=Afficher, lister ou définir le skin du joueur
Player not found=Joueur non trouvé
unknown command=commande inconnue
see /help skinsdb for supported parameters=voir /help skinsdb pour les paramètres supportés
skin set to=skin définie sur
invalid skin=skin peau invalide
Requires skin key=
unknown parameter=paramètre inconnu
unknown skin=skin inconnue
Raw texture=Texture
Page=Page
Name=Nom
Author=Auteur
License=Licence
<skindb start page> <amount of pages>=
Downloads the specified range of skins and shuts down the server=
Change=Changer
Skins=

View File

@ -1,18 +1,19 @@
# textdomain: skinsdb
# Malay translation by muhdnurhidayat
Raw texture=Tekstur mentah
Name=Nama
Author=Pencipta
Change=Ubah
Page=Halaman
License=Lesen
Description=Keterangan
[set] <skin key> | show [<skin key>] | list | list private | list public | [ui]=
Show, list or set player's skin=Tunjukkan, senaraikan atau tetapkan kulit pemain
Player not found=Pemain tidak dijumpai
unknown command=perintah tidak diketahui
see /help skinsdb for supported parameters=lihat /help skinsdb untuk parameter yang disokong
skin set to=kulit ditetapkan kepada
invalid skin=kulit tidak sah
Requires skin key=
unknown parameter=parameter tidak diketahui
unknown skin=kulit tidak diketahui
Raw texture=Tekstur mentah
Page=Halaman
Name=Nama
Author=Pencipta
License=Lesen
<skindb start page> <amount of pages>=
Downloads the specified range of skins and shuts down the server=
Change=Ubah
Skins=

View File

@ -1,20 +1,19 @@
# textdomain: skinsdb
Raw texture=Textura crua
Name=Nome
Author=Autor
Change=Mudar
Page=Página
License=Licença
Description=Descrição
[set] <skin key> | show [<skin key>] | list | list private | list public | [ui]=
Show, list or set player's skin=Mostrar, listar ou definir a skin do jogador
Player not found=Jogador não encontrado
unknown command=Comando desconhecido
see /help skinsdb for supported parameters= consulte /help skinsdb para obter os parâmetros suportados
skin set to=Aparência definida para
invalid skin=Aparência inválida
unknown parameter=parâmetro desconhecido
unknown skin=Aparência desconhecida
Downloads thespecified range of skins and shuts down the server= Baixa o intervalo especificado de capas e desliga o servidor
Skins=Aparência
Requires skin key=Requer chave de aparência
unknown parameter=parâmetro desconhecido
Raw texture=Textura crua
Page=Página
Name=Nome
Author=Autor
License=Licença
<skindb start page> <amount of pages>=
Downloads the specified range of skins and shuts down the server=Baixa o intervalo especificado de capas e desliga o servidor
Change=Mudar
Skins=Aparência

View File

@ -1,21 +1,19 @@
# textdomain: skinsdb
# Translation by Baytuch
Raw texture=Текстура
Name=Имя
Author=Автор
Change=Изменить
Page=Страница
License=Лицензия
Description=Описание
[set] <skin key> | show [<skin key>] | list | list private | list public | [ui]=
Show, list or set player's skin=Показать скин, список скинов, установить скин игрока
Player not found=Игрок не найден
unknown command=неизвестная команда
see /help skinsdb for supported parameters=смотрите /help skinsdb для просмотра параметров
skin set to=установлено скин
invalid skin=некорректный скин
unknown parameter=неопределенный параметр
unknown skin=неопределенный скин
Downloads the specified range of skins and shuts down the server=Загрузить массив скинов и остановить сервер
Skins=Скины
Requires skin key=Зависимый идентификатор скина
unknown parameter=неопределенный параметр
Raw texture=Текстура
Page=Страница
Name=Имя
Author=Автор
License=Лицензия
<skindb start page> <amount of pages>=
Downloads the specified range of skins and shuts down the server=Загрузить массив скинов и остановить сервер
Change=Изменить
Skins=Скины

View File

@ -1,21 +1,19 @@
# textdomain: skinsdb
# Translation by Baytuch
Raw texture=Текстура
Name=Ім'я
Author=Автор
Change=Змінити
Page=Сторінка
License=Ліцензія
Description=Опис
[set] <skin key> | show [<skin key>] | list | list private | list public | [ui]=
Show, list or set player's skin=Показати скін, список скінів, встановити скін гравця
Player not found=Гравець не знайдений
unknown command=невідома команда
see /help skinsdb for supported parameters=дивіться /help skinsdb для перегляду параметрів
skin set to=встановлено скін
invalid skin=некоректний скін
unknown parameter=невизначений параметр
unknown skin=невизначений скін
Downloads the specified range of skins and shuts down the server=Завантажити масив скінів та зупинити сервер
Skins=Скіни
Requires skin key=Залежний ідентифікатор скіна
unknown parameter=невизначений параметр
Raw texture=Текстура
Page=Сторінка
Name=Ім'я
Author=Автор
License=Ліцензія
<skindb start page> <amount of pages>=
Downloads the specified range of skins and shuts down the server=Завантажити масив скінів та зупинити сервер
Change=Змінити
Skins=Скіни

View File

@ -1,20 +1,19 @@
# textdomain: skinsdb
#Translation by IFRFSX(BingFengFSX)
Raw texture=自然状态的纹理
Name=名称
Author=作者
Change=更换
Page=页面
License=许可证
Description=说明
[set] <skin key> | show [<skin key>] | list | list private | list public | [ui]=
Show, list or set player's skin=显示,列出或者设置玩家的皮肤
Player not found=玩家未找到
unknown command=未知命令
see /help skinsdb for supported parameters=有关skinsdb支持的参数参见 /help
skin set to=皮肤设置为
invalid skin=无效皮肤
Requires skin key=
unknown parameter=未知参数
unknown skin=未知皮肤
Raw texture=自然状态的纹理
Page=页面
Name=名称
Author=作者
License=许可证
<skindb start page> <amount of pages>=
Downloads the specified range of skins and shuts down the server=下载指定范围的皮肤并关闭服务器
Change=更换
Skins=皮肤

View File

@ -1,19 +1,19 @@
# textdomain: skinsdb
#Translation by IFRFSXBingFengFSX
Raw texture=自然狀態的紋理
Name=名稱
Author=作者
Change=更換
Page=頁面
License=許可證
Description=說明
Showlist or set player's skin=顯示,列出或者設定玩家的皮膚
[set] <skin key> | show [<skin key>] | list | list private | list public | [ui]=
Show, list or set player's skin=顯示,列出或者設定玩家的皮膚
Player not found=玩家未找到
unknown command=未知命令
see /help skinsdb for supported parameters=有關skinsdb支持的參數參見/help
skin set to=皮膚設定為
invalid skin=無效皮膚
Requires skin key=
unknown parameter=未知參數
unknown skin=未知皮膚
Raw texture=自然狀態的紋理
Page=頁面
Name=名稱
Author=作者
License=許可證
<skindb start page> <amount of pages>=
Downloads the specified range of skins and shuts down the server=下載指定範圍的皮膚並關閉服務器
Change=更換
Skins=皮膚

View File

@ -1,20 +1,19 @@
# textdomain: skinsdb
Raw texture=
Name=
Author=
Change=
Page=
License=
Description=
[set] <skin key> | show [<skin key>] | list | list private | list public | [ui]=
Show, list or set player's skin=
Player not found=
unknown command=
see /help skinsdb for supported parameters=
skin set to=
invalid skin=
unknown parameter=
unknown skin=
Downloads the specified range of skins and shuts down the server=
Skins=
Requires skin key=
unknown parameter=
Raw texture=
Page=
Name=
Author=
License=
<skindb start page> <amount of pages>=
Downloads the specified range of skins and shuts down the server=
Change=
Skins=

3
settingtypes.txt Normal file
View File

@ -0,0 +1,3 @@
# texture filename seperator, default "_"
# see skindsdb/textures/readme.txt to avoid playername with underscore problem
skinsdb_fsep (texture filename seperator) enum _ _,.

View File

@ -2,7 +2,7 @@ local skins_dir_list = minetest.get_dir_list(skins.modpath.."/textures")
for _, fn in pairs(skins_dir_list) do
local name, sort_id, is_preview, playername
local nameparts = string.gsub(fn, "[.]", "_"):split("_")
local nameparts = string.gsub(fn, "[.]", skins.fsep):split(skins.fsep)
-- check allowed prefix and file extension
if (nameparts[1] == 'player' or nameparts[1] == 'character') and

View File

@ -20,7 +20,7 @@ if not ie or not http then
end
minetest.register_chatcommand("skinsdb_download_skins", {
params = "<skindb start page> <amount of pages>",
params = S("<skindb start page> <amount of pages>"),
description = S("Downloads the specified range of skins and shuts down the server"),
privs = {server=true},
func = function(name, param)
@ -47,9 +47,8 @@ if #internal.errors > 0 then
end
-- http://minetest.fensta.bplaced.net/api/apidoku.md
local root_url = "http://minetest.fensta.bplaced.net"
local page_url = root_url .. "/api/v2/get.json.php?getlist&page=%i&outformat=base64" -- [1] = Page#
local preview_url = root_url .. "/skins/1/%i.png" -- [1] = ID
local root_url = "http://skinsdb.terraqueststudios.net"
local page_url = root_url .. "/api/v1/content?client=mod&page=%i" -- [1] = Page#
local mod_path = skins.modpath
local meta_path = mod_path .. "/meta/"
@ -88,7 +87,7 @@ local function safe_single_skin(skin)
skin.license
}
local name = "character_" .. skin.id
local name = "character" .. skins.fsep .. skin.id
-- core.safe_file_write does not work here
unsafe_file_write(
@ -100,9 +99,6 @@ local function safe_single_skin(skin)
skins_path .. name .. ".png",
core.decode_base64(skin.img)
)
fetch_url(preview_url:format(skin.id), function(preview)
unsafe_file_write(skins_path .. name .. "_preview.png", preview)
end)
core.log("action", ("%s: Completed skin %s"):format(_ID_, name))
end

View File

@ -1,5 +1,17 @@
In this folder the skin files could be placed according the following file naming convention.
skinsdb uses an underscore as default seperator for filename splitting which can cause problems with playernames containing "_",
see https://github.com/minetest-mods/skinsdb/issues/54.
The config setting skinsdb_fsep (texture filename seperator) was added as a workaround which also offers "."(dot) as seperator,
dot is the only character which is allowed in textures but not in playernames.
To keep compatibility with older versions underscore is the default value.
fresh install:
you should change the seperator to "." to avoid that problem.
existing install:
- change the filenames according to the naming convention with dot as seperator instead of underscore
- change the texture filename seperator in settings or add "skinsdb_fsep = ." to your minetest.conf before starting your server
Public skin available for all users:
character_[number-or-name].png

View File

@ -1,11 +1,14 @@
import sys, requests, base64
download_preview = ( len (sys.argv) > 1 and sys.argv[1] == "with_preview" )
# filename seperator to use, either default "-" or ".". see skinsdb/textures/readme.txt
#fsep = "_"
fsep = "."
print("Downloading skins from minetest.fensta.bplaced.net ...")
print("Downloading skins from skinsdb.terraqueststudio.net ...")
# Requesting all skins and their raw texture using the API
r = requests.get('http://minetest.fensta.bplaced.net/api/v2/get.json.php?getlist&page=1&per_page=999999999')
r = requests.get('http://skinsdb.terraqueststudios.net/api/v1/content?client=script&page=1&per_page=10000')
if r.status_code != 200:
sys.exit("Request failed!")
@ -13,10 +16,7 @@ if r.status_code != 200:
data = r.json()
count = 0
if download_preview:
print("Writing to file and downloading previews ...")
else:
print("Writing skins")
print("Writing skins")
for json in data["skins"]:
@ -24,7 +24,7 @@ for json in data["skins"]:
# Texture file
raw_data = base64.b64decode(json["img"])
file = open("../textures/character_" + id + ".png", "wb")
file = open("../textures/character" + fsep + id + ".png", "wb")
file.write(bytearray(raw_data))
file.close()
@ -38,17 +38,5 @@ for json in data["skins"]:
print("Added #%s Name: %s Author: %s License: %s" % (id, name, author, license))
count += 1
if download_preview:
# Downloading the preview of the skin
r2 = requests.get('http://minetest.fensta.bplaced.net/skins/1/' + id + ".png")
if r2.status_code == 200:
# Preview file
preview = r2.content
file = open("../textures/character_" + id + "_preview.png", "wb")
file.write(bytearray(preview))
file.close()
else:
print("Failed to download skin preview #" + id)
print("Fetched " + str(count) + " skins!")