Stopping attempt to perform Skill Update unless connected to the internet

Stopping attempt to perform Skill Update unless connected to the internet.  Also added translatable versions of spoken messages.
pull/754/head
penrods 2017-05-08 20:30:02 -07:00 committed by Augusto Monteiro 'Sparky
parent 83e4f9e58f
commit 3c2b78c670
4 changed files with 18 additions and 9 deletions

View File

@ -0,0 +1,2 @@
Checking for updates
Just a moment while I update myself

View File

@ -0,0 +1,3 @@
I don't seem to be connected to the internet
I can't reach the internt right now
Unable to connect to the internet

View File

@ -0,0 +1,2 @@
I'm up to date now
Skills Updated. I'm ready to help you.

View File

@ -35,6 +35,7 @@ from mycroft.skills.core import load_skill, create_skill_descriptor, \
from mycroft.skills.intent_service import IntentService
from mycroft.util import connected
from mycroft.util.log import getLogger
import mycroft.dialog
# ignore DIGCHLD to terminate subprocesses correctly
signal.signal(signal.SIGCHLD, signal.SIG_IGN)
@ -66,10 +67,10 @@ def install_default_skills(speak=True):
t = p.communicate()[0]
if t.splitlines()[-1] == "Installed!" and speak:
ws.emit(Message("speak", {
'utterance': "Skills Updated. Mycroft is ready"}))
'utterance': mycroft.dialog.get("skills updated")}))
elif not connected():
ws.emit(Message("speak", {
'utterance': "Check your network connection"}))
'utterance': mycroft.dialog.get("no network connection")}))
else:
logger.error("Unable to invoke Mycroft Skill Manager: " + MSM_BIN)
@ -78,14 +79,15 @@ def install_default_skills(speak=True):
def skills_manager(message):
global skills_manager_timer, ws
if skills_manager_timer is None:
# TODO: Localization support
ws.emit(
Message("speak", {'utterance': "Checking for Updates"}))
if connected():
if skills_manager_timer is None:
ws.emit(
Message("speak", {'utterance':
mycroft.dialog.get("checking for updates")}))
# Install default skills and look for updates via Github
logger.debug("==== Invoking Mycroft Skill Manager: " + MSM_BIN)
install_default_skills(False)
# Install default skills and look for updates via Github
logger.debug("==== Invoking Mycroft Skill Manager: " + MSM_BIN)
install_default_skills(False)
# Perform check again once and hour
skills_manager_timer = Timer(3600, _skills_manager_dispatch)