Only call function if needed

main2
Bob Mottram 2019-09-29 16:57:54 +01:00
parent 3ed5e83a90
commit 2918582753
1 changed files with 5 additions and 5 deletions

View File

@ -253,10 +253,10 @@ def addHtmlTags(baseDir: str,httpPrefix: str, \
continue continue
if addHashTags(wordStr,httpPrefix,originalDomain,replaceHashTags,hashtags): if addHashTags(wordStr,httpPrefix,originalDomain,replaceHashTags,hashtags):
continue continue
if not emojiDict: if len(wordStr)>2:
if len(wordStr)>2: if wordStr.startswith(':'):
if wordStr.startswith(':'): if wordStr.endswith(':'):
if wordStr.endswith(':'): if not emojiDict:
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')
@ -273,7 +273,7 @@ def addHtmlTags(baseDir: str,httpPrefix: str, \
time.sleep(1) time.sleep(1)
emojiDictCtr+=1 emojiDictCtr+=1
addEmoji(baseDir,wordStr,httpPrefix,originalDomain,replaceEmoji,hashtags,emojiDict) addEmoji(baseDir,wordStr,httpPrefix,originalDomain,replaceEmoji,hashtags,emojiDict)
# replace words with their html versions # replace words with their html versions
for wordStr,replaceStr in replaceMentions.items(): for wordStr,replaceStr in replaceMentions.items():