App zur Steuerung des mpv Mediaplayers auf einem Raspberry Pi über HTTP
undisclosed
2023-01-03 7a79ba8b70e8541b6d4413a46061b2c03ecddc9b
src/de/uhilger/calypso/Server.java
@@ -23,6 +23,8 @@
import de.uhilger.calypso.handler.DBusHandler;
import de.uhilger.calypso.handler.FileHandler;
import de.uhilger.calypso.handler.LogHandler;
import de.uhilger.calypso.handler.MPlayHandler;
import de.uhilger.calypso.handler.MPlayer;
import de.uhilger.calypso.handler.OMXPlayer;
import de.uhilger.calypso.handler.PingHandler;
import de.uhilger.calypso.handler.PlayHandler;
@@ -93,8 +95,9 @@
    logger.log(Level.INFO, "Server starting on port {0}", port);
    HttpServer server = HttpServer.create(new InetSocketAddress(port), 0);
    server.createContext(contextName + "/play", new PlayHandler(BasePlayer.F_PLAY));
    if (playerType.equals(App.OMX_PLAYER)) {
      server.createContext(contextName + "/play", new PlayHandler(BasePlayer.F_PLAY));
      server.createContext(contextName + "/seek", new SeekHandler(OMXPlayer.F_SEEK));
      server.createContext(contextName + "/stop", new CmdHandler(OMXPlayer.CMD_STOP));
      server.createContext(contextName + "/pause", new CmdHandler(OMXPlayer.CMD_PAUSE_RESUME));
@@ -104,10 +107,16 @@
      server.createContext(contextName + "/log", new LogHandler());
      server.createContext(contextName + "/playon", new PlayOnHandler(OMXPlayer.F_PLAY_ON));
    } else if (playerType.equals(App.VLC_PLAYER)) {
      server.createContext(contextName + "/play", new PlayHandler(BasePlayer.F_PLAY));
      server.createContext(contextName + "/pause", new DBusHandler(VLCPlayer.CMD_PAUSE_RESUME));
      //server.createContext(contextName + "/pause", new CmdHandler("pause"));
      //server.createContext(contextName + "/seek", new DBusHandler(VLCPlayer.CMD_SEEK));
      server.createContext(contextName + "/seek", new VLCSeekHandler(VLCPlayer.CMD_SEEK));
      server.createContext(contextName + "/stop", new VLCKillHandler());
    } else if (playerType.equals(App.M_PLAYER)) {
      server.createContext(contextName + "/play", new MPlayHandler());
      server.createContext(contextName + "/pause", new CmdHandler(MPlayer.CMD_PAUSE_RESUME));
      server.createContext(contextName + "/stop", new CmdHandler(MPlayer.CMD_STOP));
    }
    server.createContext(contextName + "/ui", new FileHandler(App.getInitParameter(App.IP_WWW_DATA)));
    server.createContext(contextName + "/ping", new PingHandler(BasePlayer.F_PING));