summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--media/mediaManager.cpp5
-rw-r--r--media/pluginManager.cpp6
-rw-r--r--plugins/provider/recProvider/recProvider.cpp72
-rw-r--r--plugins/provider/vdrProvider/vdrProvider.cpp1
4 files changed, 48 insertions, 36 deletions
diff --git a/media/mediaManager.cpp b/media/mediaManager.cpp
index f5b833f..01fdea7 100644
--- a/media/mediaManager.cpp
+++ b/media/mediaManager.cpp
@@ -235,9 +235,6 @@ StringList cMediaManager::GetSupportedProtocolInfos() const {
for(tntdb::Statement::const_iterator it = stmt.begin(); it != stmt.end(); ++it){
tntdb::Row row = (*it);
-
- cout << row.getString(property::resource::KEY_PROTOCOL_INFO) << endl;
-
list.push_back(row.getString(property::resource::KEY_PROTOCOL_INFO));
}
@@ -378,8 +375,6 @@ int cMediaManager::CreateResponse(MediaRequest& request, const string& select, c
request.result = ixmlDocumenttoString(DIDLDoc);
- cout << request.result << endl;
-
ixmlDocument_free(DIDLDoc);
return UPNP_E_SUCCESS;
}
diff --git a/media/pluginManager.cpp b/media/pluginManager.cpp
index 66cf69d..1a36b4d 100644
--- a/media/pluginManager.cpp
+++ b/media/pluginManager.cpp
@@ -269,7 +269,11 @@ public:
bool cUPnPResourceProvider::GetMetadata(const string& uri, cMetadata& metadata){
metadata.SetObjectIDByUri(uri);
- metadata.SetParentIDByUri(uri.substr(0,uri.find_last_of("/")));
+ if(uri.compare(GetRootContainer()) == 0){
+ metadata.SetProperty(cMetadata::Property(property::object::KEY_PARENTID, string("0")));
+ } else {
+ metadata.SetParentIDByUri(uri.substr(0,uri.find_last_of("/", uri.length()-2)+1));
+ }
metadata.SetProperty(cMetadata::Property(property::object::KEY_TITLE, uri.substr(uri.find_last_of("/")+1)));
metadata.SetProperty(cMetadata::Property(property::object::KEY_CLASS, string("object.container")));
metadata.SetProperty(cMetadata::Property(property::object::KEY_RESTRICTED, true));
diff --git a/plugins/provider/recProvider/recProvider.cpp b/plugins/provider/recProvider/recProvider.cpp
index ec6bca6..3a7d8ce 100644
--- a/plugins/provider/recProvider/recProvider.cpp
+++ b/plugins/provider/recProvider/recProvider.cpp
@@ -48,7 +48,8 @@ private:
public:
RecProvider()
- {}
+ {
+ }
virtual ~RecProvider(){
Cancel(2);
@@ -60,24 +61,27 @@ public:
return ProvidesSchema() + "://";
}
- virtual StringList GetContainerEntries(const string& uri){
- cerr << "Getting container entries for recordings in " << uri << endl;
-
- if(!IsRootContainer(uri)) return StringList();
+ virtual StringList GetContainerEntries(const string& u){
+ if(!IsRootContainer(u)) return StringList();
StringList list;
+ string videoDir(VideoDirectory); string fs, uri = u.substr(6);
+ int pos, vl = videoDir.length(), ul = uri.length(), vul = vl + ul + 1;
- stringstream filename; string recFilename, p;
- filename << VideoDirectory << "/" << uri.substr(6);
for(cRecording* rec = Recordings.First(); rec; rec = Recordings.Next(rec)){
- recFilename = rec->FileName();
- if(recFilename.find(filename.str()) == 0){
- p = recFilename.substr(filename.str().length());
- if(p.find_first_of('/')){
- p = p.substr(0, p.find_first_of('/'));
- list.push_back(p);
+ char* file = strdup(rec->Name());
+ file = ExchangeChars(file, true);
+ fs = file;
+ if(fs.find(uri) != string::npos){
+ fs = fs.substr(ul);
+ if((pos = fs.find_first_of('/')) != string::npos){
+ fs = fs.substr(0, pos+1);
+ } else {
+ fs = string(rec->FileName()).substr(vul);
}
+ list.push_back(fs);
}
+ free(file);
}
return list;
@@ -86,7 +90,10 @@ public:
virtual bool IsContainer(const string& uri){
if(GetRootContainer().compare(uri) == 0) return true;
- if(!Recordings.GetByName(uri.substr(6).c_str())) return true;
+ stringstream filename;
+ filename << VideoDirectory << "/" << uri.substr(6);
+
+ if(!Recordings.GetByName(filename.str().c_str())) return true;
else return false;
}
@@ -96,7 +103,7 @@ public:
virtual long GetContainerUpdateId(const string& uri){
struct stat fileStat;
- if(GetFileStat(uri.substr(0,uri.find_last_of('/')), fileStat)){
+ if(GetFileStat(uri.substr(0,uri.find_last_of('/')+1), fileStat)){
return std::max<time_t>(fileStat.st_ctim.tv_sec, fileStat.st_mtim.tv_sec);
}
@@ -104,25 +111,32 @@ public:
}
virtual bool GetMetadata(const string& uri, cMetadata& metadata){
- if(GetRootContainer().compare(uri) == 0){
- if(!cUPnPResourceProvider::GetMetadata(uri, metadata)) return false;
- metadata.SetProperty(cMetadata::Property(property::object::KEY_PARENTID, string("0")));
- metadata.SetProperty(cMetadata::Property(property::object::KEY_TITLE, string("VDR Recordings")));
+ if(!IsRootContainer(uri)) return false;
- struct passwd *pw;
- if((pw = getpwuid(getuid())) == NULL){
- metadata.SetProperty(cMetadata::Property(property::object::KEY_CREATOR, string("Klaus Schmidinger")));
- } else {
- string name(pw->pw_gecos); name = name.substr(0,name.find(",,,",0));
- metadata.SetProperty(cMetadata::Property(property::object::KEY_CREATOR, name));
- }
+ if(!cUPnPResourceProvider::GetMetadata(uri, metadata)) return false;
+ if(GetRootContainer().compare(uri) == 0){
+ metadata.SetProperty(cMetadata::Property(property::object::KEY_TITLE, string("VDR Recordings")));
metadata.SetProperty(cMetadata::Property(property::object::KEY_DESCRIPTION, string("Watch TV recordings")));
- return true;
+ } else {
+ int ul = uri.length();
+ string folder = uri.substr(uri.find_last_of('/', ul-2)+1, ul - 7);
+ char * str = strdup(folder.c_str());
+ str = ExchangeChars(str, false);
+ metadata.SetProperty(cMetadata::Property(property::object::KEY_TITLE, string(str)));
+ free(str);
}
- return false;
+ struct passwd *pw;
+ if((pw = getpwuid(getuid())) == NULL){
+ metadata.SetProperty(cMetadata::Property(property::object::KEY_CREATOR, string("Klaus Schmidinger")));
+ } else {
+ string name(pw->pw_gecos); name = name.substr(0,name.find(",,,",0));
+ metadata.SetProperty(cMetadata::Property(property::object::KEY_CREATOR, name));
+ }
+
+ return true;
}
virtual void Action(){
@@ -131,7 +145,7 @@ public:
if(Recordings.NeedsUpdate() || Recordings.StateChanged(state)){
OnContainerUpdate(GetRootContainer(), GetContainerUpdateId(GetRootContainer()));
}
- sleep(5);
+ sleep(10);
}
}
diff --git a/plugins/provider/vdrProvider/vdrProvider.cpp b/plugins/provider/vdrProvider/vdrProvider.cpp
index 4e765bf..9f14aa3 100644
--- a/plugins/provider/vdrProvider/vdrProvider.cpp
+++ b/plugins/provider/vdrProvider/vdrProvider.cpp
@@ -89,7 +89,6 @@ public:
if(!cUPnPResourceProvider::GetMetadata(uri, metadata)) return false;
- metadata.SetProperty(cMetadata::Property(property::object::KEY_PARENTID, string("0")));
metadata.SetProperty(cMetadata::Property(property::object::KEY_TITLE, string("VDR Live-TV")));
metadata.SetProperty(cMetadata::Property("dlna:containerType", string("Tuner_1_0")));