Switch to unified view

a/src/mediaserver/cdplugins/plgwithslave.cxx b/src/mediaserver/cdplugins/plgwithslave.cxx
...
...
16
 */
16
 */
17
#include "config.h"
17
#include "config.h"
18
18
19
#include "plgwithslave.hxx"
19
#include "plgwithslave.hxx"
20
20
21
#include <fcntl.h>
22
23
#include <string>
21
#include <string>
24
#include <vector>
22
#include <vector>
25
#include <sstream>
23
#include <sstream>
26
#include <string.h>
24
#include <string.h>
25
#include <fcntl.h>
27
#include <upnp/upnp.h>
26
#include <upnp/upnp.h>
28
#include <microhttpd.h>
27
#include <microhttpd.h>
29
#include <json/json.h>
28
#include <json/json.h>
29
#include <libupnpp/log.hxx>
30
30
31
#include "cmdtalk.h"
31
#include "cmdtalk.h"
32
#include "pathut.h"
32
#include "pathut.h"
33
#include "smallut.h"
33
#include "smallut.h"
34
#include "libupnpp/log.hxx"
35
#include "main.hxx"
34
#include "main.hxx"
36
#include "conftree.h"
37
35
38
using namespace std;
36
using namespace std;
39
using namespace std::placeholders;
37
using namespace std::placeholders;
40
//using json = nlohmann::json;
38
//using json = nlohmann::json;
41
using namespace UPnPProvider;
39
using namespace UPnPProvider;
...
...
188
{
186
{
189
    if (cmd.running()) {
187
    if (cmd.running()) {
190
        return true;
188
        return true;
191
    }
189
    }
192
190
193
    int port = 49149;
191
    int port = CDPluginServices::default_microhttpport();
194
    string sport;
192
    string sport;
195
    if (plg->m_services->config_get("plgmicrohttpport", sport)) {
193
    if (plg->m_services->config_get("plgmicrohttpport", sport)) {
196
        port = atoi(sport.c_str());
194
        port = atoi(sport.c_str());
197
    }
195
    }
198
    if (nullptr == mhd) {
196
    if (nullptr == mhd) {
...
...
225
    string configname = string("UPMPD_CONFIG=") + g_configfilename;
223
    string configname = string("UPMPD_CONFIG=") + g_configfilename;
226
    stringstream ss;
224
    stringstream ss;
227
    ss << upnphost << ":" << port;
225
    ss << upnphost << ":" << port;
228
    string hostport = string("UPMPD_HTTPHOSTPORT=") + ss.str();
226
    string hostport = string("UPMPD_HTTPHOSTPORT=") + ss.str();
229
    string pp = string("UPMPD_PATHPREFIX=") + pathprefix;
227
    string pp = string("UPMPD_PATHPREFIX=") + pathprefix;
230
    string fn = string("UPMPD_FNAME=") + plg->m_services->getfname();
231
    if (!cmd.startCmd(exepath, {/*args*/},
228
    if (!cmd.startCmd(exepath, {/*args*/},
232
                      /* env */ {pythonpath, configname, hostport, pp})) {
229
                      /* env */ {pythonpath, configname, hostport, pp})) {
233
        LOGERR("PlgWithSlave::maybeStartCmd: startCmd failed\n");
230
        LOGERR("PlgWithSlave::maybeStartCmd: startCmd failed\n");
234
        return false;
231
        return false;
235
    }
232
    }