mirror of https://gitlab.com/bashrc2/epicyon
Loading emoji
parent
f32ee82683
commit
c8d25f85cb
15
content.py
15
content.py
|
@ -7,6 +7,7 @@ __email__ = "bob@freedombone.net"
|
||||||
__status__ = "Production"
|
__status__ = "Production"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import time
|
||||||
import commentjson
|
import commentjson
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
|
|
||||||
|
@ -259,8 +260,18 @@ def addHtmlTags(baseDir: str,httpPrefix: str, \
|
||||||
print('Loading emoji lookup')
|
print('Loading emoji lookup')
|
||||||
if not os.path.isfile(baseDir+'/emoji/emoji.json'):
|
if not os.path.isfile(baseDir+'/emoji/emoji.json'):
|
||||||
copyfile(baseDir+'/emoji/default_emoji.json',baseDir+'/emoji/emoji.json')
|
copyfile(baseDir+'/emoji/default_emoji.json',baseDir+'/emoji/emoji.json')
|
||||||
with open(baseDir+'/emoji/emoji.json', 'r') as fp:
|
emojiDictCtr=0
|
||||||
emojiDict=commentjson.load(fp)
|
while not emojiDict and emojiDictCtr<4:
|
||||||
|
if emojiDictCtr>0:
|
||||||
|
print('Retry emoji load '+baseDir+'/emoji/emoji.json')
|
||||||
|
try:
|
||||||
|
with open(baseDir+'/emoji/emoji.json', 'r') as fp:
|
||||||
|
emojiDict=commentjson.load(fp)
|
||||||
|
break
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
time.sleep(1)
|
||||||
|
emojiDictCtr+=1
|
||||||
|
|
||||||
addEmoji(baseDir,wordStr,httpPrefix,originalDomain,replaceEmoji,hashtags,emojiDict)
|
addEmoji(baseDir,wordStr,httpPrefix,originalDomain,replaceEmoji,hashtags,emojiDict)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue