show number of emojis and the zip size
parent
e927148bf5
commit
00c70a23fb
|
@ -1,9 +1,10 @@
|
||||||
import datetime
|
import datetime
|
||||||
import time
|
import time
|
||||||
|
import os
|
||||||
from sys import stdout
|
from sys import stdout
|
||||||
from shutil import make_archive
|
from shutil import make_archive
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
|
|
||||||
import click
|
import click
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
@ -119,3 +120,9 @@ def _generate_emojis_zip():
|
||||||
|
|
||||||
m.update(data)
|
m.update(data)
|
||||||
cache.set('emojis_hash', m.hexdigest())
|
cache.set('emojis_hash', m.hexdigest())
|
||||||
|
|
||||||
|
count = str(len(os.listdir('files/assets/images/emojis')))
|
||||||
|
cache.set('emojis_count', count)
|
||||||
|
|
||||||
|
size = str(int(os.stat('files/assets/emojis.zip').st_size/1024/1024)) + ' MB'
|
||||||
|
cache.set('emojis_size', size)
|
||||||
|
|
|
@ -205,7 +205,10 @@ def static_megathread_index(v:User):
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
emojis_hash = cache.get('emojis_hash') or ''
|
emojis_hash = cache.get('emojis_hash') or ''
|
||||||
return render_template("megathread_index.html", v=v, emojis_hash=emojis_hash)
|
emojis_count = cache.get('emojis_count') or ''
|
||||||
|
emojis_size = cache.get('emojis_size') or ''
|
||||||
|
|
||||||
|
return render_template("megathread_index.html", v=v, emojis_hash=emojis_hash, emojis_count=emojis_count, emojis_size=emojis_size)
|
||||||
|
|
||||||
@app.get("/api")
|
@app.get("/api")
|
||||||
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
|
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
{%- do MEGATHREAD_INDEX.extend([
|
{%- do MEGATHREAD_INDEX.extend([
|
||||||
(
|
(
|
||||||
'Download All Emojis',
|
'Download All Emojis',
|
||||||
'Download a zip file containing all emojis.',
|
'Download a zip file containing all emojis.<br>' ~ emojis_count ~ ' emojis - ' ~ emojis_size,
|
||||||
'fa-down', '#38a169',
|
'fa-down', '#38a169',
|
||||||
'/assets/emojis.zip?v=' + emojis_hash,
|
'/assets/emojis.zip?v=' + emojis_hash,
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in New Issue