def __init__(self, text):
     self.voice = voice_recognizer()
     if len(text.split()) != 1:
         self.command = text.split()[0]
         j = []
         for i in range(1, len(text.split())):
             j.append(text.split()[i])
         self.task = ' '.join(j)
     else:
         self.command = text
Exemplo n.º 2
0
 def up(self):
     voice = voice_recognizer()
     try:
         with open('/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight/brightness', 'r') as f:
             value = f.read()
         value = int(value) + 50
         if value > 950:
             print('brightness maximum')
             voice.say(text="brightness maximum")
         else:
             with open('/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight/brightness', 'w') as f:
                 f.write(str(value))
             print("Done")
             voice.say(audio="done.mp3")
     except:
         print('something went wrong at brightness up section!!!')
         voice.say(text='something went wrong at brightness up section!!!')
Exemplo n.º 3
0
 def to(self, new_value):
     voice = voice_recognizer()
     try:
         v = int(new_value[0:-1])*10
         if v > 950:
             value = 950
         elif v < 150:
             value =150
         else:
             value = v
         with open('/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight/brightness', 'w') as f:
             f.write(str(value))
         print("Done")
         voice.say(audio="done.mp3")
     except:
         print('something went wrong at brightness up/down section!!!')
         voice.say(text='something went wrong at brightness up/down section!!!')
Exemplo n.º 4
0
#!/usr/bin/python3

import voice_lab
import operation_section as op_sec

voice = voice_lab.voice_recognizer()
print("Hey how may I help you?")
voice.say(audio="hay_how_may_i_help_you.mp3")
no = [
    'no', 'nothing', 'not', 'bye', 'goodbye', 'stop', 'shut up',
    'nothing else', 'cancel', 'f*** yourself', 'f*** off', 'f*** of',
    'no thanks', 'now f*** yourself'
]

while True:
    a = voice.get_voice()
    txt = voice.recognizer(a)
    if txt == "voice error.":
        continue
    elif txt in no:
        voice.say(audio="okay_see_you_later.mp3")
        break
    # voice.say(text=txt)
    o = op_sec.operations(txt)
    o.analysis()
    print("Anything else?")
    voice.say(audio="anything_else.mp3")
Exemplo n.º 5
0
 def __init__(self):
     from weather import Weather
     self.voice = voice_recognizer()
     self.weather = Weather(unit='c')
Exemplo n.º 6
0
 def __init__(self):
     import datetime, time
     self.voice = voice_recognizer()
     self.time = datetime.datetime.now()
     self.date = time.asctime()
Exemplo n.º 7
0
 def __inti__(self):
     self.voice = voice_recognizer()