summaryrefslogtreecommitdiffhomepage
path: root/libs/knowit/rules/subtitle.py
diff options
context:
space:
mode:
authormorpheus65535 <[email protected]>2022-01-23 23:07:52 -0500
committermorpheus65535 <[email protected]>2022-01-23 23:07:52 -0500
commit0c3c5a02a75bc61b6bf6e303de20e11741d2afac (patch)
tree30ae1d524ffe5d54172b7a4a8445d90c3461e659 /libs/knowit/rules/subtitle.py
parent36bf0d219d0432c20e6314e0ce752b36f4d88e3c (diff)
downloadbazarr-0c3c5a02a75bc61b6bf6e303de20e11741d2afac.tar.gz
bazarr-0c3c5a02a75bc61b6bf6e303de20e11741d2afac.zip
Upgraded vendored Python dependencies to the latest versions and removed the unused dependencies.v1.0.3-beta.16
Diffstat (limited to 'libs/knowit/rules/subtitle.py')
-rw-r--r--libs/knowit/rules/subtitle.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/libs/knowit/rules/subtitle.py b/libs/knowit/rules/subtitle.py
new file mode 100644
index 000000000..fa16fdbc1
--- /dev/null
+++ b/libs/knowit/rules/subtitle.py
@@ -0,0 +1,27 @@
+import re
+
+from knowit.core import Rule
+
+
+class ClosedCaptionRule(Rule):
+ """Closed caption rule."""
+
+ cc_re = re.compile(r'(\bcc\d\b)', re.IGNORECASE)
+
+ def execute(self, props, pv_props, context):
+ """Execute closed caption rule."""
+ for name in (pv_props.get('_closed_caption'), props.get('name')):
+ if name and self.cc_re.search(name):
+ return True
+
+
+class HearingImpairedRule(Rule):
+ """Hearing Impaired rule."""
+
+ hi_re = re.compile(r'(\bsdh\b)', re.IGNORECASE)
+
+ def execute(self, props, pv_props, context):
+ """Hearing Impaired."""
+ name = props.get('name')
+ if name and self.hi_re.search(name):
+ return True