Remove all references to /opt/mycroft
parent
14ceb1f1dd
commit
b0b88bbd62
|
@ -149,7 +149,7 @@ class RemoteConf(LocalConf):
|
|||
def __init__(self, cache=None):
|
||||
super(RemoteConf, self).__init__(None)
|
||||
|
||||
cache = cache or '/opt/mycroft/web_config_cache.json'
|
||||
cache = cache or '/var/tmp/mycroft_web_cache.json'
|
||||
from mycroft.api import is_paired
|
||||
if not is_paired():
|
||||
self.load_local(cache)
|
||||
|
|
|
@ -83,14 +83,17 @@
|
|||
"offset": -21600000
|
||||
}
|
||||
},
|
||||
"data_dir": "/opt/mycroft",
|
||||
|
||||
// General skill values
|
||||
"skills": {
|
||||
"msm": {
|
||||
"directory": "/opt/mycroft/skills",
|
||||
// Relative to "data_dir"
|
||||
"directory": "skills",
|
||||
"versioned": true,
|
||||
"repo": {
|
||||
"cache": "/opt/mycroft/.skills-repo",
|
||||
// Relative to "data_dir"
|
||||
"cache": ".skills-repo",
|
||||
"url": "https://github.com/MycroftAI/mycroft-skills",
|
||||
"branch": "18.02"
|
||||
}
|
||||
|
|
|
@ -16,8 +16,9 @@ import json
|
|||
import time
|
||||
from threading import Thread
|
||||
|
||||
from os.path import isfile
|
||||
from os.path import isfile, join
|
||||
|
||||
from mycroft.configuration import Configuration
|
||||
from mycroft.messagebus.message import Message
|
||||
from mycroft.util.log import LOG
|
||||
from queue import Queue
|
||||
|
@ -41,7 +42,7 @@ def repeat_time(sched_time, repeat):
|
|||
|
||||
|
||||
class EventScheduler(Thread):
|
||||
def __init__(self, emitter, schedule_file='/opt/mycroft/schedule.json'):
|
||||
def __init__(self, emitter, schedule_file='schedule.json'):
|
||||
"""
|
||||
Create an event scheduler thread. Will send messages at a
|
||||
predetermined time to the registered targets.
|
||||
|
@ -51,10 +52,12 @@ class EventScheduler(Thread):
|
|||
schedule_file: File to store pending events to on shutdown
|
||||
"""
|
||||
super(EventScheduler, self).__init__()
|
||||
data_dir = Configuration.get()['data_dir']
|
||||
|
||||
self.events = {}
|
||||
self.emitter = emitter
|
||||
self.isRunning = True
|
||||
self.schedule_file = schedule_file
|
||||
self.schedule_file = join(data_dir, schedule_file)
|
||||
if self.schedule_file:
|
||||
self.load()
|
||||
|
||||
|
@ -81,7 +84,7 @@ class EventScheduler(Thread):
|
|||
try:
|
||||
json_data = json.load(f)
|
||||
except Exception as e:
|
||||
LOG.error(e.message)
|
||||
LOG.error(e)
|
||||
current_time = time.time()
|
||||
for key in json_data:
|
||||
event_list = json_data[key]
|
||||
|
|
|
@ -229,11 +229,13 @@ class SkillManager(Thread):
|
|||
config = Configuration.get()
|
||||
msm_config = config['skills']['msm']
|
||||
repo_config = msm_config['repo']
|
||||
skills_dir = join(config['data_dir'], msm_config['directory'])
|
||||
repo_cache = join(config['data_dir'], repo_config['cache'])
|
||||
platform = config['enclosure'].get('platform', 'default')
|
||||
return MycroftSkillsManager(
|
||||
platform=platform, skills_dir=msm_config['directory'],
|
||||
platform=platform, skills_dir=skills_dir,
|
||||
repo=SkillRepo(
|
||||
repo_config['cache'], repo_config['url'], repo_config['branch']
|
||||
repo_cache, repo_config['url'], repo_config['branch']
|
||||
), versioned=msm_config['versioned']
|
||||
)
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ from threading import Thread
|
|||
from time import time, sleep
|
||||
|
||||
import os.path
|
||||
from os.path import exists
|
||||
from os.path import exists, join
|
||||
|
||||
from mycroft import MYCROFT_ROOT_PATH
|
||||
from mycroft.api import DeviceApi
|
||||
|
@ -29,6 +29,7 @@ from mycroft.util.download import download
|
|||
from mycroft.util.log import LOG
|
||||
|
||||
config = Configuration.get().get("tts").get("mimic")
|
||||
data_dir = Configuration.get()['data_dir']
|
||||
|
||||
BIN = config.get("path",
|
||||
os.path.join(MYCROFT_ROOT_PATH, 'mimic', 'bin', 'mimic'))
|
||||
|
@ -39,7 +40,7 @@ if not os.path.isfile(BIN):
|
|||
|
||||
BIN = distutils.spawn.find_executable("mimic")
|
||||
|
||||
SUBSCRIBER_VOICES = {'trinity': '/opt/mycroft/voices/mimic_tn'}
|
||||
SUBSCRIBER_VOICES = {'trinity': join(data_dir, 'voices/mimic_tn')}
|
||||
|
||||
|
||||
def download_subscriber_voices(selected_voice):
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
from __future__ import absolute_import
|
||||
import socket
|
||||
import subprocess
|
||||
from os.path import join
|
||||
|
||||
from threading import Thread
|
||||
from time import sleep
|
||||
|
||||
|
@ -59,6 +61,7 @@ def resolve_resource_file(res_name):
|
|||
Args:
|
||||
res_name (str): a resource path/name
|
||||
"""
|
||||
config = mycroft.configuration.Configuration.get()
|
||||
|
||||
# First look for fully qualified file (e.g. a user setting)
|
||||
if os.path.isfile(res_name):
|
||||
|
@ -70,7 +73,7 @@ def resolve_resource_file(res_name):
|
|||
return filename
|
||||
|
||||
# Next look for /opt/mycroft/res/res_name
|
||||
filename = os.path.expanduser("/opt/mycroft/" + res_name)
|
||||
filename = os.path.expanduser(join(config['data_dir'], res_name))
|
||||
if os.path.isfile(filename):
|
||||
return filename
|
||||
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
import json
|
||||
|
||||
from genericpath import exists, isfile
|
||||
from os.path import join
|
||||
|
||||
from mycroft.configuration import Configuration
|
||||
from mycroft.util.log import LOG
|
||||
|
||||
|
||||
|
@ -33,18 +35,15 @@ CORE_VERSION_STR = '.'.join(map(str, CORE_VERSION_TUPLE))
|
|||
|
||||
|
||||
class VersionManager(object):
|
||||
__location = "/opt/mycroft/version.json"
|
||||
|
||||
@staticmethod
|
||||
def get():
|
||||
if (exists(VersionManager.__location) and
|
||||
isfile(VersionManager.__location)):
|
||||
version_file = join(Configuration.get()['data_dir'], 'version.json')
|
||||
if exists(version_file) and isfile(version_file):
|
||||
try:
|
||||
with open(VersionManager.__location) as f:
|
||||
with open(version_file) as f:
|
||||
return json.load(f)
|
||||
except:
|
||||
LOG.error("Failed to load version from '%s'"
|
||||
% VersionManager.__location)
|
||||
except Exception:
|
||||
LOG.error("Failed to load version from '%s'" % version_file)
|
||||
return {"coreVersion": None, "enclosureVersion": None}
|
||||
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import mycroft.configuration
|
|||
from mycroft.util.log import LOG
|
||||
|
||||
CONFIG = {
|
||||
'data_dir': '/opt/mycroft',
|
||||
'server': {
|
||||
'url': 'https://api-test.mycroft.ai',
|
||||
'version': 'v1',
|
||||
|
|
Loading…
Reference in New Issue