You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.6KB

  1. # -*- coding: utf-8 -*-
  2. from multiprocessing import freeze_support
  3. from os.path import dirname, realpath, join
  4. from loguru import logger
  5. from service.MqttDisService import MqttDispatcherService
  6. from service.HttpDisService import HttpDispatcherService
  7. from util.LogUtils import init_log
  8. from util.RWUtils import getConfigs
  9. '''
  10. 主程序入口
  11. '''
  12. if __name__ == '__main__':
  13. freeze_support()
  14. base_dir = dirname(realpath(__file__))
  15. init_log(base_dir)
  16. logger.info("(♥◠‿◠)ノ゙ 【机场媒体服务】开始启动 ლ(´ڡ`ლ)゙")
  17. print("(♥◠‿◠)ノ゙ 【机场媒体服务】开始启动 ლ(´ڡ`ლ)゙")
  18. print("############################################################")
  19. print("配置文件路径: ", join(base_dir, "config"))
  20. print("服务配置文件: service.yml")
  21. print("mqtt配置文件: mqtt.yml")
  22. print("日志配置文件: logger.yml")
  23. print("阿里云配置文件: aliyun.yml")
  24. print("日志文件路径: ", join(base_dir, "logs"))
  25. print("############################################################")
  26. # mqtt交互
  27. service_config = getConfigs(base_dir, "config/service.yml")
  28. service_config['base_dir'] = base_dir
  29. if 1 == service_config['docking_method']:
  30. print("当前使用的交互模式是mqtt交互!!")
  31. print("############################################################")
  32. MqttDispatcherService(service_config)
  33. elif 2 == service_config['docking_method']:
  34. print("当前使用的交互模式是接口交互!!")
  35. print("############################################################")
  36. HttpDispatcherService(service_config)