This commit is contained in:
olari
2021-06-11 20:56:33 +03:00
parent 557df1bb20
commit 689c40b58d
4 changed files with 384 additions and 21 deletions

View File

@@ -50,8 +50,15 @@ def parse_post(block):
block = block[19:]
except:
timestamp = None
content = block
return {'timestamp': timestamp, 'content': content}
content = block.strip()
result = {}
if content:
result['content'] = content
if timestamp:
result['timestamp'] = timestamp
return result
def parse_notes(block):
tag, source, title = block.splitlines()
@@ -59,7 +66,7 @@ def parse_notes(block):
def parse_diet(block):
tag, amount, food = block.split()
amount = float(amount.removesuffix('g'))
amount = int(amount.removesuffix('g'))
return {'amount': amount, 'food': food}
def parse_timer(block):