| | |
| | | /* |
| | | AV-Direktor - Control OMXPlayer on Raspberry Pi via HTTP |
| | | Copyright (C) 2021 Ulrich Hilger |
| | | Calypso - Media Player Remote Control via HTTP for Raspberry Pi |
| | | Copyright (C) 2021-2023 Ulrich Hilger |
| | | |
| | | This program is free software: you can redistribute it and/or modify |
| | | it under the terms of the GNU Affero General Public License as |
| | |
| | | |
| | | You should have received a copy of the GNU Affero General Public License |
| | | along with this program. If not, see <https://www.gnu.org/licenses/>. |
| | | */ |
| | | */ |
| | | package de.uhilger.calypso; |
| | | |
| | | import com.sun.net.httpserver.HttpServer; |
| | |
| | | import de.uhilger.calypso.handler.StopServerHandler; |
| | | import de.uhilger.calypso.handler.VLCKillHandler; |
| | | import de.uhilger.calypso.handler.VLCPlayer; |
| | | import de.uhilger.calypso.handler.VLCSeekHandler; |
| | | import java.io.IOException; |
| | | import java.util.logging.Logger; |
| | | import java.net.InetSocketAddress; |
| | |
| | | import java.util.logging.Level; |
| | | |
| | | /** |
| | | * |
| | | * @author ulrich |
| | | * Die Klasse Server implementiert die HTTP-Schnittstelle zum |
| | | * Mediaplayer. Es wird ein Player-Prozesss fuer das Abspielen |
| | | * eines Titels gestartet. Mit Stopp oder Ende des Titels endet |
| | | * auch der Abspielprozess.<br> |
| | | * <br> |
| | | * zum Abspielen:<br> |
| | | * /calypso/play?title=http://ein.titel.mp3&r=http://rueckmelde.url<br> |
| | | * <br> |
| | | * waehrend des Abspielens:<br> |
| | | * /calypso/pause<br> |
| | | * /calypso/seek?pos=[sekunden]<br> |
| | | * /calypso/stop<br> |
| | | * <br> |
| | | * sonstige Funktionen:<br> |
| | | * /calypso/ping<br> |
| | | * /calypso/server/stop<br> |
| | | * <br> |
| | | * verworfene Funktionen<br> |
| | | * /calypso/vol-inc<br> |
| | | * /calypso/vol-dec<br> |
| | | * Die Lautstaerke wird in aller Regel am Geraet geregelt, an das der |
| | | * Zuspieler (der Raspi) angeschlossen ist. Eine Regelung ueber den |
| | | * Zuspieler ist daher eher selten erforderlich. |
| | | * |
| | | * @author Ulrich Hilger |
| | | */ |
| | | public class Server { |
| | | |
| | |
| | | server.createContext(contextName + "/playon", new PlayOnHandler(OMXPlayer.F_PLAY_ON)); |
| | | } else if (playerType.equals(App.VLC_PLAYER)) { |
| | | server.createContext(contextName + "/pause", new DBusHandler(VLCPlayer.CMD_PAUSE_RESUME)); |
| | | //server.createContext(contextName + "/seek", new DBusHandler(VLCPlayer.CMD_SEEK)); |
| | | server.createContext(contextName + "/seek", new VLCSeekHandler(VLCPlayer.CMD_SEEK)); |
| | | server.createContext(contextName + "/stop", new VLCKillHandler()); |
| | | } |
| | | server.createContext(contextName + "/ui", new FileHandler(App.getInitParameter(App.IP_WWW_DATA))); |