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