Fix variable expansion in player params in standalone mode

This commit is contained in:
0xb00bface 2021-12-21 14:31:42 +01:00
parent 04d8507baa
commit e5689d9af5
1 changed files with 7 additions and 6 deletions

View File

@ -111,6 +111,7 @@ public class Player {
PlayerThread(Recording rec) {
this.rec = rec;
this.model = rec.getModel();
setName(getClass().getName());
start();
}
@ -123,7 +124,7 @@ public class Player {
try {
if (cfg.getSettings().localRecording && rec != null) {
File file = rec.getAbsoluteFile();
String[] cmdline = createCmdline(file.getAbsolutePath());
String[] cmdline = createCmdline(file.getAbsolutePath(), model);
playerProcess = rt.exec(cmdline, OS.getEnvironment(), file.getParentFile());
} else {
String url = null;
@ -134,10 +135,7 @@ public class Player {
url = getPlaylistUrl(model);
}
LOG.debug("Playing {}", url);
String[] cmdline = createCmdline(url);
if (model != null) {
expandPlaceHolders(cmdline);
}
String[] cmdline = createCmdline(url, model);
LOG.debug("Player command line: {}", Arrays.toString(cmdline));
playerProcess = rt.exec(cmdline);
}
@ -198,7 +196,7 @@ public class Player {
}
}
private String[] createCmdline(String mediaSource) {
private String[] createCmdline(String mediaSource, Model model) {
Config cfg = Config.getInstance();
String params = cfg.getSettings().mediaPlayerParams.trim();
@ -212,6 +210,9 @@ public class Player {
}
cmdline[0] = cfg.getSettings().mediaPlayer;
cmdline[cmdline.length - 1] = mediaSource;
if (model != null) {
expandPlaceHolders(cmdline);
}
return cmdline;
}