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:
parent
59dc8e7ec9
commit
a160df06a5
@ -267,12 +267,14 @@ class ALL4(Service):
|
|||||||
def get_chapters(self, title: Union[Movie, Episode]) -> list[Chapter]:
|
def get_chapters(self, title: Union[Movie, Episode]) -> list[Chapter]:
|
||||||
track = title.tracks.videos[0]
|
track = title.tracks.videos[0]
|
||||||
|
|
||||||
chapters = [
|
chapters = []
|
||||||
Chapter(
|
|
||||||
|
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],
|
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"):
|
if intro_data := track.data.get("skipIntro"):
|
||||||
chapters.append(
|
chapters.append(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user