]> git.sesse.net Git - casparcg/commitdiff
Manually merged f97b5779e4d44205f49ef090ac23c7f0783e4793 from master
authorHelge Norberg <helge.norberg@svt.se>
Tue, 9 Apr 2013 08:41:17 +0000 (10:41 +0200)
committerHelge Norberg <helge.norberg@svt.se>
Tue, 9 Apr 2013 08:41:17 +0000 (10:41 +0200)
CHANGES.txt
README.txt
protocol/amcp/AMCPCommandsImpl.cpp
protocol/amcp/AMCPCommandsImpl.h

index 6fa95c1b09e51f334cf9c67f820bfffb29c5dce4..65e6626261f7238777c346953f43e2b5e3d90bdd 100644 (file)
@@ -79,6 +79,13 @@ Producers
     + Added support for motion blur via a new BLUR parameter\r
     + Added PREMULTIPLY parameter to support images stored with straight alpha.\r
 \r
+AMCP\r
+----\r
+\r
+  o DATA STORE now supports creating folders of path specified if they does not\r
+    exist.\r
+  o DATA REMOVE command was added.\r
+\r
 CasparCG 2.0 Stable (w.r.t Beta 3)\r
 ==================================\r
 \r
index 273ea31ccae541c0d235b42454bef84cf8c81cb2..1ecf51bb0639c6cdcedbc7ed04910888cc63c1ae 100644 (file)
@@ -230,3 +230,4 @@ Robert      Nagy            (robert.nagy@dfindredpatch.se, ronag89@gmail.com)
 Helge   Norberg         (helge.norberg@svt.se)\r
 Thomas  R. Kaltz III\r
 Olle    Soprani\r
+Jeff    ?\r
index 49551c08c9894f09a37ec8cabc074052bb6cba41..bc076816a35eb25efd57d03b9b8c039d23b608b4 100644 (file)
@@ -1277,6 +1277,8 @@ bool DataCommand::DoExecute()
                return DoExecuteStore();
        else if(command == TEXT("RETRIEVE"))
                return DoExecuteRetrieve();
+       else if(command == TEXT("REMOVE"))
+               return DoExecuteRemove();
        else if(command == TEXT("LIST"))
                return DoExecuteList();
 
@@ -1296,6 +1298,12 @@ bool DataCommand::DoExecuteStore()
        filename.append(_parameters[1]);
        filename.append(TEXT(".ftd"));
 
+       auto data_path = boost::filesystem::wpath(
+               boost::filesystem::wpath(filename).parent_path());
+
+       if(!boost::filesystem::exists(data_path))
+               boost::filesystem::create_directories(data_path);
+
        std::wofstream datafile(filename.c_str());
        if(!datafile) 
        {
@@ -1340,6 +1348,35 @@ bool DataCommand::DoExecuteRetrieve()
        return true;
 }
 
+bool DataCommand::DoExecuteRemove()
+{ 
+       if (_parameters.size() < 2)
+       {
+               SetReplyString(TEXT("402 DATA REMOVE ERROR\r\n"));
+               return false;
+       }
+
+       std::wstring filename = env::data_folder();
+       filename.append(_parameters[1]);
+       filename.append(TEXT(".ftd"));
+
+       if (!boost::filesystem::exists(filename))
+       {
+               SetReplyString(TEXT("404 DATA REMOVE ERROR\r\n"));
+               return false;
+       }
+
+       if (!boost::filesystem::remove(filename))
+       {
+               SetReplyString(TEXT("403 DATA REMOVE ERROR\r\n"));
+               return false;
+       }
+
+       SetReplyString(TEXT("201 DATA REMOVE OK\r\n"));
+
+       return true;
+}
+
 bool DataCommand::DoExecuteList() 
 {
        std::wstringstream replyString;
index 429c7cd821c8c64b694c6801b21e6bbec8090998..87b29640816307b0b62cf12be70af945ff8b6bdf 100644 (file)
@@ -145,6 +145,7 @@ class DataCommand : public AMCPCommandBase<false, 1>
        bool DoExecute();
        bool DoExecuteStore();
        bool DoExecuteRetrieve();
+       bool DoExecuteRemove();
        bool DoExecuteList();
 };