|
a/src/ohcredentials.cxx |
|
b/src/ohcredentials.cxx |
|
... |
|
... |
39 |
#include "libupnpp/log.hxx"
|
39 |
#include "libupnpp/log.hxx"
|
40 |
#include "libupnpp/base64.hxx"
|
40 |
#include "libupnpp/base64.hxx"
|
41 |
#include "libupnpp/soaphelp.hxx"
|
41 |
#include "libupnpp/soaphelp.hxx"
|
42 |
#include "libupnpp/device/device.hxx"
|
42 |
#include "libupnpp/device/device.hxx"
|
43 |
#include "mediaserver/cdplugins/cdplugin.hxx"
|
43 |
#include "mediaserver/cdplugins/cdplugin.hxx"
|
|
|
44 |
#include "mediaserver/cdplugins/plgwithslave.hxx"
|
44 |
|
45 |
|
45 |
using namespace std;
|
46 |
using namespace std;
|
46 |
using namespace std::placeholders;
|
47 |
using namespace std::placeholders;
|
47 |
|
48 |
|
48 |
static const string sTpCredentials("urn:av-openhome-org:service:Credentials:1");
|
49 |
static const string sTpCredentials("urn:av-openhome-org:service:Credentials:1");
|
|
... |
|
... |
75 |
}
|
76 |
}
|
76 |
|
77 |
|
77 |
// Possibly retrieve the IP port used by our proxy server
|
78 |
// Possibly retrieve the IP port used by our proxy server
|
78 |
static string sport;
|
79 |
static string sport;
|
79 |
if (sport.empty()) {
|
80 |
if (sport.empty()) {
|
80 |
int port = CDPluginServices::default_microhttpport();
|
81 |
sport = SoapHelp::i2s(CDPluginServices::microhttpport());
|
81 |
if (!g_config->get("plgmicrohttpport", sport)) {
|
|
|
82 |
sport = SoapHelp::i2s(port);
|
|
|
83 |
}
|
|
|
84 |
}
|
82 |
}
|
85 |
|
83 |
|
86 |
// http://wiki.openhome.org/wiki/Av:Developer:Eriskay:StreamingServices
|
84 |
// http://wiki.openhome.org/wiki/Av:Developer:Eriskay:StreamingServices
|
87 |
// Tidal and qobuz tracks added by Kazoo / Lumin:
|
85 |
// Tidal and qobuz tracks added by Kazoo / Lumin:
|
88 |
// tidal://track?version=1&trackId=[tidal_track_id]
|
86 |
// tidal://track?version=1&trackId=[tidal_track_id]
|
|
... |
|
... |
145 |
}
|
143 |
}
|
146 |
if (cmd->running()) {
|
144 |
if (cmd->running()) {
|
147 |
return true;
|
145 |
return true;
|
148 |
}
|
146 |
}
|
149 |
LOGDEB("ServiceCreds: " << servicename << " starting cmd\n");
|
147 |
LOGDEB("ServiceCreds: " << servicename << " starting cmd\n");
|
150 |
string exepath = path_cat(g_datadir, "cdplugins");
|
|
|
151 |
exepath = path_cat(exepath, servicename);
|
|
|
152 |
exepath = path_cat(exepath, servicename + "-app" + ".py");
|
|
|
153 |
|
|
|
154 |
string pythonpath = string("PYTHONPATH=") +
|
|
|
155 |
path_cat(g_datadir, "cdplugins") + ":" +
|
|
|
156 |
path_cat(g_datadir, "cdplugins/pycommon") + ":" +
|
|
|
157 |
path_cat(g_datadir, "cdplugins/" + servicename);
|
|
|
158 |
string configname = string("UPMPD_CONFIG=") + g_configfilename;
|
|
|
159 |
// hostport is not needed by this login-only instance.
|
148 |
// hostport is not needed by this login-only instance.
|
160 |
string hostport = string("UPMPD_HTTPHOSTPORT=bogus:0");
|
149 |
return PlgWithSlave::startPluginCmd(
|
161 |
string pp = string("UPMPD_PATHPREFIX=") +
|
150 |
*cmd, servicename, "bogus", 0,
|
162 |
CDPluginServices::getpathprefix(servicename);
|
151 |
CDPluginServices::getpathprefix(servicename));
|
163 |
if (!cmd->startCmd(exepath, {/*args*/},
|
|
|
164 |
/* env */ {pythonpath, configname, hostport, pp})) {
|
|
|
165 |
LOGERR("ServiceCreds::maybeStartCmd: startCmd failed\n");
|
|
|
166 |
return false;
|
|
|
167 |
}
|
|
|
168 |
LOGDEB("ServiceCreds: " << servicename << " cmd started\n");
|
|
|
169 |
return true;
|
|
|
170 |
}
|
152 |
}
|
171 |
|
153 |
|
172 |
string login() {
|
154 |
string login() {
|
173 |
LOGDEB("ServiceCreds: " << servicename << " login\n");
|
155 |
LOGDEB("ServiceCreds: " << servicename << " login\n");
|
174 |
|
156 |
|
|
... |
|
... |
206 |
servicename << " user " << user << endl);
|
188 |
servicename << " user " << user << endl);
|
207 |
return string();
|
189 |
return string();
|
208 |
}
|
190 |
}
|
209 |
servicedata[toknm] = it->second;
|
191 |
servicedata[toknm] = it->second;
|
210 |
}
|
192 |
}
|
|
|
193 |
// Start a silent/crippled media server process (if not
|
|
|
194 |
// already done) to perform the URL redirections. If the media
|
|
|
195 |
// server was actually enabled by one of the services, this
|
|
|
196 |
// will do nothing.
|
|
|
197 |
startMsOnlyProcess();
|
211 |
if (servicename == "qobuz") {
|
198 |
if (servicename == "qobuz") {
|
212 |
data = servicedata["appid"];
|
199 |
data = servicedata["appid"];
|
213 |
} else if (servicename == "tidal") {
|
200 |
} else if (servicename == "tidal") {
|
214 |
data = servicedata["country"];
|
201 |
data = servicedata["country"];
|
215 |
}
|
202 |
}
|