Exemple #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)
Exemple #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)
Exemple #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())
Exemple #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")
Exemple #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 = []
Exemple #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
Exemple #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)
Exemple #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)
Exemple #9
0
def bulb_color_green():
    if bulb.is_on == False:
      say("Please turn on the lights first.")
    else:
      bulb.hsv = (120, 75, 100)
Exemple #10
0
def swiper():
    say("ohhh! maaan!")
    mind('boot')
Exemple #11
0
def thank_you():
     say("you're welcome, f****r")
Exemple #12
0
def say_day():
    """ Speak the current day. """
    day = oa.legacy.sys.day_name()
    say('- Today is %s.' % day)
Exemple #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)
Exemple #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()
Exemple #15
0
def bulb_color_white():
    if bulb.is_on == False:
      say("Please turn on the lights first.")
    else:
      bulb.color_temp = (9000)
Exemple #16
0
def open_root():
    #play('beep_open.wav')
    say('Whats up?')
    mind('root')
Exemple #17
0
def say_last_command(string = ''):
    say(string + ' ' + oa.last_command)
Exemple #18
0
def say_day():
    """ Speak the current day. """
    day = oa.sys.day_name()
    say('Nous sommes aujourd\'hui le %s.' %day)
Exemple #19
0
def say_time():
    """ Speak the current time. """
    time = oa.sys.time_text()
    say('Il est %s.' %time)
Exemple #20
0
def list_commands():
    say('The currently available voice commands are..')
    [say(cmd) for cmd in kws.keys()]
Exemple #21
0
def bulb_color_purple():
    if bulb.is_on == False:
      say("Please turn on the lights first.")
    else:
      bulb.hsv = (259, 75, 100)
Exemple #22
0
def hello_world():
    say('- Hello world!')
Exemple #23
0
def bulb_color_pink():
    if bulb.is_on == False:
      say("Please turn on the lights first.")
    else:
      bulb.hsv = (301, 79, 100)
Exemple #24
0
def hello_world():
     say('Hi William')
Exemple #25
0
def bulb_color_lime():
    if bulb.is_on == False:
      say("Please turn on the lights first.")
    bulb.hsv = (106, 48, 100)
Exemple #26
0
def who():
    say('Hi William, this is elsa')
Exemple #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()
Exemple #28
0
def list_commands():
    say('- The currently available voice commands are:\n{}'.format(',\n'.join(kws.keys())))
Exemple #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
Exemple #30
0
def say_time():
    """ Speak the current time. """
    time = oa.legacy.sys.time_text()
    say('- The time is %s.' % time)