update
This commit is contained in:
13
parse.py
13
parse.py
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user