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