ALL4: don't extract pre-roll (0:00:00) ads as a chapter

so we don't get dupes if the intro chapter is at 0ms
core still sets a chapter at 0:00:00 no matter what, so it's fine™
This commit is contained in:
apricotjam4 2025-04-14 16:51:53 +01:00
parent 59dc8e7ec9
commit a160df06a5

View File

@ -267,12 +267,14 @@ class ALL4(Service):
def get_chapters(self, title: Union[Movie, Episode]) -> list[Chapter]:
track = title.tracks.videos[0]
chapters = [
Chapter(
timestamp=datetime.fromtimestamp((ms / 1000), tz=timezone.utc).strftime("%H:%M:%S.%f")[:-3],
)
for i, ms in enumerate(x["breakOffset"] for x in track.data["adverts"]["breaks"])
]
chapters = []
for x in track.data["adverts"]["breaks"]:
ms = x.get("breakOffset")
if ms != 0:
chapters.append(Chapter(
timestamp=datetime.fromtimestamp((ms / 1000), tz=timezone.utc).strftime("%H:%M:%S.%f")[:-3],
))
if intro_data := track.data.get("skipIntro"):
chapters.append(