client/enclosure/__main__.py
Go to the documentation of this file.
1 # Copyright 2017 Mycroft AI Inc.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 #
15 import sys
16 
17 from mycroft.util.log import LOG
18 from mycroft.messagebus.client.ws import WebsocketClient
19 from mycroft.configuration import Configuration, LocalConf, SYSTEM_CONFIG
20 
21 
22 def main():
23  # Read the system configuration
24  system_config = LocalConf(SYSTEM_CONFIG)
25  platform = system_config.get("enclosure", {}).get("platform")
26 
27  if platform == "mycroft_mark_1":
28  LOG.debug("Creating Mark I Enclosure")
29  from mycroft.client.enclosure.mark1 import EnclosureMark1
30  enclosure = EnclosureMark1()
31  elif platform == "mycroft_mark_2":
32  LOG.debug("Creating Mark II Enclosure")
33  from mycroft.client.enclosure.mark2 import EnclosureMark2
34  enclosure = EnclosureMark2()
35  else:
36  LOG.debug("Creating generic enclosure, platform='{}'".format(platform))
37 
38  # TODO: Mechanism to load from elsewhere. E.g. read a script path from
39  # the mycroft.conf, then load/launch that script.
40  from mycroft.client.enclosure.generic import EnclosureGeneric
41  enclosure = EnclosureGeneric()
42 
43  if enclosure:
44  try:
45  LOG.debug("Enclosure started!")
46  enclosure.run()
47  except Exception as e:
48  print(e)
49  finally:
50  sys.exit()
51  else:
52  LOG.debug("No enclosure available for this hardware, running headless")
53 
54 
55 if __name__ == "__main__":
56  main()
def get(phrase, lang=None, context=None)


mycroft_ros
Author(s):
autogenerated on Mon Apr 26 2021 02:35:40