More debug

merge-requests/30/head
Bob Mottram 2021-11-01 18:33:32 +00:00
parent 430ed3ce4d
commit 2607ca87d4
2 changed files with 11 additions and 5 deletions

View File

@ -245,16 +245,17 @@ def _saveCustomEmoji(session, baseDir: str, emojiName: str, url: str,
debug: bool) -> None: debug: bool) -> None:
"""Saves custom emoji to file """Saves custom emoji to file
""" """
debug = True
if not session: if not session:
if debug: if debug:
print('_saveCustomEmoji no session') print('EX: _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':
if debug: if debug:
print('Custom emoji is wrong format ' + url) print('EX: Custom emoji is wrong format ' + url)
return return
emojiName = emojiName.replace(':').strip().lower() emojiName = emojiName.replace(':').strip().lower()
customEmojiDir = baseDir + '/emojicustom' customEmojiDir = baseDir + '/emojicustom'
@ -263,6 +264,8 @@ def _saveCustomEmoji(session, baseDir: str, emojiName: str, url: str,
emojiImageFilename = customEmojiDir + '/' + emojiName + '.' + ext emojiImageFilename = customEmojiDir + '/' + emojiName + '.' + ext
if not downloadImage(session, baseDir, url, if not downloadImage(session, baseDir, url,
emojiImageFilename, debug, False): emojiImageFilename, debug, False):
if debug:
print('EX: custom emoji not downloaded ' + url)
return return
emojiJsonFilename = customEmojiDir + '/emoji.json' emojiJsonFilename = customEmojiDir + '/emoji.json'
emojiJson = {} emojiJson = {}
@ -274,7 +277,9 @@ def _saveCustomEmoji(session, baseDir: str, emojiName: str, url: str,
emojiJson[emojiName] = emojiName emojiJson[emojiName] = emojiName
saveJson(emojiJson, emojiJsonFilename) saveJson(emojiJson, emojiJsonFilename)
if debug: if debug:
print('Saved custom emoji ' + emojiJsonFilename) print('EX: Saved custom emoji ' + emojiJsonFilename)
elif debug:
print('EX: cusom emoji already saved')
def replaceEmojiFromTags(session, baseDir: str, def replaceEmojiFromTags(session, baseDir: str,
@ -314,7 +319,7 @@ def replaceEmojiFromTags(session, baseDir: str,
replaceChar) replaceChar)
replaced = True replaced = True
except BaseException: except BaseException:
print('EX: replaceEmojiFromTags ' + print('EX: replaceEmojiFromTags 1 ' +
'no conversion of ' + 'no conversion of ' +
str(iconName) + ' to chr ' + str(iconName) + ' to chr ' +
tagItem['name'] + ' ' + tagItem['name'] + ' ' +
@ -337,7 +342,7 @@ def replaceEmojiFromTags(session, baseDir: str,
replaced = True replaced = True
except BaseException: except BaseException:
iconCodeSequence = '' iconCodeSequence = ''
print('EX: replaceEmojiFromTags ' + print('EX: replaceEmojiFromTags 2 ' +
'no conversion of ' + 'no conversion of ' +
str(icode) + ' to chr ' + str(icode) + ' to chr ' +
tagItem['name'] + ' ' + tagItem['name'] + ' ' +

View File

@ -1344,6 +1344,7 @@ def _createPostBase(baseDir: str,
tags = [] tags = []
for tagName, tag in hashtagsDict.items(): for tagName, tag in hashtagsDict.items():
tags.append(tag) tags.append(tag)
# get list of tags # get list of tags
if nickname != 'news': if nickname != 'news':
content = \ content = \