* @{inheritDoc}
*/
@Override
public void internalReceiveCommand(String itemName, Command command) {
MpdBindingProvider provider;
String matchingPlayerCommand;
Object params = new Object(); //nothing by default
if (command instanceof PercentType) {
// we have received volume adjustment request
matchingPlayerCommand = "PERCENT";
params = command;
} else {
matchingPlayerCommand = command.toString();
}
provider = findFirstMatchingBindingProvider(itemName, matchingPlayerCommand);
if (provider == null) {
logger.warn("cannot find matching binding provider [itemName={}, command={}]", itemName, command);
return;
}
String playerCommand =
provider.getPlayerCommand(itemName, matchingPlayerCommand);
if (StringUtils.isNotBlank(playerCommand)) {
String playerCommandParam =
provider.getPlayerCommandParam(itemName, matchingPlayerCommand);
if (playerCommandParam != null) {
params = playerCommandParam;
}
executePlayerCommand(playerCommand, params);
}