Switch to unified view

a/src/mpdcli.cxx b/src/mpdcli.cxx
...
...
54
    m_have_addtagid = checkForCommand("addtagid");
54
    m_have_addtagid = checkForCommand("addtagid");
55
55
56
    std::unique_lock<std::mutex>(g_configlock);
56
    std::unique_lock<std::mutex>(g_configlock);
57
    g_config->get("onstart", m_onstart);
57
    g_config->get("onstart", m_onstart);
58
    g_config->get("onplay", m_onplay);
58
    g_config->get("onplay", m_onplay);
59
    g_config->get("onpause", m_onpause);
59
    g_config->get("onstop", m_onstop);
60
    g_config->get("onstop", m_onstop);
60
    string scratch;
61
    string scratch;
61
    g_config->get("onvolumechange", scratch);
62
    g_config->get("onvolumechange", scratch);
62
    stringToStrings(scratch,  m_onvolumechange);
63
    stringToStrings(scratch,  m_onvolumechange);
63
    g_config->get("getexternalvolume", scratch);
64
    g_config->get("getexternalvolume", scratch);
...
...
228
            }
229
            }
229
        }
230
        }
230
        m_stat.state = MpdStatus::MPDS_STOP;
231
        m_stat.state = MpdStatus::MPDS_STOP;
231
        break;
232
        break;
232
    case MPD_STATE_PLAY:
233
    case MPD_STATE_PLAY:
233
        // Only execute onplay command if mpd was stopped
234
        // Only execute onplay command if mpd was stopped or paused
234
        if (!m_onplay.empty() && (m_stat.state == MpdStatus::MPDS_UNK ||
235
        if (!m_onplay.empty() && (m_stat.state == MpdStatus::MPDS_UNK ||
236
                                  m_stat.state == MpdStatus::MPDS_STOP ||
235
                                  m_stat.state == MpdStatus::MPDS_STOP)) {
237
                                  m_stat.state == MpdStatus::MPDS_PAUSE)) {
236
            if (system(m_onplay.c_str())) {
238
            if (system(m_onplay.c_str())) {
237
                LOGERR("MPDCli::updStatus: " << m_onplay << " failed "<< endl);
239
                LOGERR("MPDCli::updStatus: " << m_onplay << " failed "<< endl);
238
            }
240
            }
239
        }
241
        }
240
        m_stat.state = MpdStatus::MPDS_PLAY;
242
        m_stat.state = MpdStatus::MPDS_PLAY;
241
        break;
243
        break;
242
    case MPD_STATE_PAUSE: m_stat.state = MpdStatus::MPDS_PAUSE;break;
244
    case MPD_STATE_PAUSE:
245
        // Only execute onpause command if mpd was playing
246
        if (!m_onpause.empty() && (m_stat.state == MpdStatus::MPDS_PLAY)) {
247
            if (system(m_onpause.c_str())) {
248
                LOGERR("MPDCli::updStatus: " << m_onpause << " failed "<< endl);
249
            }
250
        } 
251
        m_stat.state = MpdStatus::MPDS_PAUSE;
252
        break;
243
    case MPD_STATE_UNKNOWN: 
253
    case MPD_STATE_UNKNOWN: 
244
    default:
254
    default:
245
        m_stat.state = MpdStatus::MPDS_UNK;
255
        m_stat.state = MpdStatus::MPDS_UNK;
246
        break;
256
        break;
247
    }
257
    }