Skip to content

Commit

Permalink
adjust message checking with listwithbounds
Browse files Browse the repository at this point in the history
  • Loading branch information
NotQuiteApex committed Jan 30, 2023
1 parent 9cf07a1 commit 5dda5e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 5 additions & 6 deletions vodbot/chatlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,13 @@ def chat_to_listwithbounds(msgs: List[ChatMessage], vid_duration:int, msg_durati
for t in range(vid_duration):
current_msgs: List[ChatMessage] = []
for m in msgs:
if t < m.offset:
# time is before the offset
if t < m.offset or m.offset+msg_duration < t:
# time is before the offset OR
# time is after the offset plus its screen duration
continue
elif m.offset <= t <= m.offset+msg_duration:
# elif m.offset <= t <= m.offset+msg_duration:
else:
current_msgs.append(m)
elif m.offset+msg_duration < t:
# time is after the offset plus its screen duration
break

# check if the messages we need to display has changed
if current_msgs != last_msgs:
Expand Down
1 change: 1 addition & 0 deletions vodbot/twitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ def get_channel_vods(channel: Channel) -> List[Vod]:
type=n["type"], description=n["description"],
position=int(n["positionMilliseconds"]/1000),
duration=int(n["durationMilliseconds"]/1000)
# its fine to do the above because twitch's precision of message timings isnt greater than seconds
)
)

Expand Down

0 comments on commit 5dda5e0

Please sign in to comment.