Use label in eventLog/timeline
This commit is contained in:
parent
ca6fd3e527
commit
d0cd1a25d7
1 changed files with 11 additions and 1 deletions
|
@ -57,6 +57,7 @@ class Message(object):
|
|||
def __init__(self, id, text):
|
||||
self.id = id
|
||||
self.text = text
|
||||
self.label = None
|
||||
self.isStart = False
|
||||
self.isStrandStart = False
|
||||
self.chapterStart = False
|
||||
|
@ -106,6 +107,7 @@ class Message(object):
|
|||
msg.chapterStart = bool(data['chapterStart']) if 'chapterStart' in data else False
|
||||
msg.afterrunTime = data['afterrun'] if 'afterrun' in data else 0. # TODO: investigate deprecation?
|
||||
msg.color = data['color'] if 'color' in data else None
|
||||
msg.label = data['label'] if 'label' in data else None
|
||||
if 'audio' in data and data['audio'] is not None:
|
||||
msg.audioFile = data['audio']['file']
|
||||
msg.setStory(story)
|
||||
|
@ -164,6 +166,14 @@ class Message(object):
|
|||
text = text.replace('$'+var, replacement)
|
||||
return text
|
||||
|
||||
def getLabel(self):
|
||||
"""
|
||||
When a label is set, return that, else the original text
|
||||
"""
|
||||
if self.label and len(self.label):
|
||||
return self.label
|
||||
return self.getText()
|
||||
|
||||
def setReply(self, reply):
|
||||
self.reply = reply
|
||||
|
||||
|
@ -1878,7 +1888,7 @@ class Story(object):
|
|||
if message.id != self.startMessage.id:
|
||||
self.addToLog(message)
|
||||
|
||||
self.hugvey.eventLogger.info(f"message: {message.id} {message.uuid} start \"{message.getText()}\"")
|
||||
self.hugvey.eventLogger.info(f"message: {message.id} {message.uuid} start \"{message.getLabel()}\"")
|
||||
|
||||
# TODO: prep events & timer etc.
|
||||
fn = await message.getAudioFilePath()
|
||||
|
|
Loading…
Reference in a new issue