TitanWong 1 рік тому
батько
коміт
0ed8a888b0

+ 1 - 8
src/main/java/com/zhili/stationcontrol/tts/service/impl/MusicServiceImpl.java

@@ -44,7 +44,6 @@ public class MusicServiceImpl implements MusicService {
 
     @Override
     public void stop() {
-
         synchronized (this) {
             log.info("stop music");
             endCmd = true;
@@ -74,13 +73,7 @@ public class MusicServiceImpl implements MusicService {
                     p = null;
                 }
             }
-        }
-    }
-
-    @Scheduled(fixedRate = 500)
-    public void repeat() {
-        synchronized (this) {
-            if (repeat && p == null && cmd != null) {
+            if (!startCmd && !endCmd && repeat && p == null && cmd != null) {
                 log.info("repeat:{}", cmd);
                 try {
                     p = Runtime.getRuntime().exec(cmd);