From 407ead296aaff1e1388b37baf4a8de181b4e316b Mon Sep 17 00:00:00 2001
From: zhangnaisong <2434969829@qq.com>
Date: 星期日, 28 四月 2024 17:24:50 +0800
Subject: [PATCH] 视频标签bug修改提交
---
ard-work/src/main/java/com/ruoyi/cmd/startup.java | 61 ++++++++----------------------
1 files changed, 17 insertions(+), 44 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/cmd/startup.java b/ard-work/src/main/java/com/ruoyi/cmd/startup.java
index 64b60f3..9505455 100644
--- a/ard-work/src/main/java/com/ruoyi/cmd/startup.java
+++ b/ard-work/src/main/java/com/ruoyi/cmd/startup.java
@@ -6,6 +6,7 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.core.annotation.Order;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
@@ -40,16 +41,11 @@
String path;
@Value("${minio.enabled}")
Boolean minioEnabled;
+
//mediamtx
String mediamtxName = "mediamtx.exe";
@Value("${mediamtx.enabled}")
Boolean mediamtxEnabled;
- //webrtc-streamer
- String webrtcName = "webrtc-streamer.exe";
- @Value("${webrtc.host}")
- String webrtcHost;
- @Value("${webrtc.enabled}")
- Boolean webrtcEnabled;
//redis
String redisName = "redis-server.exe";
@@ -61,7 +57,8 @@
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
if (Platform.isWindows()) {
- String exePath = System.getProperty("user.dir") + File.separator + "server" + File.separator + "redis" + File.separator + redisName;
+ String workingDir = System.getProperty("user.dir") + File.separator + "server" + File.separator + "redis";
+ String exePath = workingDir +File.separator+ redisName;
List<String> cmd = new ArrayList<>();
cmd.add(exePath);
if (CmdUtils.isProcessRunning(redisName)) {
@@ -69,7 +66,7 @@
CmdUtils.stopProcess(redisName);
}
// 鍚姩鍚庡彴杩涚▼
- CmdUtils.commandStart(redisName, cmd, null);
+ CmdUtils.commandStart(workingDir, redisName, cmd, null);
// 鍚姩cmd绐楀彛
//String[] command = {"cmd", "/c", "start", exePath, "-H127.0.0.1:8000", "-o"};
//CmdUtils.commandStart(command);
@@ -77,11 +74,13 @@
}
@PostConstruct
+ @Order(1)
public void init() {
if (minioEnabled) {
log.info("鍒濆鍖栧惎鍔╩inio");
if (Platform.isWindows()) {
- String exePath = System.getProperty("user.dir") + File.separator + "server" + File.separator + "minio" + File.separator + minioName;
+ String workingDir = System.getProperty("user.dir") + File.separator + "server" + File.separator + "minio";
+ String exePath = workingDir + File.separator + minioName;
Map<String, String> env = new HashMap<>();
env.put("MINIO_ROOT_USER", accessKey);
env.put("MINIO_ROOT_PASSWORD", secretKey);
@@ -96,7 +95,7 @@
CmdUtils.stopProcess(minioName);
}
// 鍚姩鍚庡彴杩涚▼
- CmdUtils.commandStart(minioName, cmd, env);
+ CmdUtils.commandStart(workingDir, minioName, cmd, env);
// 鍚姩cmd绐楀彛
//String[] command = {"cmd", "/c", "start", exePath};
//CmdUtils.commandStart(command);
@@ -105,40 +104,21 @@
if (mediamtxEnabled) {
log.info("鍒濆鍖栧惎鍔╩ediaMTX");
if (Platform.isWindows()) {
- String exePath = System.getProperty("user.dir") + File.separator + "server" + File.separator + "mediamtx" + File.separator + mediamtxName;
- String ymlPath = System.getProperty("user.dir") + File.separator + "server" + File.separator + "mediamtx" + File.separator + "mediamtx.yml";
-
+ String workingDir = System.getProperty("user.dir") + File.separator + "server" + File.separator + "mediamtx";
+ String exePath = workingDir + File.separator + mediamtxName;
+ String ymlPath = workingDir + File.separator + "mediamtx.yml";
List<String> cmd = new ArrayList<>();
cmd.add(exePath);
- cmd.add(ymlPath);
+ // cmd.add(ymlPath);
if (CmdUtils.isProcessRunning(mediamtxName)) {
// 杩涚▼宸茬粡鍦ㄨ繍琛岋紝缁撴潫璇ヨ繘绋�
CmdUtils.stopProcess(mediamtxName);
}
// 鍚姩鍚庡彴杩涚▼
- CmdUtils.commandStart(mediamtxName, cmd, null);
+ CmdUtils.commandStart(workingDir, mediamtxName, cmd, null);
// 鍚姩cmd绐楀彛
-// String[] command = {"cmd","/c","start",exePath,ymlPath};
-// CmdUtils.commandStart(command);
- }
- }
- if (webrtcEnabled) {
- log.info("鍒濆鍖栧惎鍔╳ebrtc-streamer");
- if (Platform.isWindows()) {
- String exePath = System.getProperty("user.dir") + File.separator + "server" + File.separator + "webrtc" + File.separator + webrtcName;
- List<String> cmd = new ArrayList<>();
- cmd.add(exePath);
- cmd.add("-H" + webrtcHost);
- cmd.add("-o");
- if (CmdUtils.isProcessRunning(webrtcName)) {
- // 杩涚▼宸茬粡鍦ㄨ繍琛岋紝缁撴潫璇ヨ繘绋�
- CmdUtils.stopProcess(webrtcName);
- }
- // 鍚姩鍚庡彴杩涚▼
- CmdUtils.commandStart(webrtcName, cmd, null);
- // 鍚姩cmd绐楀彛
-// String[] command = {"cmd", "/c", "start", exePath, "-H127.0.0.1:8000", "-o"};
-// CmdUtils.commandStart(command);
+ //String[] command = {"cmd","/c","start",exePath,ymlPath};
+ //CmdUtils.commandStart(command);
}
}
}
@@ -159,13 +139,6 @@
CmdUtils.stopProcess(mediamtxName);
}
}
- if (webrtcEnabled) {
- log.info("閿�姣亀ebrtc-streamer");
- if (CmdUtils.isProcessRunning(webrtcName)) {
- // 杩涚▼宸茬粡鍦ㄨ繍琛岋紝缁撴潫璇ヨ繘绋�
- CmdUtils.stopProcess(webrtcName);
- }
- }
if (true) {
log.info("閿�姣乺edis");
if (CmdUtils.isProcessRunning(redisName)) {
@@ -174,4 +147,4 @@
}
}
}
-}
\ No newline at end of file
+}
--
Gitblit v1.9.3