App zur Steuerung des mpv Mediaplayers auf einem Raspberry Pi über HTTP
undisclosed
2023-01-02 aaed2d146028ba1488a7ba7c7e924192b9df8394
src/de/uhilger/calypso/handler/VLCSeekHandler.java
@@ -1,7 +1,3 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package de.uhilger.calypso.handler;
import com.sun.net.httpserver.HttpExchange;
@@ -11,21 +7,22 @@
import java.util.logging.Logger;
/**
 * dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2   org.mpris.MediaPlayer2.Player.Seek int64:-5000000
 *
 * dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2
 * org.mpris.MediaPlayer2.Player.Seek int64:-5000000
 *
 * @author Ulrich Hilger
 */
public class VLCSeekHandler extends CmdHandler {
  private static final Logger logger = Logger.getLogger(VLCSeekHandler.class.getName());
  public VLCSeekHandler(String cmd) {
    super(cmd);
  }
  @Override
  protected String process(HttpExchange t, String params) {
      String antwort;// = null;
    String antwort;// = null;
    try {
      StringBuilder kommando = new StringBuilder();
      kommando.append(VLCPlayer.DBUS_PREFIX);
@@ -39,23 +36,23 @@
    }
    return antwort;
  }
  @Override
  protected StringBuilder buildParams(HttpExchange t) {
    Player player = App.getPlayer();
    StringBuilder params = super.buildParams(t);
    if(player instanceof VLCPlayer) {
    if (player instanceof VLCPlayer) {
      String pos = player.getParam(map, "pos");
      if(!pos.isEmpty()) {
      if (!pos.isEmpty()) {
        params.append(" ");
        params.append("int64:");
        params.append(pos);
        params.append("000000"); // Mikrosekunden
      }
    }
    logger.log(Level.FINER, "params: " + params.toString());
    return params;
  }
  }
}