-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for unwanted anti-aliasing on Chrome (thanks MiniDdigger). Added …
…skin dump and quick-n-dirty script to generate the jekyll posts.
- Loading branch information
Showing
4 changed files
with
61,620 additions
and
70 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.jekyll-cache/* | ||
venv/ |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
""" | ||
Quick hack to turn the image dump (exported to JSON from MariaDB) into | ||
individual Jekyll posts. | ||
""" | ||
import json | ||
import base64 | ||
from datetime import datetime | ||
from pathlib import Path | ||
|
||
POST_ROOT = Path('_posts') | ||
|
||
|
||
with open('skins.json') as src: | ||
skins = json.load(src) | ||
|
||
for skin in skins: | ||
added = datetime.strptime(skin['added'], '%Y-%m-%d %H:%M:%S') | ||
added = added.strftime('%Y-%m-%d') | ||
|
||
preview = base64.b64encode(bytes.fromhex(skin['image_combined'][2:])) | ||
preview = preview.decode('utf-8') | ||
|
||
raw = base64.b64encode(bytes.fromhex(skin['image'][2:])) | ||
raw = raw.decode('utf-8') | ||
|
||
with open(POST_ROOT / f'{added}-{skin["id"]}.md', 'wb') as out: | ||
out.write(f'''--- | ||
title: > | ||
{skin["name"]} | ||
layout: post | ||
permalink: /view/{skin["id"]} | ||
votes: {skin["vote_count"]} | ||
preview: "data:image/png;base64,{preview}" | ||
--- | ||
<dl class="side-by-side"> | ||
<dt>Preview</dt> | ||
<dd> | ||
<img class="preview" src="data:image/png;base64,{preview}"> | ||
</dd> | ||
<dt>Original</dt> | ||
<dd> | ||
<img class="preview" src="data:image/png;base64,{raw}"> | ||
</dd> | ||
<dt>Title</dt> | ||
<dd>{skin["name"]}</dd> | ||
<dt>Description</dt> | ||
<dd>{skin["description"]}</dd> | ||
<dt>Added By</dt> | ||
<dd>{skin["author"]}</dd> | ||
<dt>Added On</dt> | ||
<dd>{added}</dd> | ||
<dt>Votes</dt> | ||
<dd>{skin["vote_count"]}</dd> | ||
</dl> | ||
'''.encode('utf-8')) |
Oops, something went wrong.