From 29185827537a6a8f9c3ca4fc0b92667e88c51cf5 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 29 Sep 2019 16:57:54 +0100 Subject: [PATCH] Only call function if needed --- content.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/content.py b/content.py index 82dd52045..dbe4319b4 100644 --- a/content.py +++ b/content.py @@ -253,10 +253,10 @@ def addHtmlTags(baseDir: str,httpPrefix: str, \ continue if addHashTags(wordStr,httpPrefix,originalDomain,replaceHashTags,hashtags): continue - if not emojiDict: - if len(wordStr)>2: - if wordStr.startswith(':'): - if wordStr.endswith(':'): + if len(wordStr)>2: + if wordStr.startswith(':'): + if wordStr.endswith(':'): + if not emojiDict: print('Loading emoji lookup') if not os.path.isfile(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) emojiDictCtr+=1 - addEmoji(baseDir,wordStr,httpPrefix,originalDomain,replaceEmoji,hashtags,emojiDict) + addEmoji(baseDir,wordStr,httpPrefix,originalDomain,replaceEmoji,hashtags,emojiDict) # replace words with their html versions for wordStr,replaceStr in replaceMentions.items():