03a2bafd962cd34db3390050644e8309c1c391da — Francesco Gazzetta 11 months ago
5 files changed, 252 insertions(+), 0 deletions(-)

A .gitignore
A download.py
A init.lua
A mod.conf
A  => .gitignore +2 -0
@@ 1,2 @@

A  => README.md +18 -0
@@ 1,18 @@
# `thirtydollar_emojis` Minetest mod

Emojis for `emojis_api` scraped from https://thirtydollar.website

## Installation

Before or after moving the mod to your `mods` directory, you'll have to download
the sounds and images from thirtydollar.website.

In this mod's directory, run this:

python3 download.py
# If you want ogg (smaller) instead of wav files, install ffmpeg and run this too:
cd sounds
for file in *.wav; do ffmpeg -i "${file}" "${file/%wav/ogg}"; done
rm *.wav

A  => download.py +26 -0
@@ 1,26 @@
#!/usr/bin/env python3

from urllib.request import urlopen, urlretrieve
import json
import os

mappings = json.load(urlopen("https://thirtydollar.website/sounds.json"))


for mapping in mappings:
    ident = mapping["id"]
    if ident == "_pause": continue
    print("Downloading", ident)
    soundURL = f"https://thirtydollar.website/sounds/thirtydollar_emojis_{ident}.wav"
    print("Downloading", soundURL)
    urlretrieve(soundURL, filename=f"sounds/{ident}.wav")
    if "emoji" in mapping:
        emoji = ord(mapping["emoji"][0])
        imageURL = f"https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/72x72/{emoji:x}.png"
    else: # actually x.id.match(/[a-z0-9]/i))
        name = mapping["img"] if "img" in mapping else ident
        imageURL = f"https://thirtydollar.website/icons/{name}.png"
    print("Downloading", imageURL)
    urlretrieve(imageURL, filename=f"textures/thirtydollar_emojis_{ident}.png")

A  => init.lua +203 -0
@@ 1,203 @@
-- To regenerate the table, run
--     curl https://thirtydollar.website/sounds.json | jq 'map(.id)'
-- then remove "_pause" and change [] to {}
local names = {

for _,name in ipairs(names) do
    "thirtydollar_emojis_" .. name,
    "thirtydollar_emojis_" .. name .. ".png",
    "thirtydollar_emojis_" .. name)

A  => mod.conf +3 -0
@@ 1,3 @@
name = thirtydollar_emojis
description = An emoji pack for emojis_api, generated from thirtydollar.website
depends = emojis_api