fix(Subtitle): Skip merging segmented WebVTT if only 1 segment

This commit is contained in:
rlaphoenix 2024-05-17 01:42:44 +01:00
parent 3426fc145f
commit 0310646cb2
1 changed files with 12 additions and 10 deletions

View File

@ -206,12 +206,14 @@ class Subtitle(Track):
elif self.codec == Subtitle.Codec.WebVTT:
text = self.path.read_text("utf8")
if self.descriptor == Track.Descriptor.DASH:
if len(self.data["dash"]["segment_durations"]) > 1:
text = merge_segmented_webvtt(
text,
segment_durations=self.data["dash"]["segment_durations"],
timescale=self.data["dash"]["timescale"]
)
elif self.descriptor == Track.Descriptor.HLS:
if len(self.data["hls"]["segment_durations"]) > 1:
text = merge_segmented_webvtt(
text,
segment_durations=self.data["hls"]["segment_durations"],