From 7c5e5dac8eba1e6132582f7ff549fd04dc877ce1 Mon Sep 17 00:00:00 2001 From: methodus Date: Mon, 10 Dec 2012 20:49:53 +0100 Subject: Ignoring signal SIGPIPE which might cause crashes --- media/pluginManager.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'media/pluginManager.cpp') diff --git a/media/pluginManager.cpp b/media/pluginManager.cpp index cd31be3..5f38aa8 100644 --- a/media/pluginManager.cpp +++ b/media/pluginManager.cpp @@ -11,6 +11,7 @@ #include "../include/tools/string.h" #include "../include/tools/uuid.h" #include +#include #include #include #include @@ -286,6 +287,10 @@ string cUPnPResourceProvider::GetHTTPUri(const string&, const string&, const str return string(); } +string cUPnPResourceProvider::GetFile(const string& uri){ + return uri; +} + bool cUPnPResourceProvider::Seekable() const { return false; } @@ -309,6 +314,42 @@ void cUPnPResourceProvider::OnContainerUpdate(const string& uri, long int cUID, cMediaServer::GetInstance()->GetManager().OnContainerUpdate(uri, cUID, target); } +bool cUPnPResourceProvider::HasRootContainer(const string& uri){ + if(uri.find(GetRootContainer(), 0) != 0){ + isyslog("RecProvider\tUri does not contain the root."); + return false; + } else { + return true; + } +} + +bool cUPnPResourceProvider::Parse(const string& line){ + return true; +} + +bool cUPnPResourceProvider::LoadConfigFile(const string& fn, bool allowComments) +{ + string filename = cMediaServer::GetInstance()->GetConfigDirectory() + "/" + fn; + if (access(filename.c_str(), F_OK) == 0) { + isyslog("loading %s", filename.c_str()); + ifstream file; + file.open(filename.c_str(), ifstream::in); + if(!file.is_open()) + return false; + string line; + while(getline(file, line)){ + if(line.length() > 0){ + if(allowComments && line[0] == '#') + continue; + if(!Parse(line)) + return false; + } + } + return true; + } + return false; +} + void cUPnPResourceProvider::Action(){} upnp::cPluginManager::cPluginManager() -- cgit v1.2.3