summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/media/mediaManager.h12
-rw-r--r--include/plugin.h32
-rw-r--r--include/pluginManager.h5
-rw-r--r--include/server.h2
4 files changed, 41 insertions, 10 deletions
diff --git a/include/media/mediaManager.h b/include/media/mediaManager.h
index c9e042d..9c5b9a1 100644
--- a/include/media/mediaManager.h
+++ b/include/media/mediaManager.h
@@ -15,14 +15,15 @@
#include <list>
#include <string>
#include <stdint.h>
-#include <tntdb/connection.h>
#include <tntdb/connect.h>
+#include <tntdb/connection.h>
namespace upnp {
class cResourceStreamer;
class cMediaManager : public cThread {
+ friend void cUPnPResourceProvider::OnContainerUpdate(const string& uri, long updateID, const string& target = string());
private:
struct MediaRequest {
@@ -81,13 +82,18 @@ private:
int CreateResponse(MediaRequest&, const string&, const string&);
- void OnContainerUpdate(string uri, long updateID);
+ void OnContainerUpdate(const string& uri, long updateID, const string& target);
+ bool UpdateContainerUpdateId(const string& objectID, long updateID);
+
+ bool ScanURI(const string& uri, cUPnPResourceProvider* provider);
+
+ bool RefreshObject(const cMetadata& metadata);
cUPnPResourceProvider* CreateResourceProvider(const std::string& uri);
uint32_t systemUpdateID;
IdList eventedContainerUpdateIDs;
- StringList scanDirectories;
+ StringList scanTargets;
string databaseFile;
string pluginDirectory;
tntdb::Connection connection;
diff --git a/include/plugin.h b/include/plugin.h
index cd24e91..c8abd57 100644
--- a/include/plugin.h
+++ b/include/plugin.h
@@ -12,6 +12,8 @@
#include <map>
#include <list>
#include <stdint.h>
+#include <vdr/thread.h>
+#include "../include/tools.h"
using namespace std;
@@ -116,6 +118,10 @@ public:
long GetInteger() const;
bool GetBoolean() const;
+ bool IsEmpty() { return key.empty() && value.empty(); }
+
+ static Property Empty;
+
private:
string key;
string value;
@@ -186,6 +192,8 @@ public:
bool SetObjectIDByUri(const string& uri);
bool SetParentIDByUri(const string& uri);
+ string ToString();
+
private:
PropertyMap properties;
@@ -201,11 +209,10 @@ public:
#define UPNP_REGISTER_RESOURCE_PROVIDER(cls) extern "C" void *UPnPCreateResourceProvider(void) { return new cls; }
-class cUPnPResourceProvider {
+class cUPnPResourceProvider : public cThread {
+ friend class cMediaManager;
public:
- typedef list<string> EntryList;
-
virtual ~cUPnPResourceProvider(){};
/**
@@ -257,7 +264,7 @@ public:
*
* The given URI is an absolute URI.
*/
- virtual EntryList GetContainerEntries(const string& uri) = 0;
+ virtual StringList GetContainerEntries(const string& uri) = 0;
/**
* Checks if the given URI is a container.
@@ -445,8 +452,23 @@ protected:
* was moved from
* - change of the parent container, where the file or container
* was moved to
+ *
+ * The optional target must be an element inside the container
+ * specified in the URI. If the target is not empty, only this
+ * element will be checked for changes. Otherwise the full container
+ * is scanned.
+ */
+ void OnContainerUpdate(const string& uri, long containerUpdateId, const string& target = string());
+
+ /**
+ * Thread action to check for updates
+ *
+ * This should be used to determine changes on the containers. It should
+ * be overridden by the implementor. However, it is not required and
+ * therefore empty by default.
+ *
*/
- void OnContainerUpdate(const string& uri, long containerUpdateId, const string& changesUri = string());
+ virtual void Action();
};
diff --git a/include/pluginManager.h b/include/pluginManager.h
index 8520b01..563d4fb 100644
--- a/include/pluginManager.h
+++ b/include/pluginManager.h
@@ -20,6 +20,7 @@ class cPluginManager {
public:
typedef std::list< boost::shared_ptr<cMediaProfiler> > ProfilerList;
+ typedef std::list< boost::shared_ptr<cUPnPResourceProvider> > ProviderList;
cPluginManager();
virtual ~cPluginManager();
@@ -29,6 +30,7 @@ public:
int Count() const;
const ProfilerList& GetProfilers() const;
+ const ProviderList& GetProviders() const;
cUPnPResourceProvider* CreateProvider(const string& schema);
private:
@@ -59,8 +61,9 @@ private:
typedef std::map<string, ResourceProviderFuncPtr > ProviderMap;
DLLList dlls;
- ProviderMap providers;
+ ProviderMap providerFactory;
ProfilerList profilers;
+ ProviderList providers;
};
diff --git a/include/server.h b/include/server.h
index 3f24725..48e85a9 100644
--- a/include/server.h
+++ b/include/server.h
@@ -10,9 +10,9 @@
#include <string>
#include <upnp/upnp.h>
-#include "../include/webserver.h"
#include "../include/config.h"
#include "../include/service.h"
+#include "../include/webserver.h"
using namespace std;