|
@@ -34,6 +34,7 @@ public class MusicServiceImpl implements MusicService {
|
|
|
@Override
|
|
|
public Integer start(String path, Integer vol) {
|
|
|
synchronized (this) {
|
|
|
+ log.info("start music cmd:{}",cmd);
|
|
|
cmd = "play -v " + Float.valueOf(new Integer(vol).toString()) / 100 + " " + path;
|
|
|
startCmd = true;
|
|
|
repeat = true;
|
|
@@ -43,7 +44,9 @@ public class MusicServiceImpl implements MusicService {
|
|
|
|
|
|
@Override
|
|
|
public void stop() {
|
|
|
+
|
|
|
synchronized (this) {
|
|
|
+ log.info("stop music");
|
|
|
endCmd = true;
|
|
|
repeat = false;
|
|
|
}
|
|
@@ -77,7 +80,7 @@ public class MusicServiceImpl implements MusicService {
|
|
|
@Scheduled(fixedRate = 500)
|
|
|
public void repeat() {
|
|
|
synchronized (this) {
|
|
|
- if (p == null) {
|
|
|
+ if (p == null && cmd != null) {
|
|
|
try {
|
|
|
p = Runtime.getRuntime().exec(cmd);
|
|
|
} catch (IOException e) {
|