commit | author | age
|
8e2038
|
1 |
package de.uhilger.avdirektor.handler; |
U |
2 |
|
|
3 |
import com.sun.net.httpserver.HttpExchange; |
|
4 |
import com.sun.net.httpserver.HttpHandler; |
|
5 |
import java.io.IOException; |
|
6 |
import java.io.OutputStream; |
e448af
|
7 |
import java.util.Map; |
8e2038
|
8 |
import java.util.logging.Level; |
U |
9 |
import java.util.logging.Logger; |
|
10 |
|
|
11 |
/** |
e499f8
|
12 |
* Play |
U |
13 |
* |
|
14 |
* rpi4-az:9090/avd/play?titel=/Filme/S/sound_city.m4v&th=60&ti=60&o=local |
|
15 |
* |
|
16 |
* OMXPlayer.abspielenMitParameternUndRueckmeldung( |
|
17 |
* String urlStr, String parameter, String meldeUrlStr, String token) |
|
18 |
* |
|
19 |
* Parameter des Aufrufs play als query (th threshold, ti timeout) |
|
20 |
* |
|
21 |
* ?titel=/Filme/S/sound_city.m4v |
|
22 |
* &ti=60 |
|
23 |
* &th=60 |
|
24 |
* &o=local|hdmi|both |
|
25 |
* &r=http://uhilger.de/mc/api/usw |
|
26 |
* |
|
27 |
* r muss ganz wegbleiben, wenn keine Rueckmeldung gewuescht ist |
8e2038
|
28 |
* |
U |
29 |
* @author ulrich |
|
30 |
*/ |
63b711
|
31 |
public class PlayHandler extends CmdHandler { |
8e2038
|
32 |
|
U |
33 |
private static final Logger logger = Logger.getLogger(PlayHandler.class.getName()); |
63b711
|
34 |
|
U |
35 |
public PlayHandler(String cmd) { |
|
36 |
super(cmd); |
|
37 |
} |
|
38 |
|
|
39 |
@Override |
|
40 |
protected String process(HttpExchange t, String params) { |
|
41 |
String antwort = abspielenMitParameternUndRueckmeldung( |
|
42 |
getParam(map, "titel"), params, getParam(map, "r"), "1"); |
|
43 |
logger.log(Level.FINE, antwort); |
|
44 |
return antwort; |
|
45 |
} |
|
46 |
|
|
47 |
protected StringBuilder buildParams(HttpExchange t) { |
|
48 |
StringBuilder params = super.buildParams(t); |
a7f0a1
|
49 |
params.append("-o "); |
U |
50 |
params.append(getParam(map, "o")); |
|
51 |
params.append(" --threshold "); |
|
52 |
params.append(getParam(map, "th")); |
|
53 |
params.append(" --timeout "); |
|
54 |
params.append(getParam(map, "ti")); |
63b711
|
55 |
return params; |
8e2038
|
56 |
} |
cc2a32
|
57 |
|
8e2038
|
58 |
} |