|
- # -*- coding: utf-8 -*-
- from multiprocessing import freeze_support
- from os.path import dirname, realpath, join
- from loguru import logger
-
- from service.MqttDisService import MqttDispatcherService
- from service.HttpDisService import HttpDispatcherService
- from util.LogUtils import init_log
- from util.RWUtils import getConfigs
-
- '''
- 主程序入口
- '''
-
- if __name__ == '__main__':
- freeze_support()
- base_dir = dirname(realpath(__file__))
- init_log(base_dir)
- logger.info("(♥◠‿◠)ノ゙ 【机场媒体服务】开始启动 ლ(´ڡ`ლ)゙")
- print("(♥◠‿◠)ノ゙ 【机场媒体服务】开始启动 ლ(´ڡ`ლ)゙")
- print("############################################################")
- print("配置文件路径: ", join(base_dir, "config"))
- print("服务配置文件: service.yml")
- print("mqtt配置文件: mqtt.yml")
- print("日志配置文件: logger.yml")
- print("阿里云配置文件: aliyun.yml")
- print("日志文件路径: ", join(base_dir, "logs"))
- print("############################################################")
- # mqtt交互
- service_config = getConfigs(base_dir, "config/service.yml")
- service_config['base_dir'] = base_dir
- if 1 == service_config['docking_method']:
- print("当前使用的交互模式是mqtt交互!!")
- print("############################################################")
- MqttDispatcherService(service_config)
- elif 2 == service_config['docking_method']:
- print("当前使用的交互模式是接口交互!!")
- print("############################################################")
- HttpDispatcherService(service_config)
|