if (daemon != null) {
PlayerCommandTypeMapping pCommand = null;
try {
pCommand = PlayerCommandTypeMapping.fromString(playerCommand);
MPDPlayer player = daemon.getMPDPlayer();
switch (pCommand) {
case PAUSE: player.pause(); break;
case PLAY: player.play(); break;
case STOP: player.stop(); break;
case VOLUME_INCREASE: player.setVolume(player.getVolume() + VOLUME_CHANGE_SIZE); break;
case VOLUME_DECREASE: player.setVolume(player.getVolume() - VOLUME_CHANGE_SIZE); break;
case NEXT: player.playNext(); break;
case PREV: player.playPrev(); break;
case ENABLE:
case DISABLE:
Integer outputId = Integer.valueOf((String) commandParams);
MPDAdmin admin = daemon.getMPDAdmin();
MPDOutput output = new MPDOutput(outputId - 1); // internally mpd uses 0-based indexing
if (pCommand == PlayerCommandTypeMapping.ENABLE) {
admin.enableOutput(output);
} else {
admin.disableOutput(output);
}
break;
case VOLUME:
logger.debug("Volume adjustment received: '{}' '{}'", pCommand, commandParams);
player.setVolume(((PercentType) commandParams).intValue());
break;
}
}
catch (MPDPlayerException pe) {