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)); }
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)); }
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)); }
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"); } }
public void next(String playerId) { SqueezePlayer player = getPlayer(playerId); if (player == null) return; sendCommand(player.getMacAddress() + " playlist index +1"); }
public void clearPlaylist(String playerId) { SqueezePlayer player = getPlayer(playerId); if (player == null) return; sendCommand(player.getMacAddress() + " playlist clear"); }
public void stop(String playerId) { SqueezePlayer player = getPlayer(playerId); if (player == null) return; sendCommand(player.getMacAddress() + " stop"); }
public void unPause(String playerId) { SqueezePlayer player = getPlayer(playerId); if (player == null) return; sendCommand(player.getMacAddress() + " pause 0"); }
public void playUrl(String playerId, String url) { SqueezePlayer player = getPlayer(playerId); if (player == null) return; sendCommand(player.getMacAddress() + " playlist play " + url); }
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()); }
public void powerOff(String playerId) { SqueezePlayer player = getPlayer(playerId); if (player == null) return; sendCommand(player.getMacAddress() + " power 0"); }