From 3866a756db6c85e36d1896af8461682c8c19a2ec Mon Sep 17 00:00:00 2001 From: ulrich Date: Wed, 11 May 2022 08:40:14 +0000 Subject: [PATCH] Rueckmeldung fuer Lautstaerkeregelung unterbunden --- src/de/uhilger/tango/api/MediaSteuerung.java | 30 +++++++++++++++++++++++++----- 1 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/de/uhilger/tango/api/MediaSteuerung.java b/src/de/uhilger/tango/api/MediaSteuerung.java index 7cb8672..7d3fda7 100644 --- a/src/de/uhilger/tango/api/MediaSteuerung.java +++ b/src/de/uhilger/tango/api/MediaSteuerung.java @@ -71,21 +71,34 @@ public static final String PL_API_STRG = "api/strg/"; public static final String PL_CMD_ENDE = "ende"; public static final String PL_CMD_STOP = "stop"; + public static final String PL_CMD_VOLDN = "voldn"; + public static final String PL_CMD_VOLUP = "volup"; public static final String PL_CMD_PAUSE = "pause"; public static final String PL_CMD_PLAYON = "weiter"; public static final String PL_CMD_CALYPSO_STOP = "stop"; + public static final String PL_CMD_CALYPSO_VOL_INC = "vol-inc"; + public static final String PL_CMD_CALYPSO_VOL_DEC = "vol-dec"; public static final String PL_CMD_CALYPSO_PAUSE = "pause"; public static final String PL_CMD_CALYPSO_PLAYON = "playon"; public static final String DEFAULT_HOST = "http://localhost:9090"; + public static final String RB_HOST = "host"; + public static final String RB_PLAYERPARAMS = "playerparams"; + private final Map spielt = new HashMap(); + + private String conf; + + public MediaSteuerung(String conf) { + this.conf = conf; + } @Override protected String get(HttpExchange e) { String response; String path = e.getRequestURI().toString(); String[] elems = path.split(Server.SLASH); - FileStorage fs = new FileStorage(App.getInitParameter(App.getRs(App.RB_AP_CONF))); + FileStorage fs = new FileStorage(conf); logger.fine(path); // Faustregel: Anzahl Elemente eines URL plus 1 ist die Anzahl der Elemente des @@ -97,6 +110,10 @@ } else if(elems[5].equalsIgnoreCase(PL_CMD_STOP)) { spielt.remove(elems[4]); response = kommandoSenden(fs, elems[4], PL_CMD_CALYPSO_STOP); + } else if(elems[5].equalsIgnoreCase(PL_CMD_VOLDN)) { + response = kommandoSenden(fs, elems[4], PL_CMD_CALYPSO_VOL_DEC); + } else if(elems[5].equalsIgnoreCase(PL_CMD_VOLUP)) { + response = kommandoSenden(fs, elems[4], PL_CMD_CALYPSO_VOL_INC); } else if(elems[5].equalsIgnoreCase(PL_CMD_PAUSE)) { response = kommandoSenden(fs, elems[4], PL_CMD_CALYPSO_PAUSE); //} else if(elems[5].equalsIgnoreCase(PL_CMD_PLAYON)) { @@ -139,7 +156,7 @@ private String urlAbspielen(HttpExchange e, String abspielerKmd) throws IOException { String path = e.getRequestURI().toString(); String[] elems = path.split(Server.SLASH); - FileStorage fs = new FileStorage(App.getInitParameter(App.getRs(App.RB_AP_CONF))); + FileStorage fs = new FileStorage(conf); if(elems[6].equalsIgnoreCase("titel")) { String titelJson = bodyLesen(e); Gson gson = new Gson(); @@ -150,7 +167,7 @@ Entity entity = fs.read(FileStorage.ST_ABSPIELER, elems[4]); if (entity instanceof Abspieler) { Abspieler abspieler = (Abspieler) entity; - String server = getEinstellung(fs, App.getRs(App.RB_HOST), DEFAULT_HOST); + String server = getEinstellung(fs, getResString(RB_HOST), DEFAULT_HOST); String signal = abspielKommando(fs, abspieler, server, titelUrl, abspielerKmd).toString(); abspielerKommandoSenden(signal); return signal + "gesendet."; @@ -286,7 +303,7 @@ vorgang.setTitelNr(titelNr); spielt.put(abspieler.getName(), vorgang); - String server = getEinstellung(s, App.getRs(App.RB_HOST), DEFAULT_HOST); + String server = getEinstellung(s, getResString(RB_HOST), DEFAULT_HOST); /* @@ -302,6 +319,9 @@ StringBuilder kmd = abspielKommando(s, abspieler, server, titelUrl, PL_CMD_PLAY); kmd.append(PL_PARAM_RUECK); kmd.append(server); + if(!server.endsWith(Server.SLASH)) { + kmd.append(Server.SLASH); + } kmd.append(PL_API_STRG); kmd.append(abspieler.getName()); kmd.append("/ende"); @@ -317,7 +337,7 @@ //kmd.append(PL_CMD_PLAY); kmd.append(abspielKmd); // Parameter fuer den Abspieler holen - kmd.append(getEinstellung(s, App.getRs(App.RB_PLAYERPARAMS), PL_DEFAULT_PARAMS)); + kmd.append(getEinstellung(s, getResString(RB_PLAYERPARAMS), PL_DEFAULT_PARAMS)); kmd.append(server); kmd.append(titelUrl); -- Gitblit v1.9.3