From 0c8d27c8a1708d1c315aca89db47d48488fd44ca Mon Sep 17 00:00:00 2001
From: ulrich
Date: Mon, 22 Mar 2021 07:53:34 +0000
Subject: [PATCH] Play/Stop in Arbeit

---
 src/de/uhilger/avdirektor/handler/OMXPlayer.java |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/de/uhilger/avdirektor/handler/OMXPlayer.java b/src/de/uhilger/avdirektor/handler/OMXPlayer.java
index 82acdde..dc0a797 100644
--- a/src/de/uhilger/avdirektor/handler/OMXPlayer.java
+++ b/src/de/uhilger/avdirektor/handler/OMXPlayer.java
@@ -18,6 +18,7 @@
 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;
 
@@ -28,6 +29,15 @@
 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();
@@ -41,6 +51,24 @@
       }
     }
     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();
   }
   
   /**
@@ -119,6 +147,7 @@
         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;
     }

--
Gitblit v1.9.3