More debug

merge-requests/30/head
Bob Mottram 2021-11-01 17:50:38 +00:00
parent 775e89cd05
commit 430ed3ce4d
1 changed files with 7 additions and 2 deletions

View File

@ -246,14 +246,17 @@ def _saveCustomEmoji(session, baseDir: str, emojiName: str, url: str,
"""Saves custom emoji to file """Saves custom emoji to file
""" """
if not session: if not session:
if debug:
print('_saveCustomEmoji no session')
return return
if '.' not in url: if '.' not in url:
return return
ext = url.split('.')[-1] ext = url.split('.')[-1]
if ext != 'png': if ext != 'png':
print('Custom emoji is wrong format ' + url) if debug:
print('Custom emoji is wrong format ' + url)
return return
emojiName = emojiName.replace(':').strip() emojiName = emojiName.replace(':').strip().lower()
customEmojiDir = baseDir + '/emojicustom' customEmojiDir = baseDir + '/emojicustom'
if not os.path.isdir(customEmojiDir): if not os.path.isdir(customEmojiDir):
os.mkdir(customEmojiDir) os.mkdir(customEmojiDir)
@ -270,6 +273,8 @@ def _saveCustomEmoji(session, baseDir: str, emojiName: str, url: str,
if not emojiJson.get(emojiName): if not emojiJson.get(emojiName):
emojiJson[emojiName] = emojiName emojiJson[emojiName] = emojiName
saveJson(emojiJson, emojiJsonFilename) saveJson(emojiJson, emojiJsonFilename)
if debug:
print('Saved custom emoji ' + emojiJsonFilename)
def replaceEmojiFromTags(session, baseDir: str, def replaceEmojiFromTags(session, baseDir: str,