Пример #1
0
def diagnostics():
    """ Run system diagnostics. """
    response = 'Lancement des diagnostiques... '

    # Processor Temperature.
    if hasattr(psutil, "sondes_de_temperatures"):
        temps = psutil.sensors_temperatures()
        if not temps:
            response += "Impossible de lire la temperature.\n"
        else:
            for name, entries in temps.items():
                for entry in entries:
                    response += 'La temperature du proccesseur est actuellement de %.0f degrés centigrade...\n' %entry.current
                    break
                break

    # Memory Free.
    response += 'La memoire système est a %.0f Gigaoctet de libre...\n' %bytes2gb(oa.sys.free_memory())

    # Drive Space Free.
    response += 'Le disque dur interne est libre a %.0f Gigaoctet...\n' %bytes2gb(psutil.disk_usage('/').free)

    # Network Status.
    response += switch(is_online(), True, 'L\'accès à Internet est opérationnel.', 'Nous sommes hors-ligne.')

    say(response)
Пример #2
0
def diagnostics():
    """ Run system diagnostics. """
    response = '- Running diagnostics... '

    # Processor Temperature.
    if hasattr(psutil, "sensors_temperatures"):
        temps = psutil.sensors_temperatures()
        if not temps:
            response += "Unable to read temperature.\n"
        else:
            for name, entries in temps.items():
                for entry in entries:
                    response += 'Proccessor temperature is currently %.0f degrees Centegrade...\n' % entry.current
                    break
                break

    # Memory Free.
    response += 'System memory has %.0f Gigabytes free...\n' % oa.legacy.bytes2gb(
        oa.legacy.sys.free_memory())

    # Drive Space Free.
    response += 'Internal hard drive has %.0f Gigabytes free...\n' % oa.legacy.bytes2gb(
        psutil.disk_usage('/').free)

    # Network Status.
    response += oa.legacy.switch(is_online(), True,
                                 'Internet access is currently available.',
                                 'We are offline.')

    say(response)
Пример #3
0
def bulb_turn_off():
    if bulb:
        asyncio.run(bulb.update())
        if bulb.is_off == True:
            say("But it's already turn off. Nothing to be done.")
        else:
            asyncio.run(bulb.turn_off())
Пример #4
0
def m_info():
    try:
        meta = media_getmetadata()
        title = meta[dbus.String('xesam:title')]
        album = meta[dbus.String('xesam:album')]
        artist = meta[dbus.String('xesam:artist')][0]
        say("Currently playing" + title + ", from album " + album + ", by" +
            artist)
    except:
        say("no media players detected")
Пример #5
0
def calculate():
    ret = expr2str()
    info(oa.sys.expr)
    info('expr=' + ret)
    try:
        say(eval(ret))
    except:
        say('Error. Wrong expression. ' + ret)
    # Clear the expression.
    oa.sys.expr = []
Пример #6
0
def read_news_feed(news_feed, category):
    rss = feedparser.parse(news_feed)
    info(rss['feed']['title'])
    say('Lecture de l\'actualité %s.' %category)
    headline_count = 1

    # Amount of headlines to read.
    headline_amount = 5

    for post in rss.entries:
        if(headline_count == headline_amount):
            break
        else:
            headline = post.title
            exclude = set(string.punctuation)
            headline = ''.join(ch for ch in headline if ch not in exclude)
            say(headline)
            headline_count += 1
Пример #7
0
def read_forecast():
    import forecastio
    """ Get the weather forecast from Dark Sky (darksky.net).
    Get your API key and longitude / latitude at: https://darksky.net/dev/
    Install 'forecastio' module with: `pip install python-forcastio` """

    # Weather For Amberg, Germany.

    api_key = "e3f8667cb539171dc2f4b389d33648ce"
    lat = 47.409342
    lng = 0.681183

    forecast = forecastio.load_forecast(api_key, lat, lng, lang='fr')
    byNow = forecast.currently()
    byHour = forecast.hourly()
    byDay = forecast.daily()
    weather_summary = """La météo actuelle est %s.\n La temperature est de %d degrés Celsius.\n %s \n %s""" %(byNow.summary, int(byNow.temperature),byHour.summary,byDay.summary)
    say(weather_summary)
