yoink-emoji/README.rst

63 lines
2 KiB
ReStructuredText
Raw Normal View History

2024-09-25 15:28:30 +00:00
===========
Yoink-Emoji
===========
Lets you yoink emoji packs from any other instance with MastoAPI support,
2024-09-25 15:28:30 +00:00
instead of only shareable packs from other \*oma instances like admin-fe does.
Note this currently might not work as well for updating packs not created by this script.
2024-09-25 16:51:29 +00:00
It expects files to be named after their shortcode, if a meowji already exists but with
2024-09-25 15:28:30 +00:00
a different filename this will leave duplicate images behind.
2024-09-25 16:51:29 +00:00
*(shortcode names are checked to be safe wrt to path traversal before writing anything)*
2024-09-25 15:28:30 +00:00
Installing
==========
Just plop the script somewhere.
A ``.cache`` for remote emoji data will be created at the script location.
*(Caches remain valid within the same UTC day, currently not cleaned up automatically so just `rm -fr .cache` from time to time if it becomes too big)*
Usage
=====
Enter the emoji pack dir (or create a new empty dir for this), then invoke the script;
2024-09-25 15:28:30 +00:00
the third argument is optional:
```
yoink-or-update-emoj.sh domain_of_server_to_be_yoinked_from category_to yoink [additional_conditions]
```
2024-09-25 16:51:29 +00:00
Additionally the following env vars affect the result:
2024-09-25 15:28:30 +00:00
- ``OVERWRITE_IMG=YES``: overwrite existing images instead of skipping download
- ``OVERWRITE_METAKEYS=YES``: overwrite existing shortcode file path entries instead of preserving the original
Example
-------
Yoinking the blobcat pack from an Akkoma instance and also merge any blobcat emotes from another category into the local pack:
```sh
yoink-or-update-emoji.sh example.org "pack:blobcat" 'or (.shortcode | test("blobcatpnd|^ameow|^blobcat|^ablobcat"))'
```
Yoink woozy pack from a Sharkey instance *(no ``pack:`` prefix)*:
```sh
yoink-or-update-emoji.sh example.org "woozy"
```
Merge multiple remote packs into one local pack:
```sh
yoink-or-update-emoji.sh example.org "pack:touhou" 'or .category == "pack:reimu" or .category == "pack:marisa"'
```
Dependencies
============
- POSIX ``sh`` and ``awk`` _(in general all POSIX tools)_
- ``date`` with ``-I`` extension
- jq
- wget **and** curl _(idk why i used both, might remove one at some point)_
- ``mktemp``