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:
parent
7be7ce7b01
commit
003086953f
@ -269,12 +269,28 @@ class ALL4(Service):
|
|||||||
|
|
||||||
chapters = [
|
chapters = [
|
||||||
Chapter(
|
Chapter(
|
||||||
name=f"Chapter {i + 1:02}",
|
|
||||||
timestamp=datetime.fromtimestamp((ms / 1000), tz=timezone.utc).strftime("%H:%M:%S.%f")[:-3],
|
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"])
|
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(
|
||||||
|
(track.data["skipIntro"]["skipStart"] / 1000), tz=timezone.utc
|
||||||
|
).strftime("%H:%M:%S.%f")[:-3],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
chapters.append(
|
||||||
|
Chapter(
|
||||||
|
timestamp=datetime.fromtimestamp(
|
||||||
|
(track.data["skipIntro"]["skipEnd"] / 1000), tz=timezone.utc
|
||||||
|
).strftime("%H:%M:%S.%f")[:-3],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if track.data.get("endCredits", {}).get("squeezeIn"):
|
if track.data.get("endCredits", {}).get("squeezeIn"):
|
||||||
chapters.append(
|
chapters.append(
|
||||||
Chapter(
|
Chapter(
|
||||||
@ -284,8 +300,7 @@ class ALL4(Service):
|
|||||||
).strftime("%H:%M:%S.%f")[:-3],
|
).strftime("%H:%M:%S.%f")[:-3],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
return sorted(chapters, key=lambda x: x.timestamp)
|
||||||
return chapters
|
|
||||||
|
|
||||||
def get_widevine_service_certificate(self, **_: Any) -> str:
|
def get_widevine_service_certificate(self, **_: Any) -> str:
|
||||||
return WidevineCdm.common_privacy_cert
|
return WidevineCdm.common_privacy_cert
|
||||||
|
Loading…
x
Reference in New Issue
Block a user