|
a/src/mediaserver/contentdirectory.cxx |
|
b/src/mediaserver/contentdirectory.cxx |
|
... |
|
... |
49 |
~Internal() {
|
49 |
~Internal() {
|
50 |
for (auto& it : plugins) {
|
50 |
for (auto& it : plugins) {
|
51 |
delete it.second;
|
51 |
delete it.second;
|
52 |
}
|
52 |
}
|
53 |
}
|
53 |
}
|
|
|
54 |
// Start plugins which have long init so that the user has less to
|
|
|
55 |
// wait on first access
|
|
|
56 |
void maybeStartSomePlugins();
|
54 |
CDPlugin *pluginFactory(const string& appname) {
|
57 |
CDPlugin *pluginFactory(const string& appname) {
|
55 |
LOGDEB("ContentDirectory::pluginFactory: for " << appname << endl);
|
58 |
LOGDEB("ContentDirectory::pluginFactory: for " << appname << endl);
|
56 |
|
59 |
|
57 |
if (host.empty()) {
|
60 |
if (host.empty()) {
|
58 |
UpnpDevice *dev;
|
61 |
UpnpDevice *dev;
|
|
... |
|
... |
111 |
this, "Browse",
|
114 |
this, "Browse",
|
112 |
bind(&ContentDirectory::actBrowse, this, _1, _2));
|
115 |
bind(&ContentDirectory::actBrowse, this, _1, _2));
|
113 |
dev->addActionMapping(
|
116 |
dev->addActionMapping(
|
114 |
this, "Search",
|
117 |
this, "Search",
|
115 |
bind(&ContentDirectory::actSearch, this, _1, _2));
|
118 |
bind(&ContentDirectory::actSearch, this, _1, _2));
|
|
|
119 |
m->maybeStartSomePlugins();
|
116 |
}
|
120 |
}
|
117 |
|
121 |
|
118 |
ContentDirectory::~ContentDirectory()
|
122 |
ContentDirectory::~ContentDirectory()
|
119 |
{
|
123 |
{
|
120 |
delete m;
|
124 |
delete m;
|
|
... |
|
... |
230 |
if (dol1 == string::npos) {
|
234 |
if (dol1 == string::npos) {
|
231 |
LOGERR("ContentDirectory::appForId: bad id [" << id << "]\n");
|
235 |
LOGERR("ContentDirectory::appForId: bad id [" << id << "]\n");
|
232 |
return string();
|
236 |
return string();
|
233 |
}
|
237 |
}
|
234 |
return id.substr(dol0 + 1, dol1 - dol0 -1);
|
238 |
return id.substr(dol0 + 1, dol1 - dol0 -1);
|
|
|
239 |
}
|
|
|
240 |
|
|
|
241 |
|
|
|
242 |
void ContentDirectory::Internal::maybeStartSomePlugins()
|
|
|
243 |
{
|
|
|
244 |
for (auto& entry : rootdir) {
|
|
|
245 |
string app = appForId(entry.id);
|
|
|
246 |
string sas;
|
|
|
247 |
if (g_config->get(app + "autostart", sas) && stringToBool(sas)) {
|
|
|
248 |
LOGDEB0("ContentDirectory::Internal::maybeStartSomePlugins: "
|
|
|
249 |
"starting " << app << endl);
|
|
|
250 |
CDPlugin *p = pluginForApp(app);
|
|
|
251 |
if (p) {
|
|
|
252 |
p->startInit();
|
|
|
253 |
}
|
|
|
254 |
}
|
|
|
255 |
}
|
235 |
}
|
256 |
}
|
236 |
|
257 |
|
237 |
// Really preposterous: bubble (and maybe others) searches in root,
|
258 |
// Really preposterous: bubble (and maybe others) searches in root,
|
238 |
// but we can't do this. So memorize the last browsed object ID and
|
259 |
// but we can't do this. So memorize the last browsed object ID and
|
239 |
// use this as a replacement when root search is requested. Forget
|
260 |
// use this as a replacement when root search is requested. Forget
|