commit | author | age
|
60719c
|
1 |
/* |
U |
2 |
AV-Direktor - Control OMXPlayer on Raspberry Pi via HTTP |
|
3 |
Copyright (C) 2021 Ulrich Hilger |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU Affero General Public License as |
|
7 |
published by the Free Software Foundation, either version 3 of the |
|
8 |
License, or (at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU Affero General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU Affero General Public License |
|
16 |
along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
|
8e2038
|
19 |
package de.uhilger.avdirektor.handler; |
U |
20 |
|
|
21 |
import com.sun.net.httpserver.HttpExchange; |
|
22 |
import java.util.logging.Level; |
|
23 |
import java.util.logging.Logger; |
|
24 |
|
|
25 |
/** |
e499f8
|
26 |
* Play |
U |
27 |
* |
|
28 |
* rpi4-az:9090/avd/play?titel=/Filme/S/sound_city.m4v&th=60&ti=60&o=local |
|
29 |
* |
|
30 |
* OMXPlayer.abspielenMitParameternUndRueckmeldung( |
|
31 |
* String urlStr, String parameter, String meldeUrlStr, String token) |
|
32 |
* |
|
33 |
* Parameter des Aufrufs play als query (th threshold, ti timeout) |
|
34 |
* |
|
35 |
* ?titel=/Filme/S/sound_city.m4v |
|
36 |
* &ti=60 |
|
37 |
* &th=60 |
|
38 |
* &o=local|hdmi|both |
|
39 |
* &r=http://uhilger.de/mc/api/usw |
|
40 |
* |
|
41 |
* r muss ganz wegbleiben, wenn keine Rueckmeldung gewuescht ist |
8e2038
|
42 |
* |
U |
43 |
* @author ulrich |
|
44 |
*/ |
63b711
|
45 |
public class PlayHandler extends CmdHandler { |
8e2038
|
46 |
|
U |
47 |
private static final Logger logger = Logger.getLogger(PlayHandler.class.getName()); |
63b711
|
48 |
|
U |
49 |
public PlayHandler(String cmd) { |
|
50 |
super(cmd); |
|
51 |
} |
|
52 |
|
|
53 |
@Override |
|
54 |
protected String process(HttpExchange t, String params) { |
b6a8f0
|
55 |
String antwort = abspielen( |
63b711
|
56 |
getParam(map, "titel"), params, getParam(map, "r"), "1"); |
U |
57 |
logger.log(Level.FINE, antwort); |
|
58 |
return antwort; |
|
59 |
} |
|
60 |
|
|
61 |
protected StringBuilder buildParams(HttpExchange t) { |
|
62 |
StringBuilder params = super.buildParams(t); |
b6a8f0
|
63 |
params.append("-b -o "); |
a7f0a1
|
64 |
params.append(getParam(map, "o")); |
U |
65 |
params.append(" --threshold "); |
|
66 |
params.append(getParam(map, "th")); |
|
67 |
params.append(" --timeout "); |
|
68 |
params.append(getParam(map, "ti")); |
63b711
|
69 |
return params; |
8e2038
|
70 |
} |
cc2a32
|
71 |
|
8e2038
|
72 |
} |