mirror of
https://git.sr.ht/~cadence/NewLeaf
synced 2026-06-27 23:25:27 +00:00
Support new channel views layout
This commit is contained in:
parent
19ed025d1b
commit
c4182790b6
2 changed files with 8 additions and 3 deletions
|
|
@ -169,15 +169,16 @@ def uncompress_counter(text):
|
|||
return int(float(text[:-1]) * multiplier)
|
||||
|
||||
def past_text_to_time(text):
|
||||
words = text.split(" ")
|
||||
spaced_text = re.sub(r"^([0-9]+)([^ ])", r"\1 \2", text)
|
||||
words = spaced_text.split(" ")
|
||||
if words[0] == "Streamed":
|
||||
words = words[1:]
|
||||
if len(words) != 3:
|
||||
print(words)
|
||||
raise Exception("Past text is not 3 words")
|
||||
raise Exception(f"Past text is not 3 words: '{text}'")
|
||||
if words[2] != "ago":
|
||||
print(words)
|
||||
raise Exception('Past text does not end with "ago"')
|
||||
raise Exception(f"Past text does not end with \"ago\": '{text}'")
|
||||
number = int(words[0])
|
||||
unit = words[1][:2]
|
||||
multiplier = 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue