MCPcopy Create free account
hub / github.com/smacke/ffsubsync / SubtitleShifter

Class SubtitleShifter

ffsubsync/subtitle_transformers.py:13–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11
12
13class SubtitleShifter(SubsMixin, TransformerMixin):
14 def __init__(self, td_seconds):
15 super(SubsMixin, self).__init__()
16 if not isinstance(td_seconds, timedelta):
17 self.td_seconds = timedelta(seconds=td_seconds)
18 else:
19 self.td_seconds = td_seconds
20
21 def fit(self, subs: GenericSubtitlesFile, *_):
22 self.subs_ = subs.offset(self.td_seconds)
23 return self
24
25 def transform(self, *_):
26 return self.subs_
27
28
29class SubtitleScaler(SubsMixin, TransformerMixin):

Callers 3

try_syncFunction · 0.90
test_same_encodingFunction · 0.90
test_offsetFunction · 0.90

Calls

no outgoing calls

Tested by 2

test_same_encodingFunction · 0.72
test_offsetFunction · 0.72