fix(ROKU): Fix missing credits

This commit is contained in:
stabbedbybrick 2024-04-14 09:24:36 +02:00
parent df369e42c2
commit ffbcf011e0

View File

@ -209,15 +209,15 @@ class ROKU(Service):
chapters = [Chapter(name=f"Chapter {i + 1:02}", timestamp=ad.split(".")[0]) for i, ad in enumerate(timestamps)] chapters = [Chapter(name=f"Chapter {i + 1:02}", timestamp=ad.split(".")[0]) for i, ad in enumerate(timestamps)]
if track.data.get("playbackMedia", {}).get("creditCuePoints"): if track.data.get("playbackMedia", {}).get("creditCuePoints"):
chapters.append( start = next((
Chapter( x.get("start") for x in track.data["playbackMedia"]["creditCuePoints"] if x.get("start") != 0), None)
name="Credits", if start:
timestamp=datetime.fromtimestamp( chapters.append(
(track.data["playbackMedia"]["creditCuePoints"][0]["start"] / 1000), Chapter(
tz=timezone.utc, name="Credits",
).strftime("%H:%M:%S.%f")[:-3], timestamp=datetime.fromtimestamp((start / 1000), tz=timezone.utc).strftime("%H:%M:%S.%f")[:-3],
)
) )
)
return chapters return chapters