Пример #8
0
def read_forecast():
    import forecastio
    """ Get the weather forecast from Dark Sky (darksky.net).
    Get your API key and longitude / latitude at: https://darksky.net/dev/
    Install 'forecastio' module with: `pip install python-forcastio` """

    # Weather For Amberg, Germany.

    api_key = "e3f8667cb539171dc2f4b389d33648ce"
    lat = 49.44287
    lng = 11.86267

    forecast = forecastio.load_forecast(api_key, lat, lng, lang='en')
    byNow = forecast.currently()
    byHour = forecast.hourly()
    byDay = forecast.daily()
    weather_summary = """ - The weather is currently %s.\n The temperature is %d degrees Celsius.\n %s \n %s""" % (
        byNow.summary, int(byNow.temperature), byHour.summary, byDay.summary)
    say(weather_summary)
Пример #9
0
def bulb_color_green():
    if bulb.is_on == False:
      say("Please turn on the lights first.")
    else:
      bulb.hsv = (120, 75, 100)
Пример #10
0
def swiper():
    say("ohhh! maaan!")
    mind('boot')
Пример #11
0
def thank_you():
     say("you're welcome, f****r")
Пример #12
0
def say_day():
    """ Speak the current day. """
    day = oa.legacy.sys.day_name()
    say('- Today is %s.' % day)
Пример #13
0
def bulb_color_yellow():
    if bulb.is_on == False:
      say("Please turn on the lights first.")
    else:
      bulb.color_temp = 2500
      bulb.hsv = (0, 0, 100)
Пример #14
0
def bulb_turn_on():
    if bulb.is_on == True:
      say("But It's already turn on. Nothing to be done.")
    else:
      bulb.turn_on()
Пример #15
0
def bulb_color_white():
    if bulb.is_on == False:
      say("Please turn on the lights first.")
    else:
      bulb.color_temp = (9000)
Пример #16
0
def open_root():
    #play('beep_open.wav')
    say('Whats up?')
    mind('root')
Пример #17
0
def say_last_command(string = ''):
    say(string + ' ' + oa.last_command)
Пример #18
0
def say_day():
    """ Speak the current day. """
    day = oa.sys.day_name()
    say('Nous sommes aujourd\'hui le %s.' %day)
Пример #19
0
def say_time():
    """ Speak the current time. """
    time = oa.sys.time_text()
    say('Il est %s.' %time)
Пример #20
0
def list_commands():
    say('The currently available voice commands are..')
    [say(cmd) for cmd in kws.keys()]
Пример #21
0
def bulb_color_purple():
    if bulb.is_on == False:
      say("Please turn on the lights first.")
    else:
      bulb.hsv = (259, 75, 100)
Пример #22
0
def hello_world():
    say('- Hello world!')
Пример #23
0
def bulb_color_pink():
    if bulb.is_on == False:
      say("Please turn on the lights first.")
    else:
      bulb.hsv = (301, 79, 100)
Пример #24
0
def hello_world():
     say('Hi William')
Пример #25
0
def bulb_color_lime():
    if bulb.is_on == False:
      say("Please turn on the lights first.")
    bulb.hsv = (106, 48, 100)
Пример #26
0
def who():
    say('Hi William, this is elsa')
Пример #27
0
def bulb_turn_off():
    if bulb.is_off == True:
      say("But it's already turn off. Nothing to be done.")
    else:
      bulb.turn_off()
Пример #28
0
def list_commands():
    say('- The currently available voice commands are:\n{}'.format(',\n'.join(kws.keys())))
Пример #29
0
def close(s):
    """ Close an application by a window or process name.
        A partial window name will work, for example: 'note*'. """
    say('- Unable to close %s for now.' % s)
    pass
Пример #30
0
def say_time():
    """ Speak the current time. """
    time = oa.legacy.sys.time_text()
    say('- The time is %s.' % time)