Exemplo n.º 1
0
 public void setVolume(String playerId, int volume) {
   SqueezePlayer player = getPlayer(playerId);
   if (player == null) return;
   if (0 > volume) {
     volume = 0;
   } else if (volume > 100) {
     volume = 100;
   }
   sendCommand(player.getMacAddress() + " mixer volume " + String.valueOf(volume));
 }
Exemplo n.º 2
0
 public void showStringHuge(String playerId, String line, int duration) {
   SqueezePlayer player = getPlayer(playerId);
   if (player == null) return;
   sendCommand(
       player.getMacAddress()
           + " show line1:"
           + line
           + " font:huge duration:"
           + String.valueOf(duration));
 }
Exemplo n.º 3
0
 public void showStrings(String playerId, String line1, String line2, int duration) {
   SqueezePlayer player = getPlayer(playerId);
   if (player == null) return;
   sendCommand(
       player.getMacAddress()
           + " show line1:"
           + line1
           + " line2:"
           + line2
           + " duration:"
           + String.valueOf(duration));
 }
Exemplo n.º 4
0
    private void handlePlayersList(String message) {
      String[] playersList = decode(message).split("playerindex:\\d+\\s");
      for (String playerParams : playersList) {
        String[] parameterList = playerParams.split("\\s");

        // parse out the MAC address first
        String macAddress = null;
        for (String parameter : parameterList) {
          if (parameter.contains("playerid")) {
            macAddress = parameter.substring(parameter.indexOf(":") + 1);
            break;
          }
        }

        // if none found then ignore this set of params
        if (macAddress == null) continue;

        // see if this player exists in our config
        SqueezePlayer player = playersByMacAddress.get(macAddress);
        if (player == null) continue;

        // populate the player state
        for (String parameter : parameterList) {
          if (parameter.contains("ip")) {
            player.setIpAddr(parameter.substring(parameter.indexOf(":") + 1));
          } else if (parameter.contains("uuid")) {
            player.setUuid(parameter.substring(parameter.indexOf(":") + 1));
          } else if (parameter.contains("name")) {
            player.setName(parameter.substring(parameter.indexOf(":") + 1));
          } else if (parameter.contains("model")) {
            player.setModel(parameter.substring(parameter.indexOf(":") + 1));
          }
        }

        // tell the server we want to subscribe to player updates
        sendCommand(player.getMacAddress() + " status - 1 subscribe:10 tags:yagJlN");
      }
    }
Exemplo n.º 5
0
 public void next(String playerId) {
   SqueezePlayer player = getPlayer(playerId);
   if (player == null) return;
   sendCommand(player.getMacAddress() + " playlist index +1");
 }
Exemplo n.º 6
0
 public void clearPlaylist(String playerId) {
   SqueezePlayer player = getPlayer(playerId);
   if (player == null) return;
   sendCommand(player.getMacAddress() + " playlist clear");
 }
Exemplo n.º 7
0
 public void stop(String playerId) {
   SqueezePlayer player = getPlayer(playerId);
   if (player == null) return;
   sendCommand(player.getMacAddress() + " stop");
 }
Exemplo n.º 8
0
 public void unPause(String playerId) {
   SqueezePlayer player = getPlayer(playerId);
   if (player == null) return;
   sendCommand(player.getMacAddress() + " pause 0");
 }
Exemplo n.º 9
0
 public void playUrl(String playerId, String url) {
   SqueezePlayer player = getPlayer(playerId);
   if (player == null) return;
   sendCommand(player.getMacAddress() + " playlist play " + url);
 }
Exemplo n.º 10
0
 public void syncPlayer(String playerId1, String playerId2) {
   SqueezePlayer player1 = getPlayer(playerId1);
   SqueezePlayer player2 = getPlayer(playerId2);
   if (player1 == null || player2 == null) return;
   sendCommand(player1.getMacAddress() + " sync " + player2.getMacAddress());
 }
Exemplo n.º 11
0
 public void powerOff(String playerId) {
   SqueezePlayer player = getPlayer(playerId);
   if (player == null) return;
   sendCommand(player.getMacAddress() + " power 0");
 }