Switch to unified view

a/src/mediaserver/cdplugins/plgwithslave.cxx b/src/mediaserver/cdplugins/plgwithslave.cxx
...
...
73
    bool maybeStartCmd();
73
    bool maybeStartCmd();
74
74
75
    PlgWithSlave *plg;
75
    PlgWithSlave *plg;
76
    CmdTalk cmd;
76
    CmdTalk cmd;
77
    string exepath;
77
    string exepath;
78
    // Upnp Host and port. This would only be used to generate URLsif
78
    // Upnp Host and port. This would only be used to generate URLs *if*
79
    // we were using the libupnp miniserver. We currently use
79
    // we were using the libupnp miniserver. We currently use
80
    // microhttp because it can do redirects
80
    // microhttp because it can do redirects
81
    string upnphost;
81
    string upnphost;
82
    int upnpport;
82
    int upnpport;
83
    // path prefix (this is used by upmpdcli that gets it for us).
83
    // path prefix (this is used by upmpdcli that gets it for us).
...
...
184
{
184
{
185
    if (cmd.running()) {
185
    if (cmd.running()) {
186
        return true;
186
        return true;
187
    }
187
    }
188
188
189
    ConfSimple *conf = plg->m_services->getconfig(plg);
190
    int port = 49149;
189
    int port = 49149;
191
    string sport;
190
    string sport;
192
    if (conf->get("plgmicrohttpport", sport)) {
191
    if (plg->m_services->config_get("plgmicrohttpport", sport)) {
193
        port = atoi(sport.c_str());
192
        port = atoi(sport.c_str());
194
    }
193
    }
195
    if (nullptr == mhd) {
194
    if (nullptr == mhd) {
196
195
197
        // Start the microhttpd daemon. There can be only one, and it
196
        // Start the microhttpd daemon. There can be only one, and it
...
...
222
    string configname = string("UPMPD_CONFIG=") + g_configfilename;
221
    string configname = string("UPMPD_CONFIG=") + g_configfilename;
223
    stringstream ss;
222
    stringstream ss;
224
    ss << upnphost << ":" << port;
223
    ss << upnphost << ":" << port;
225
    string hostport = string("UPMPD_HTTPHOSTPORT=") + ss.str();
224
    string hostport = string("UPMPD_HTTPHOSTPORT=") + ss.str();
226
    string pp = string("UPMPD_PATHPREFIX=") + pathprefix;
225
    string pp = string("UPMPD_PATHPREFIX=") + pathprefix;
226
    string fn = string("UPMPD_FNAME=") + plg->m_services->getfname();
227
    if (!cmd.startCmd(exepath, {/*args*/},
227
    if (!cmd.startCmd(exepath, {/*args*/},
228
                      /* env */ {pythonpath, configname, hostport, pp})) {
228
                      /* env */ {pythonpath, configname, hostport, pp})) {
229
        LOGERR("PlgWithSlave::maybeStartCmd: startCmd failed\n");
229
        LOGERR("PlgWithSlave::maybeStartCmd: startCmd failed\n");
230
        return false;
230
        return false;
231
    }
231
    }
...
...
278
278
279
279
280
PlgWithSlave::PlgWithSlave(const string& name, CDPluginServices *services)
280
PlgWithSlave::PlgWithSlave(const string& name, CDPluginServices *services)
281
    : CDPlugin(name, services)
281
    : CDPlugin(name, services)
282
{
282
{
283
    string exepath = path_cat(g_datadir, "cdplugins");
284
    exepath = path_cat(exepath, name);
285
    exepath = path_cat(exepath, name + "-app" + ".py");
286
283
    m = new Internal(this, services->getexecpath(this),
287
    m = new Internal(this, exepath,
284
                     services->getupnpaddr(this),
288
                     services->getupnpaddr(this),
285
                     services->getupnpport(this),
289
                     services->getupnpport(this),
286
                     services->getpathprefix(this));
290
                     services->getpathprefix(this));
287
}
291
}
288
292