Compare commits

..

2 Commits

Author SHA1 Message Date
a160df06a5 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™
2025-04-14 16:55:30 +01:00
59dc8e7ec9 ALL4: More chapters from "Skip Intro" button
removed the generic chapter names as devine sets them automatically
+ this way it doesn't matter what order I add the chapters in,
I can just sort them at the end
2025-04-14 16:46:38 +01:00

View File

@ -267,13 +267,31 @@ class ALL4(Service):
def get_chapters(self, title: Union[Movie, Episode]) -> list[Chapter]:
track = title.tracks.videos[0]
chapters = [
Chapter(
name=f"Chapter {i + 1:02}",
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(
Chapter(
name="Intro",
timestamp=datetime.fromtimestamp(
(intro_data["skipStart"] / 1000), tz=timezone.utc
).strftime("%H:%M:%S.%f")[:-3],
)
)
chapters.append(
Chapter(
timestamp=datetime.fromtimestamp(
(intro_data["skipEnd"] / 1000), tz=timezone.utc
).strftime("%H:%M:%S.%f")[:-3],
)
)
for i, ms in enumerate(x["breakOffset"] for x in track.data["adverts"]["breaks"])
]
if track.data.get("endCredits", {}).get("squeezeIn"):
chapters.append(
@ -284,8 +302,7 @@ class ALL4(Service):
).strftime("%H:%M:%S.%f")[:-3],
)
)
return chapters
return sorted(chapters, key=lambda x: x.timestamp)
def get_widevine_service_certificate(self, **_: Any) -> str:
return WidevineCdm.common_privacy_cert