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
This commit is contained in:
apricotjam4 2025-04-14 16:41:58 +01:00
parent 7be7ce7b01
commit 59dc8e7ec9

View File

@ -269,12 +269,28 @@ class ALL4(Service):
chapters = [
Chapter(
name=f"Chapter {i + 1:02}",
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"])
]
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],
)
)
if track.data.get("endCredits", {}).get("squeezeIn"):
chapters.append(
Chapter(
@ -284,8 +300,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