commit | author | age
|
8e2038
|
1 |
package de.uhilger.avdirektor; |
U |
2 |
|
|
3 |
import java.io.IOException; |
|
4 |
import java.util.HashMap; |
|
5 |
import java.util.logging.Level; |
|
6 |
import java.util.logging.Logger; |
|
7 |
|
|
8 |
/** |
cc2a32
|
9 |
* Hauptklasse des av-director |
U |
10 |
* |
|
11 |
* Aufruf mit |
|
12 |
* java -jar av-director.jar port=9000 |
|
13 |
* java -jar av-director.jar nfs-prefix="/media/mc" port=9000 |
|
14 |
* java -Djava.util.logging.config.file=logging.properties -jar .. |
|
15 |
* |
|
16 |
* Der Parameter nfs-prefix bewirkt, dass beim Abspielen relative Pfade |
|
17 |
* mit diesem Praefix verbunden werden und setzt voraus, dass auf der |
|
18 |
* Maschine ein NFS-Mount ueber /etc/fstab eingerichtet ist. |
|
19 |
* |
8e2038
|
20 |
* @author ulrich |
U |
21 |
*/ |
|
22 |
public class App { |
|
23 |
|
|
24 |
private static final Logger logger = Logger.getLogger(App.class.getName()); |
|
25 |
|
|
26 |
public static final String PI_PLAYER = "pi_player"; |
|
27 |
//public static final String FBI_PROC = "fbi_proc"; |
|
28 |
|
|
29 |
public static final String CMD_STOP = "q"; |
|
30 |
public static final String CMD_DEC_SPEED = "1"; |
|
31 |
public static final String CMD_INC_SPEED = "2"; |
|
32 |
public static final String CMD_PREV_AUDIO = "j"; |
|
33 |
public static final String CMD_NEXT_AUDIO = "k"; |
|
34 |
public static final String CMD_PREV_CHAPTER = "i"; |
|
35 |
public static final String CMD_NEXT_CHAPTER = "o"; |
|
36 |
public static final String CMD_PREV_SUB = "n"; |
|
37 |
public static final String CMD_NEXT_SUB = "m"; |
|
38 |
public static final String CMD_TOGGLE_SUB = "s"; |
|
39 |
public static final String CMD_PAUSE_RESUME = "p"; |
|
40 |
public static final String CMD_DEC_VOL = "-"; |
|
41 |
public static final String CMD_INC_VOL = "+"; |
|
42 |
|
|
43 |
public static final String PFEIL_LINKS = "5b44"; |
|
44 |
public static final String PFEIL_RECHTS = "5b43"; |
|
45 |
public static final String PFEIL_HERAUF = "5b41"; |
|
46 |
public static final String PFEIL_HERUNTER = "5b42"; |
|
47 |
|
|
48 |
public static final String SP_RUECK_30 = "rueck30"; |
|
49 |
public static final String SP_VOR_30 = "rueck30"; |
|
50 |
public static final String SP_VOR_600 = "vor600"; |
|
51 |
public static final String SP_RUECK_600 = "rueck600"; |
|
52 |
|
|
53 |
public static final String OPT_LOCAL_AUDIO = "-o%20local"; |
|
54 |
public static final String OPT_HDMI_AUDIO = "-o hdmi"; |
|
55 |
|
|
56 |
public static final String BLANK = " "; |
|
57 |
|
|
58 |
private static HashMap initParams; |
|
59 |
|
a7f0a1
|
60 |
private static Process playerproc; |
U |
61 |
|
8e2038
|
62 |
/** |
U |
63 |
* @param args the command line arguments |
|
64 |
*/ |
|
65 |
public static void main(String[] args) { |
|
66 |
initParams = new HashMap(); |
|
67 |
for(String arg: args) { |
|
68 |
//logger.info("arg: " + arg); |
|
69 |
String[] argParts = arg.split("="); |
|
70 |
//logger.info(argParts[0]); |
|
71 |
//logger.info(argParts[1]); |
|
72 |
initParams.put(argParts[0], argParts[1]); |
|
73 |
} |
|
74 |
|
|
75 |
|
|
76 |
Server server = new Server(Integer.parseInt(getInitParameter("port"))); |
|
77 |
try { |
|
78 |
server.start(); |
|
79 |
} catch (IOException ex) { |
|
80 |
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex); |
|
81 |
} |
|
82 |
} |
|
83 |
|
|
84 |
public static void stop() { |
|
85 |
System.exit(0); |
|
86 |
} |
|
87 |
|
|
88 |
public static String getInitParameter(String pname) { |
|
89 |
String param = null; |
|
90 |
Object o = initParams.get(pname); |
|
91 |
if(o != null) { |
|
92 |
param = o.toString(); |
|
93 |
} |
|
94 |
return param; |
|
95 |
} |
|
96 |
|
a7f0a1
|
97 |
public static Process getPlayerProcess() { |
U |
98 |
return playerproc; |
|
99 |
} |
8e2038
|
100 |
|
a7f0a1
|
101 |
public static void setPlayerProcess(Process p) { |
U |
102 |
playerproc = p; |
|
103 |
} |
8e2038
|
104 |
} |