1
Fork 0

Using my module now!

This commit is contained in:
Jake Howard 2015-10-08 12:57:36 +01:00
parent 8c0aeff064
commit 841022c65f

View file

@ -1,4 +1,4 @@
import json, requests, os, base64 import json, requests, os, base64, printr
from glob import glob from glob import glob
from lxml import html from lxml import html
from collections import namedtuple from collections import namedtuple
@ -28,6 +28,7 @@ for i in range(len(emoticon_names) - 1):
print("Downloading offline emoticons...") print("Downloading offline emoticons...")
DOWNLOAD_FILES = [] DOWNLOAD_FILES = []
printer = printr.ItterPrintr('{c}/{m} Files Downloaded', len(emoticons), 1)
for emoticon in emoticons: for emoticon in emoticons:
ext = 'gif' if emoticon.url.endswith('gif') else 'png' ext = 'gif' if emoticon.url.endswith('gif') else 'png'
path = ASSET_DIR + "/{0}.{1}".format(emoticon.ident, ext) path = ASSET_DIR + "/{0}.{1}".format(emoticon.ident, ext)
@ -42,9 +43,9 @@ for emoticon in emoticons:
for block in response.iter_content(1024): for block in response.iter_content(1024):
handle.write(block) handle.write(block)
printer.update()
print("{}/{} Files Downloaded\r".format(len(DOWNLOAD_FILES), len(emoticons)), end='' if len(DOWNLOAD_FILES) != len(emoticons) else '\n') # print("{}/{} Files Downloaded\r".format(len(DOWNLOAD_FILES), len(emoticons)), end='' if len(DOWNLOAD_FILES) != len(emoticons) else '\n')
print()
for filename in LOCAL_FILES: for filename in LOCAL_FILES:
emoticons.append(Emoticon(get_icon_name(filename), filename)) emoticons.append(Emoticon(get_icon_name(filename), filename))