1
0
mirror of https://git.sr.ht/~cadence/NewLeaf synced 2024-12-22 21:16:58 +00:00

Fix past text conversion for past streams

This commit is contained in:
Cadence Ember 2020-08-14 00:00:36 +12:00
parent b36edbf3ae
commit 6c49edf3ae
No known key found for this signature in database
GPG Key ID: 128B99B1B74A6412

View File

@ -170,8 +170,14 @@ def uncompress_counter(text):
def past_text_to_time(text):
words = text.split(" ")
assert len(words) == 3, "3 words"
assert words[2] == "ago", 'ends with "ago"'
if words[0] == "Streamed":
words = words[1:]
if len(words) != 3:
print(words)
raise Exception("Past text is not 3 words")
if words[2] != "ago":
print(words)
raise Exception('Past text does not end with "ago"')
number = int(words[0])
unit = words[1][:2]
multiplier = 1