From f3103da6b56adcb4820d9b5534acd5f187e4aa67 Mon Sep 17 00:00:00 2001 From: JarbasAI <33701864+JarbasAl@users.noreply.github.com> Date: Fri, 11 Nov 2022 08:46:08 +0000 Subject: [PATCH] fix/initial model dl (#9) plugin failed to load on first boot when attempting to download a model without internet --- ovos_stt_plugin_vosk/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ovos_stt_plugin_vosk/__init__.py b/ovos_stt_plugin_vosk/__init__.py index 647e950..aee51c1 100644 --- a/ovos_stt_plugin_vosk/__init__.py +++ b/ovos_stt_plugin_vosk/__init__.py @@ -1,8 +1,10 @@ import json +from time import sleep from os.path import join, exists from ovos_plugin_manager.templates.stt import STT, StreamThread, StreamingSTT from ovos_skill_installer import download_extract_zip, download_extract_tar from ovos_utils.log import LOG +from ovos_utils.network_utils import is_connected from ovos_utils.xdg_utils import xdg_data_home from queue import Queue from speech_recognition import AudioData @@ -134,6 +136,10 @@ def download_model(url): name = url.split("/")[-1].split(".")[0] model_path = join(folder, name) if not exists(model_path): + while not is_connected(): + LOG.info("Waiting for internet in order to download vosk language model") + # waiting for wifi setup most likely + sleep(10) LOG.info(f"Downloading model for vosk {url}") LOG.info("this might take a while") if url.endswith(".zip"):