Skip to content

Commit

Permalink
Chapter names no longer have a trailing set of brackets if they surro…
Browse files Browse the repository at this point in the history
…unded the timestamp
  • Loading branch information
Revnoplex committed Sep 13, 2023
1 parent 47c31ce commit b22dcbe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ayt_api/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,9 @@ def chapters(self) -> Optional[list[VideoChapter]]:
start = datetime.timedelta(seconds=seconds)
end = found_chapters[-1][0] if len(found_chapters) > 0 else self.duration
duration = end - start
found_chapters.append((start, duration, line.replace(raw_stamp, "", 1).strip().strip("-").strip()))
line = line.replace(raw_stamp, "", 1).strip(" -\n")
line = line[:-2].strip() if line.endswith("()") else line
found_chapters.append((start, duration, line))
return [VideoChapter(*chapter_data) for chapter_data in reversed(found_chapters)] if found_chapters else None

def current_chapter(self, position: datetime.timedelta) -> Optional[VideoChapter]:
Expand Down

0 comments on commit b22dcbe

Please sign in to comment.