| | |
| | | * |
| | | * HTTP GET /mz/api/strg/abspieler/play/[url] |
| | | * |
| | | * HTTP GET /mz/api/strg/abspieler/pause HTTP GET /mz/api/strg/abspieler/stop HTTP GET |
| | | * /mz/api/strg/abspieler/weiter |
| | | * HTTP GET /mz/api/strg/abspieler/pause |
| | | * HTTP GET /mz/api/strg/abspieler/stop |
| | | * HTTP GET /mz/api/strg/abspieler/weiter |
| | | * |
| | | * Faustregel: Anzahl Elemente eines URL plus 1 ist die Anzahl der Elemente des |
| | | * Ergebnisses von String.split. |
| | |
| | | public static final String PL_PARAM_RUECK = "&r="; |
| | | public static final String PL_API_STRG = "/api/strg/"; |
| | | public static final String PL_CMD_ENDE = "ende"; |
| | | public static final String PL_CMD_STOP = "stop"; |
| | | public static final String PL_CMD_PAUSE = "pause"; |
| | | public static final String PL_CMD_PLAYON = "playon"; |
| | | public static final String PL_CMD_AVD_STOP = "avd/stop"; |
| | | public static final String PL_CMD_AVD_PAUSE = "avd/pause"; |
| | | public static final String PL_CMD_AVD_PLAYON = "avd/playon"; |
| | | public static final String DEFAULT_HOST = "http://localhost:9090"; |
| | | |
| | | private final Map spielt = new HashMap(); |
| | |
| | | String path = e.getRequestURI().toString(); |
| | | String[] elems = path.split(Server.SLASH); |
| | | FileStorage fs = new FileStorage(App.getInitParameter(App.getRs(App.RB_AP_CONF))); |
| | | logger.fine(path); |
| | | |
| | | // Faustregel: Anzahl Elemente eines URL plus 1 ist die Anzahl der Elemente des |
| | | // Ergebnisses von String.split. |
| | |
| | | case 6: |
| | | if (elems[5].equalsIgnoreCase(PL_CMD_ENDE)) { |
| | | response = naechsterTitel(fs, elems[4]); |
| | | } else if(elems[5].equalsIgnoreCase(PL_CMD_STOP)) { |
| | | response = kommandoSenden(fs, elems[4], PL_CMD_AVD_STOP); |
| | | } else if(elems[5].equalsIgnoreCase(PL_CMD_PAUSE)) { |
| | | response = kommandoSenden(fs, elems[4], PL_CMD_AVD_PAUSE); |
| | | } else if(elems[5].equalsIgnoreCase(PL_CMD_PLAYON)) { |
| | | response = kommandoSenden(fs, elems[4], PL_CMD_AVD_PLAYON); |
| | | } else { |
| | | response = meldung("Ungueltiges Kommando: " + elems[5], AbstractHandler.RTC_NOT_FOUND); |
| | | } |
| | |
| | | break; |
| | | } |
| | | return response; |
| | | } |
| | | |
| | | private String kommandoSenden(Storage s, String aName, String kommando) { |
| | | Entity entity = s.read(FileStorage.ST_ABSPIELER, aName); |
| | | if (entity instanceof Abspieler) { |
| | | Abspieler abspieler = (Abspieler) entity; |
| | | StringBuilder kmd = new StringBuilder(); |
| | | kmd.append(abspieler.getUrl()); |
| | | kmd.append(kommando); |
| | | return kommando + " gesendet."; |
| | | } else { |
| | | return meldung("Abspielliste nicht gefunden.", AbstractHandler.RTC_NOT_FOUND); |
| | | } |
| | | } |
| | | |
| | | private String ersterTitel(Storage s, String aName, String lName) { |
| | |
| | | response = listentitelSpielen(s, abspielerName, liste, titelNr); |
| | | } else { |
| | | response = "Liste " + liste.getName() + " ist zuende gespielt."; |
| | | logger.info(response); |
| | | } |
| | | } else { |
| | | response = meldung("Abspielliste nicht gefunden.", AbstractHandler.RTC_NOT_FOUND); |