--- a/src/mediaserver/contentdirectory.cxx
+++ b/src/mediaserver/contentdirectory.cxx
@@ -43,14 +43,15 @@
class ContentDirectory::Internal {
public:
- Internal (ContentDirectory *sv)
- : service(sv), updateID("1") {
- }
+ Internal (ContentDirectory *sv, MediaServer *dv)
+ : service(sv), msdev(dv), updateID("1") { }
+
~Internal() {
for (auto& it : plugins) {
delete it.second;
}
}
+
// Start plugins which have long init so that the user has less to
// wait on first access
void maybeStartSomePlugins();
@@ -85,8 +86,10 @@
return plug;
}
}
+
+ ContentDirectory *service;
+ MediaServer *msdev;
unordered_map<string, CDPlugin *> plugins;
- ContentDirectory *service;
string host;
int port;
string updateID;
@@ -97,9 +100,9 @@
static const string
sIdContentDirectory("urn:upnp-org:serviceId:ContentDirectory");
-ContentDirectory::ContentDirectory(UPnPProvider::UpnpDevice *dev)
+ContentDirectory::ContentDirectory(MediaServer *dev)
: UpnpService(sTpContentDirectory, sIdContentDirectory, dev),
- m(new Internal(this))
+ m(new Internal(this, dev))
{
dev->addActionMapping(
this, "GetSearchCapabilities",
@@ -523,16 +526,17 @@
return true;
}
-
-ConfSimple *ContentDirectory::getconfig(CDPlugin *)
-{
- return g_config;
-}
-
-
-std::string ContentDirectory::getexecpath(CDPlugin *plg)
-{
- string pth = path_cat(g_datadir, "cdplugins");
- pth = path_cat(pth, plg->getname());
- return path_cat(pth, plg->getname() + "-app" + ".py");
-}
+bool ContentDirectory::config_get(const string& nm, string& val)
+{
+ if (nullptr == g_config) {
+ return false;
+ }
+ std::unique_lock<std::mutex>(g_configlock);
+ return g_config->get(nm, val);
+}
+
+std::string ContentDirectory::getfname()
+{
+ return m->msdev->getfname();
+}
+