11/27/2018 (Tue) 00:35:01
So, here is the css and python script used to create it. I've did only country part of css, but I guess it would be easy to use it. I also had error in previous archive - USA file has extra quote at the end, it must be 'Murica, not 'Murica'.
(both files need to be stripped from .txt extesion because endchan doesn't allow to uploading these files in original form)
CSS is made by script, but I guess some images need update, and this script helps to generate css after these updates.
python balls.py --dir /path/to/balls/directory --css /path/to/custom.css
(--css is optional)
What does it do:
1) If css is supplied, it tries to download images from imgur that missing from balls directory. I.e. you have dir/Hungary.png and dir/Vatican.png, but css contains ball for Venezuela, so that ball will be downloaded as dir/Venezuela.png. Name for ball is taken from css rule "title" param.
2) It goes over images in dir, gets their content in base64, dimensions, format and name.
3) It generates css using data from 2, sorted alphabetically.
Why so much work? It allows to download images once (or use older archive), then replace countryball images, add new and remove old, then regenerate css part. You just need to pass --dir /path/to/balls/dir/ to script and it will generate new css from files (country name will be taken from filename).
Script requires python 3 and pillow library (PIL alternative, for images). I hope it may be helpful for those who want to add or edit existing balls etc (for example, adding hats). There is no proper error checking, and it may have bugs, sorry.
I see that some images are already bad, like Uganda, Nigeria and Mali (they are too big). Maybe using png optimizer or something may help, but it is already late here.