+
+ // When mpd is stopped, it gives us back crap values for some things.
+ if ('state' in state && state.state == 'stop') {
+ if ('volume' in state && state.volume == '-1')
+ keys.splice(keys.indexOf('volume'), 1);
+ }
+ // Now merge the current state with the previous one so that we don't
+ // lose information like volume or song position.
+ curr_state = this.state;
+ keys.forEach(function(key) {
+ curr_state[key] = state[key];
+ });
+
+ this._cb_update_state(curr_state);