You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
707 B
28 lines
707 B
5 years ago
|
import re
|
||
|
|
||
3 years ago
|
from knowit.core import Rule
|
||
5 years ago
|
|
||
|
|
||
|
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
|
||
3 years ago
|
|
||
|
|
||
|
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
|