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; |
cfe367
|
22 |
import de.uhilger.avdirektor.App; |
8e2038
|
23 |
import java.util.logging.Level; |
U |
24 |
import java.util.logging.Logger; |
|
25 |
|
|
26 |
/** |
e499f8
|
27 |
* Play |
U |
28 |
* |
|
29 |
* rpi4-az:9090/avd/play?titel=/Filme/S/sound_city.m4v&th=60&ti=60&o=local |
|
30 |
* |
|
31 |
* OMXPlayer.abspielenMitParameternUndRueckmeldung( |
|
32 |
* String urlStr, String parameter, String meldeUrlStr, String token) |
|
33 |
* |
|
34 |
* Parameter des Aufrufs play als query (th threshold, ti timeout) |
|
35 |
* |
|
36 |
* ?titel=/Filme/S/sound_city.m4v |
|
37 |
* &ti=60 |
|
38 |
* &th=60 |
|
39 |
* &o=local|hdmi|both |
|
40 |
* &r=http://uhilger.de/mc/api/usw |
|
41 |
* |
|
42 |
* r muss ganz wegbleiben, wenn keine Rueckmeldung gewuescht ist |
8e2038
|
43 |
* |
U |
44 |
* @author ulrich |
|
45 |
*/ |
63b711
|
46 |
public class PlayHandler extends CmdHandler { |
8e2038
|
47 |
|
U |
48 |
private static final Logger logger = Logger.getLogger(PlayHandler.class.getName()); |
63b711
|
49 |
|
U |
50 |
public PlayHandler(String cmd) { |
|
51 |
super(cmd); |
|
52 |
} |
|
53 |
|
|
54 |
@Override |
|
55 |
protected String process(HttpExchange t, String params) { |
cfe367
|
56 |
String antwort = App.getPlayer().abspielen( |
63b711
|
57 |
getParam(map, "titel"), params, getParam(map, "r"), "1"); |
U |
58 |
logger.log(Level.FINE, antwort); |
|
59 |
return antwort; |
|
60 |
} |
|
61 |
|
|
62 |
protected StringBuilder buildParams(HttpExchange t) { |
|
63 |
StringBuilder params = super.buildParams(t); |
b6a8f0
|
64 |
params.append("-b -o "); |
a7f0a1
|
65 |
params.append(getParam(map, "o")); |
U |
66 |
params.append(" --threshold "); |
|
67 |
params.append(getParam(map, "th")); |
|
68 |
params.append(" --timeout "); |
|
69 |
params.append(getParam(map, "ti")); |
63b711
|
70 |
return params; |
8e2038
|
71 |
} |
cc2a32
|
72 |
|
8e2038
|
73 |
} |