Search in sources :

Example 1 with MPDResponseException

use of org.bff.javampd.exception.MPDResponseException in project openhab1-addons by openhab.

the class MpdBinding method disconnect.

/**
     * Disconnects the player <code>playerId</code>
     *
     * @param playerId the id of the player to disconnect
     */
private void disconnect(String playerId) {
    try {
        MpdPlayerConfig playerConfig = playerConfigCache.get(playerId);
        MPDStandAloneMonitor monitor = playerConfig.monitor;
        if (monitor != null) {
            monitor.stop();
        }
        MPD mpd = playerConfig.instance;
        if (mpd != null) {
            mpd.close();
        }
    } catch (MPDConnectionException ce) {
        logger.warn("Couldn't disconnect player '{}'", playerId);
    } catch (MPDResponseException re) {
        logger.warn("Received response error: {}", re.getLocalizedMessage());
    }
}
Also used : MPD(org.bff.javampd.MPD) MPDConnectionException(org.bff.javampd.exception.MPDConnectionException) MPDStandAloneMonitor(org.bff.javampd.monitor.MPDStandAloneMonitor) MPDResponseException(org.bff.javampd.exception.MPDResponseException)

Aggregations

MPD (org.bff.javampd.MPD)1 MPDConnectionException (org.bff.javampd.exception.MPDConnectionException)1 MPDResponseException (org.bff.javampd.exception.MPDResponseException)1 MPDStandAloneMonitor (org.bff.javampd.monitor.MPDStandAloneMonitor)1