mkv-episode-matcher 0.1.13__py3-none-any.whl → 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mkv-episode-matcher might be problematic. Click here for more details.
- mkv_episode_matcher/__main__.py +8 -4
- mkv_episode_matcher/episode_identification.py +208 -0
- mkv_episode_matcher/episode_matcher.py +98 -242
- mkv_episode_matcher/libraries/pgs2srt/Libraries/SubZero/SubZero.py +38 -12
- mkv_episode_matcher/libraries/pgs2srt/Libraries/SubZero/dictionaries/data.py +16644 -193
- mkv_episode_matcher/libraries/pgs2srt/Libraries/SubZero/post_processing.py +125 -80
- mkv_episode_matcher/libraries/pgs2srt/imagemaker.py +7 -5
- mkv_episode_matcher/libraries/pgs2srt/pgs2srt.py +49 -20
- mkv_episode_matcher/libraries/pgs2srt/pgsreader.py +53 -49
- mkv_episode_matcher/mkv_to_srt.py +150 -22
- mkv_episode_matcher/speech_to_text.py +90 -0
- mkv_episode_matcher/utils.py +222 -74
- mkv_episode_matcher-0.3.0.dist-info/METADATA +119 -0
- mkv_episode_matcher-0.3.0.dist-info/RECORD +25 -0
- mkv_episode_matcher/notebooks/get_subtitles_test.ipynb +0 -252
- mkv_episode_matcher/notebooks/whisper.ipynb +0 -122
- mkv_episode_matcher-0.1.13.dist-info/METADATA +0 -113
- mkv_episode_matcher-0.1.13.dist-info/RECORD +0 -25
- {mkv_episode_matcher-0.1.13.dist-info → mkv_episode_matcher-0.3.0.dist-info}/WHEEL +0 -0
- {mkv_episode_matcher-0.1.13.dist-info → mkv_episode_matcher-0.3.0.dist-info}/entry_points.txt +0 -0
- {mkv_episode_matcher-0.1.13.dist-info → mkv_episode_matcher-0.3.0.dist-info}/top_level.txt +0 -0
|
@@ -51,6 +51,7 @@ class Processor:
|
|
|
51
51
|
"""
|
|
52
52
|
Processor base class
|
|
53
53
|
"""
|
|
54
|
+
|
|
54
55
|
name = None
|
|
55
56
|
parent = None
|
|
56
57
|
supported = None
|
|
@@ -69,7 +70,7 @@ class Processor:
|
|
|
69
70
|
return content
|
|
70
71
|
|
|
71
72
|
def __repr__(self):
|
|
72
|
-
return "Processor
|
|
73
|
+
return f"Processor <{self.__class__.__name__} {self.info}>"
|
|
73
74
|
|
|
74
75
|
def __str__(self):
|
|
75
76
|
return repr(self)
|
|
@@ -82,10 +83,13 @@ class ReProcessor(Processor):
|
|
|
82
83
|
"""
|
|
83
84
|
Regex processor
|
|
84
85
|
"""
|
|
86
|
+
|
|
85
87
|
pattern = None
|
|
86
88
|
replace_with = None
|
|
87
89
|
|
|
88
|
-
def __init__(
|
|
90
|
+
def __init__(
|
|
91
|
+
self, pattern, replace_with, name=None, supported=None, entry=False, **kwargs
|
|
92
|
+
):
|
|
89
93
|
super(ReProcessor, self).__init__(name=name, supported=supported)
|
|
90
94
|
self.pattern = pattern
|
|
91
95
|
self.replace_with = replace_with
|
|
@@ -116,6 +120,7 @@ class MultipleWordReProcessor(ReProcessor):
|
|
|
116
120
|
}
|
|
117
121
|
replaces found key in pattern with the corresponding value in data
|
|
118
122
|
"""
|
|
123
|
+
|
|
119
124
|
def __init__(self, snr_dict, name=None, parent=None, supported=None, **kwargs):
|
|
120
125
|
super(ReProcessor, self).__init__(name=name, supported=supported)
|
|
121
126
|
self.snr_dict = snr_dict
|
|
@@ -124,7 +129,9 @@ class MultipleWordReProcessor(ReProcessor):
|
|
|
124
129
|
if not self.snr_dict["data"]:
|
|
125
130
|
return content
|
|
126
131
|
|
|
127
|
-
return self.snr_dict["pattern"].sub(
|
|
132
|
+
return self.snr_dict["pattern"].sub(
|
|
133
|
+
lambda x: self.snr_dict["data"][x.group(0)], content
|
|
134
|
+
)
|
|
128
135
|
|
|
129
136
|
|
|
130
137
|
class EmptyEntryError(Exception):
|
|
@@ -151,7 +158,9 @@ class SubtitleModification:
|
|
|
151
158
|
def __init__(self):
|
|
152
159
|
return
|
|
153
160
|
|
|
154
|
-
def _process(
|
|
161
|
+
def _process(
|
|
162
|
+
self, content, processors, debug=False, parent=None, index=None, **kwargs
|
|
163
|
+
):
|
|
155
164
|
if not content:
|
|
156
165
|
return
|
|
157
166
|
|
|
@@ -184,13 +193,19 @@ class SubtitleModification:
|
|
|
184
193
|
return new_content
|
|
185
194
|
|
|
186
195
|
def pre_process(self, content, debug=False, parent=None, **kwargs):
|
|
187
|
-
return self._process(
|
|
196
|
+
return self._process(
|
|
197
|
+
content, self.pre_processors, debug=debug, parent=parent, **kwargs
|
|
198
|
+
)
|
|
188
199
|
|
|
189
200
|
def process(self, content, debug=False, parent=None, **kwargs):
|
|
190
|
-
return self._process(
|
|
201
|
+
return self._process(
|
|
202
|
+
content, self.processors, debug=debug, parent=parent, **kwargs
|
|
203
|
+
)
|
|
191
204
|
|
|
192
205
|
def post_process(self, content, debug=False, parent=None, **kwargs):
|
|
193
|
-
return self._process(
|
|
206
|
+
return self._process(
|
|
207
|
+
content, self.post_processors, debug=debug, parent=parent, **kwargs
|
|
208
|
+
)
|
|
194
209
|
|
|
195
210
|
def modify(self, content, debug=False, parent=None, procs=None, **kwargs):
|
|
196
211
|
if not content:
|
|
@@ -200,15 +215,22 @@ class SubtitleModification:
|
|
|
200
215
|
for method in procs or ("pre_process", "process", "post_process"):
|
|
201
216
|
if not new_content:
|
|
202
217
|
return
|
|
203
|
-
new_content = self._process(
|
|
204
|
-
|
|
218
|
+
new_content = self._process(
|
|
219
|
+
new_content,
|
|
220
|
+
getattr(self, f"{method}ors"),
|
|
221
|
+
debug=debug,
|
|
222
|
+
parent=parent,
|
|
223
|
+
**kwargs,
|
|
224
|
+
)
|
|
205
225
|
|
|
206
226
|
return new_content
|
|
207
227
|
|
|
208
228
|
@classmethod
|
|
209
229
|
def get_signature(cls, **kwargs):
|
|
210
|
-
string_args = ",".join([
|
|
211
|
-
|
|
230
|
+
string_args = ",".join([
|
|
231
|
+
f"{key}={value}" for key, value in kwargs.items()
|
|
232
|
+
])
|
|
233
|
+
return f"{cls.identifier}({string_args})"
|
|
212
234
|
|
|
213
235
|
@classmethod
|
|
214
236
|
def merge_args(cls, args1, args2):
|
|
@@ -224,7 +246,9 @@ class StringProcessor(Processor):
|
|
|
224
246
|
String replacement processor base
|
|
225
247
|
"""
|
|
226
248
|
|
|
227
|
-
def __init__(
|
|
249
|
+
def __init__(
|
|
250
|
+
self, search, replace, name=None, parent=None, supported=None, **kwargs
|
|
251
|
+
):
|
|
228
252
|
super(StringProcessor, self).__init__(name=name, supported=supported)
|
|
229
253
|
self.search = search
|
|
230
254
|
self.replace = replace
|
|
@@ -243,6 +267,7 @@ class MultipleLineProcessor(Processor):
|
|
|
243
267
|
"data": {"old_value": "new_value"}
|
|
244
268
|
}
|
|
245
269
|
"""
|
|
270
|
+
|
|
246
271
|
def __init__(self, snr_dict, name=None, parent=None, supported=None, **kwargs):
|
|
247
272
|
super(MultipleLineProcessor, self).__init__(name=name, supported=supported)
|
|
248
273
|
self.snr_dict = snr_dict
|
|
@@ -286,6 +311,7 @@ class MultipleWordProcessor(MultipleLineProcessor):
|
|
|
286
311
|
"data": {"old_value": "new_value"}
|
|
287
312
|
}
|
|
288
313
|
"""
|
|
314
|
+
|
|
289
315
|
def process(self, content, debug=False, **kwargs):
|
|
290
316
|
words = content.split(" ")
|
|
291
317
|
new_words = []
|