CASPAR_LOG(error) << L" ### Invalid configuration file. ###";\r
throw;\r
}\r
+\r
+ try\r
+ {\r
+ auto media_path = boost::filesystem::wpath(media);\r
+ if(!boost::filesystem::exists(media_path))\r
+ boost::filesystem::create_directory(media_path);\r
+ \r
+ auto log_path = boost::filesystem::wpath(log);\r
+ if(!boost::filesystem::exists(log_path))\r
+ boost::filesystem::create_directory(log_path);\r
+ \r
+ auto template_path = boost::filesystem::wpath(ftemplate);\r
+ if(!boost::filesystem::exists(template_path))\r
+ boost::filesystem::create_directory(template_path);\r
+ \r
+ auto data_path = boost::filesystem::wpath(data);\r
+ if(!boost::filesystem::exists(data_path))\r
+ boost::filesystem::create_directory(data_path);\r
+ }\r
+ catch(...)\r
+ {\r
+ CASPAR_LOG_CURRENT_EXCEPTION();\r
+ CASPAR_LOG(error) << L"Failed to create configured directories.";\r
+ }\r
}\r
\r
const std::wstring& media_folder()\r
#pragma once\r
\r
#include <common/memory/safe_ptr.h>\r
+#include <common/exception/exceptions.h>\r
\r
#include <boost/noncopyable.hpp>\r
\r
\r
virtual boost::unique_future<std::wstring> call(const std::wstring&) \r
{\r
- boost::promise<std::wstring> promise;\r
- promise.set_value(L"");\r
- return promise.get_future();\r
+ BOOST_THROW_EXCEPTION(not_supported());\r
}\r
\r
virtual safe_ptr<frame_producer> get_following_producer() const {return frame_producer::empty();} // nothrow\r
\r
info.add(L"nb_frames", nb_frames == std::numeric_limits<int64_t>::max() ? -1 : nb_frames);\r
info.add(L"frames-left", nb_frames == std::numeric_limits<int64_t>::max() ? -1 : (foreground_->nb_frames() - frame_number_ - auto_play_delta_));\r
- info.add_child(L"foreground", foreground_->info());\r
- info.add_child(L"background", background_->info());\r
+ info.add_child(L"foreground.producer", foreground_->info());\r
+ info.add_child(L"background.producer", background_->info());\r
return info;\r
}\r
};\r
\r
std::wstring do_call(const std::wstring& param)\r
{\r
- static const boost::wregex loop_exp(L"LOOP\\s*(?<VALUE>\\d?)", boost::regex::icase);\r
+ static const boost::wregex loop_exp(L"LOOP\\s*(?<VALUE>\\d?)?", boost::regex::icase);\r
static const boost::wregex seek_exp(L"SEEK\\s+(?<VALUE>\\d+)", boost::regex::icase);\r
\r
boost::wsmatch what;\r
try\r
{\r
if(pCurrentCommand->Execute()) \r
- CASPAR_LOG(info) << "Executed command: " << pCurrentCommand->print();\r
+ CASPAR_LOG(trace) << "Executed command: " << pCurrentCommand->print();\r
else \r
- CASPAR_LOG(info) << "Failed to execute command: " << pCurrentCommand->print();\r
+ CASPAR_LOG(warning) << "Failed to execute command: " << pCurrentCommand->print();\r
}\r
catch(...)\r
{\r
CASPAR_LOG_CURRENT_EXCEPTION();\r
- CASPAR_LOG(info) << "Failed to execute command:" << pCurrentCommand->print();\r
+ CASPAR_LOG(error) << "Failed to execute command:" << pCurrentCommand->print();\r
}\r
\r
pCurrentCommand->SendReply();\r
\r
- CASPAR_LOG(info) << "Ready for a new command";\r
+ CASPAR_LOG(trace) << "Ready for a new command";\r
}\r
catch(...)\r
{\r
try\r
{\r
auto what = _parameters.at(0);\r
-\r
- std::wstring param = _parameters2.at(1);\r
- for(auto it = std::begin(_parameters2)+2; it != std::end(_parameters2); ++it)\r
- param += L" " + *it;\r
- \r
+ \r
boost::unique_future<std::wstring> result;\r
- if(what == L"B")\r
- result = GetChannel()->stage()->call(GetLayerIndex(), false, param);\r
- else if(what == L"F")\r
- result = GetChannel()->stage()->call(GetLayerIndex(), true, param);\r
+ if(what == L"B" || what == L"F")\r
+ {\r
+ std::wstring param;\r
+ for(auto it = std::begin(_parameters2)+1; it != std::end(_parameters2); ++it, param += L" ")\r
+ param += *it;\r
+ result = GetChannel()->stage()->call(GetLayerIndex(), what == L"F", boost::trim_copy(param));\r
+ }\r
else\r
- result = GetChannel()->stage()->call(GetLayerIndex(), true, _parameters.at(0) + L" " + param);\r
- \r
+ {\r
+ std::wstring param;\r
+ for(auto it = std::begin(_parameters2); it != std::end(_parameters2); ++it, param += L" ")\r
+ param += *it;\r
+ result = GetChannel()->stage()->call(GetLayerIndex(), true, boost::trim_copy(param));\r
+ }\r
+\r
if(!result.timed_wait(boost::posix_time::seconds(2)))\r
BOOST_THROW_EXCEPTION(timed_out());\r
\r
bool DoExecute();\r
};\r
\r
-class CallCommand : public AMCPCommandBase<true, AddToQueue, 2>\r
+class CallCommand : public AMCPCommandBase<true, AddToQueue, 1>\r
{\r
std::wstring print() const { return L"CallCommand";}\r
bool DoExecute();\r
AMCPCommandPtr pCommand;\r
MessageParserState state = New;\r
\r
- CASPAR_LOG(info) << message;\r
+ CASPAR_LOG(info) << L"Received: " << message;\r
\r
std::size_t tokensInMessage = TokenizeMessage(message, &tokens);\r
\r
}\r
else {\r
if(sentBytes == bytesToSend) {\r
- if(sentBytes < 200)\r
- CASPAR_LOG(info) << "Sent " << socketInfo.sendQueue_.front().c_str() << TEXT(" to ") << socketInfo.host_.c_str();\r
+ if(sentBytes < 512)\r
+ CASPAR_LOG(info) << "Sent: " << socketInfo.sendQueue_.front().c_str() << TEXT(" to ") << socketInfo.host_.c_str();\r
else\r
- CASPAR_LOG(info) << "Sent more than 200 bytes to " << socketInfo.host_.c_str();\r
+ CASPAR_LOG(info) << "Sent more than 512 bytes to " << socketInfo.host_.c_str();\r
\r
socketInfo.currentlySending_.resize(0);\r
socketInfo.currentlySendingOffset_ = 0;\r