Compare commits
No commits in common. "c4-intro-chapters" and "main" have entirely different histories.
c4-intro-c
...
main
@ -267,31 +267,13 @@ class ALL4(Service):
|
||||
def get_chapters(self, title: Union[Movie, Episode]) -> list[Chapter]:
|
||||
track = title.tracks.videos[0]
|
||||
|
||||
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],
|
||||
)
|
||||
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 track.data.get("endCredits", {}).get("squeezeIn"):
|
||||
chapters.append(
|
||||
@ -302,7 +284,8 @@ class ALL4(Service):
|
||||
).strftime("%H:%M:%S.%f")[:-3],
|
||||
)
|
||||
)
|
||||
return sorted(chapters, key=lambda x: x.timestamp)
|
||||
|
||||
return chapters
|
||||
|
||||
def get_widevine_service_certificate(self, **_: Any) -> str:
|
||||
return WidevineCdm.common_privacy_cert
|
||||
|
Loading…
x
Reference in New Issue
Block a user