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