| | |
| | | import java.net.URL; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.logging.Level; |
| | | import java.util.logging.Logger; |
| | | |
| | |
| | | public abstract class OMXPlayer implements ProzessLauscher { |
| | | |
| | | private static final Logger logger = Logger.getLogger(OMXPlayer.class.getName()); |
| | | |
| | | protected String getParam(Map map, String key) { |
| | | Object o = map.get(key); |
| | | if(o != null) { |
| | | return o.toString(); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | protected Map getQueryMap(HttpExchange t) { |
| | | HashMap map = new HashMap(); |
| | |
| | | } |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | protected String getResponseString(Map map, String cmd, String antwort) { |
| | | Set keys = map.keySet(); |
| | | StringBuilder buf = new StringBuilder(); |
| | | buf.append("play"); |
| | | buf.append(System.lineSeparator()); |
| | | keys.forEach((Object key) -> { |
| | | buf.append("key: "); |
| | | buf.append(key); |
| | | buf.append(System.lineSeparator()); |
| | | buf.append("value: "); |
| | | buf.append(map.get(key)); |
| | | buf.append(System.lineSeparator()); |
| | | //logger.log(Level.FINE, "key {0} value {1}", new Object[]{key, map.get(key)}); |
| | | }); |
| | | buf.append(antwort); |
| | | return buf.toString(); |
| | | } |
| | | |
| | | /** |
| | |
| | | mt.start(); |
| | | } |
| | | //servletContext.setAttribute(App.PI_PLAYER, player_process); |
| | | t.setAttribute(App.PI_PLAYER, player_process); |
| | | //Runtime.getRuntime().exec("killall dbus-daemon"); |
| | | antwort = "Abspielen gestartet, url: " + urlStr; |
| | | } |