| 11 | |
| 12 | |
| 13 | class 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 | |
| 29 | class SubtitleScaler(SubsMixin, TransformerMixin): |
no outgoing calls