mirror of https://github.com/devine-dl/devine.git
fix(Subtitle): Skip merging segmented WebVTT if only 1 segment
This commit is contained in:
parent
3426fc145f
commit
0310646cb2
|
@ -206,17 +206,19 @@ class Subtitle(Track):
|
||||||
elif self.codec == Subtitle.Codec.WebVTT:
|
elif self.codec == Subtitle.Codec.WebVTT:
|
||||||
text = self.path.read_text("utf8")
|
text = self.path.read_text("utf8")
|
||||||
if self.descriptor == Track.Descriptor.DASH:
|
if self.descriptor == Track.Descriptor.DASH:
|
||||||
text = merge_segmented_webvtt(
|
if len(self.data["dash"]["segment_durations"]) > 1:
|
||||||
text,
|
text = merge_segmented_webvtt(
|
||||||
segment_durations=self.data["dash"]["segment_durations"],
|
text,
|
||||||
timescale=self.data["dash"]["timescale"]
|
segment_durations=self.data["dash"]["segment_durations"],
|
||||||
)
|
timescale=self.data["dash"]["timescale"]
|
||||||
|
)
|
||||||
elif self.descriptor == Track.Descriptor.HLS:
|
elif self.descriptor == Track.Descriptor.HLS:
|
||||||
text = merge_segmented_webvtt(
|
if len(self.data["hls"]["segment_durations"]) > 1:
|
||||||
text,
|
text = merge_segmented_webvtt(
|
||||||
segment_durations=self.data["hls"]["segment_durations"],
|
text,
|
||||||
timescale=1 # ?
|
segment_durations=self.data["hls"]["segment_durations"],
|
||||||
)
|
timescale=1 # ?
|
||||||
|
)
|
||||||
caption_set = pycaption.WebVTTReader().read(text)
|
caption_set = pycaption.WebVTTReader().read(text)
|
||||||
Subtitle.merge_same_cues(caption_set)
|
Subtitle.merge_same_cues(caption_set)
|
||||||
subtitle_text = pycaption.WebVTTWriter().write(caption_set)
|
subtitle_text = pycaption.WebVTTWriter().write(caption_set)
|
||||||
|
|
Loading…
Reference in New Issue