blob: 704109f994d7d97a37133a11a4c8a40f8a9266d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
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."""
if '_closed_caption' in pv_props and self.cc_re.search(pv_props['_closed_caption']):
return True
if 'guessed' in pv_props:
guessed = pv_props['guessed']
return guessed.get('closed_caption')
class HearingImpairedRule(Rule):
"""Hearing Impaired rule."""
def execute(self, props, pv_props, context):
"""Hearing Impaired."""
if 'guessed' in pv_props:
guessed = pv_props['guessed']
return guessed.get('hearing_impaired')
|