mirror of
https://github.com/MarkParker5/STARK.git
synced 2025-01-03 10:44:02 +02:00
add command to Raspi.tv
This commit is contained in:
parent
7a98fbaee6
commit
e509a5087f
@ -51,6 +51,7 @@ class Command(ABC):
|
||||
_entities = {
|
||||
'word': lambda: r'\b[A-Za-zА-ЯЁа-яё0-9\-]+\b',
|
||||
'text': lambda: r'[A-Za-zА-ЯЁа-яё0-9\- ]+',
|
||||
'num': lambda: r'[0-9]+',
|
||||
'quest' : lambda: Command.compilePattern('(кто|что|как|какой|какая|какое|где|зачем|почему|сколько|чей|куда|когда)'),
|
||||
'repeat': lambda: Command.compilePattern('* ((повтор*)|(еще раз)|(еще*раз)*) *'),
|
||||
'true': lambda: Command.compilePattern('('+'|'.join(sysonyms.get('да'))+')'),
|
||||
|
17
Raspi/tv.py
17
Raspi/tv.py
@ -30,7 +30,7 @@ tv_off = Raspi('tv off', keywords, patterns)
|
||||
tv_off.setStart(method)
|
||||
################################################################################
|
||||
def method(params):
|
||||
Raspi.hdmi_cec('tx 4F:82:30:00')
|
||||
Raspi.hdmi_cec('tx 4F:82:20:00')
|
||||
voice = text = ''
|
||||
return {
|
||||
'type': 'simple',
|
||||
@ -43,6 +43,21 @@ patterns = ['* (выведи|вывести|покажи|открой|показ
|
||||
tv_hdmi = Raspi('tv hdmi source', keywords, patterns)
|
||||
tv_hdmi.setStart(method)
|
||||
################################################################################
|
||||
def method(params):
|
||||
port = params['num'] + '0' if len(params['num']) == 1 else params['num']
|
||||
Raspi.hdmi_cec(f'tx 4F:82:{port}:00')
|
||||
voice = text = ''
|
||||
return {
|
||||
'type': 'simple',
|
||||
'text': text,
|
||||
'voice': voice,
|
||||
}
|
||||
|
||||
keywords = {}
|
||||
patterns = ['* (выведи|вывести|покажи|открой|показать|открыть) * с (|провода|hdmi|кабеля|порта) * $num *']
|
||||
tv_hdmi = Raspi('tv hdmi source', keywords, patterns)
|
||||
tv_hdmi.setStart(method)
|
||||
################################################################################
|
||||
def method(params):
|
||||
Raspi.hdmi_cec('as')
|
||||
voice = text = ''
|
||||
|
Loading…
Reference in New Issue
Block a user