aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/webvtt.py
diff options
context:
space:
mode:
Diffstat (limited to 'yt_dlp/webvtt.py')
-rw-r--r--yt_dlp/webvtt.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/yt_dlp/webvtt.py b/yt_dlp/webvtt.py
index ef55e6459..eee2a4a2d 100644
--- a/yt_dlp/webvtt.py
+++ b/yt_dlp/webvtt.py
@@ -331,6 +331,26 @@ class CueBlock(Block):
'settings': self.settings,
}
+ def __eq__(self, other):
+ return self.as_json == other.as_json
+
+ @classmethod
+ def from_json(cls, json):
+ return cls(
+ id=json['id'],
+ start=json['start'],
+ end=json['end'],
+ text=json['text'],
+ settings=json['settings']
+ )
+
+ def hinges(self, other):
+ if self.text != other.text:
+ return False
+ if self.settings != other.settings:
+ return False
+ return self.start <= self.end == other.start <= other.end
+
def parse_fragment(frag_content):
"""