Switch to unified view

a/src/ohproduct.cxx b/src/ohproduct.cxx
...
...
56
static string scripts_dir("/usr/share/upmpdcli/src_scripts");
56
static string scripts_dir("/usr/share/upmpdcli/src_scripts");
57
57
58
// (Type, Name) list
58
// (Type, Name) list
59
static vector<pair<string, string> > o_sources;
59
static vector<pair<string, string> > o_sources;
60
60
61
static const string SndRcvPLName("PL-to-Songcast");
62
static const string SndRcvRDName("RD-to-Songcast");
63
61
OHProduct::OHProduct(UpMpd *dev, ohProductDesc_t& ohProductDesc)
64
OHProduct::OHProduct(UpMpd *dev, ohProductDesc_t& ohProductDesc)
62
    : OHService(sTpProduct, sIdProduct, dev),
65
    : OHService(sTpProduct, sIdProduct, dev),
63
      m_ohProductDesc(ohProductDesc), m_sourceIndex(0), m_standby(false)
66
      m_ohProductDesc(ohProductDesc), m_sourceIndex(0), m_standby(false)
64
{
67
{
65
    // Playlist must stay first.
68
    // Playlist must stay first.
...
...
76
            // play method but this would be complicated (the mpd we
79
            // play method but this would be complicated (the mpd we
77
            // want to get playing from sc2mpd HTTP is the
80
            // want to get playing from sc2mpd HTTP is the
78
            // original/saved one, not the current one, which is doing
81
            // original/saved one, not the current one, which is doing
79
            // the playing and sending to the fifo, so we'd need to
82
            // the playing and sending to the fifo, so we'd need to
80
            // tell ohreceiver about using the right one.
83
            // tell ohreceiver about using the right one.
81
            o_sources.push_back(pair<string,string>("Playlist",
84
            o_sources.push_back(pair<string,string>("Playlist", SndRcvPLName));
82
                                                    "SenderReceiverPL"));
83
            if (m_dev->m_ohrd) {
85
            if (m_dev->m_ohrd) {
84
                o_sources.push_back(pair<string,string>("Radio",
86
                o_sources.push_back(pair<string,string>("Radio", SndRcvRDName));
85
                                                        "SenderReceiverRD"));
86
            }
87
            }
87
            listScripts(o_sources);
88
            listScripts(o_sources);
88
        }
89
        }
89
    }
90
    }
90
91
...
...
265
            !curnm.compare("Radio")) {
266
            !curnm.compare("Radio")) {
266
            m_dev->m_ohrd->iStop();
267
            m_dev->m_ohrd->iStop();
267
            m_dev->m_ohrd->setActive(false);
268
            m_dev->m_ohrd->setActive(false);
268
        } else if (m_dev->m_sndrcv && m_dev->m_ohpl &&
269
        } else if (m_dev->m_sndrcv && m_dev->m_ohpl &&
269
                   !curtp.compare("Playlist") &&
270
                   !curtp.compare("Playlist") &&
270
                   !curnm.compare("SenderReceiverPL")) {
271
                   !curnm.compare(SndRcvPLName)) {
271
            m_dev->m_sndrcv->stop();
272
            m_dev->m_sndrcv->stop();
272
            m_dev->m_ohpl->setActive(false);
273
            m_dev->m_ohpl->setActive(false);
273
        } else if (m_dev->m_sndrcv && m_dev->m_ohrd &&
274
        } else if (m_dev->m_sndrcv && m_dev->m_ohrd &&
274
                   !curtp.compare("Radio") &&
275
                   !curtp.compare("Radio") &&
275
                   !curnm.compare("SenderReceiverRD")) {
276
                   !curnm.compare(SndRcvRDName)) {
276
            m_dev->m_ohrd->setActive(false);
277
            m_dev->m_ohrd->setActive(false);
277
            m_dev->m_sndrcv->stop();
278
            m_dev->m_sndrcv->stop();
278
        } else {
279
        } else {
279
            // External inputs managed by scripts Analog/Digital/Hdmi etc.
280
            // External inputs managed by scripts Analog/Digital/Hdmi etc.
280
            m_dev->m_sndrcv->stop();
281
            m_dev->m_sndrcv->stop();
...
...
287
        } else if (m_dev->m_ohrcv && !newnm.compare("Receiver")) {
288
        } else if (m_dev->m_ohrcv && !newnm.compare("Receiver")) {
288
            m_dev->m_ohrcv->setActive(true);
289
            m_dev->m_ohrcv->setActive(true);
289
        } else if (m_dev->m_ohrd && !newnm.compare("Radio")) {
290
        } else if (m_dev->m_ohrd && !newnm.compare("Radio")) {
290
            m_dev->m_ohrd->setActive(true);
291
            m_dev->m_ohrd->setActive(true);
291
        } else if (m_dev->m_ohpl && m_dev->m_sndrcv &&
292
        } else if (m_dev->m_ohpl && m_dev->m_sndrcv &&
292
                   !newnm.compare("SenderReceiverPL")) {
293
                   !newnm.compare(SndRcvPLName)) {
293
            m_dev->m_ohpl->setActive(true);
294
            m_dev->m_ohpl->setActive(true);
294
            m_dev->m_sndrcv->start(string(), savedms);
295
            m_dev->m_sndrcv->start(string(), savedms);
295
        } else if (m_dev->m_ohrd && m_dev->m_sndrcv &&
296
        } else if (m_dev->m_ohrd && m_dev->m_sndrcv &&
296
                   !newnm.compare("SenderReceiverRD")) {
297
                   !newnm.compare(SndRcvRDName)) {
297
            m_dev->m_ohrd->setActive(true);
298
            m_dev->m_ohrd->setActive(true);
298
            m_dev->m_sndrcv->start(string());
299
            m_dev->m_sndrcv->start(string());
299
        } else {
300
        } else {
300
            string sname = newtp + "-" + newnm;
301
            string sname = newtp + "-" + newnm;
301
            string spath = path_cat(scripts_dir, sname);
302
            string spath = path_cat(scripts_dir, sname);