diff options
author | lado <herrlado@gmail.com> | 2011-10-20 14:39:12 +0200 |
---|---|---|
committer | lado <herrlado@gmail.com> | 2011-10-20 14:39:12 +0200 |
commit | 437f9d29198fd7160ef7ed23eb782a5bc4a54da0 (patch) | |
tree | fd6218b25b321aaeb8f42b058035b6a785d64ca3 | |
parent | d9bd167fe3f2c7ba17056f1b2cec0c9af6b5bcf1 (diff) | |
download | vdr-manager-437f9d29198fd7160ef7ed23eb782a5bc4a54da0.tar.gz vdr-manager-437f9d29198fd7160ef7ed23eb782a5bc4a54da0.tar.bz2 |
added support for deleting a recording
-rw-r--r-- | vdr-vdrmanager/handler.cpp | 4 | ||||
-rw-r--r-- | vdr-vdrmanager/helpers.cpp | 40 |
2 files changed, 40 insertions, 4 deletions
diff --git a/vdr-vdrmanager/handler.cpp b/vdr-vdrmanager/handler.cpp index 8729cf0..5012b5f 100644 --- a/vdr-vdrmanager/handler.cpp +++ b/vdr-vdrmanager/handler.cpp @@ -84,6 +84,10 @@ bool cHandler::HandleClientRequest(cVdrmanagerClientSocket * sock) string text = cHelpers::GetRecordings(args); sock->PutLine(text); } + else if(cmd == "DRECORDING"){ + string text = cHelpers::DelRecording(args); + sock->PutLine(text); + } else if (cmd == "QUIT") { // close socket diff --git a/vdr-vdrmanager/helpers.cpp b/vdr-vdrmanager/helpers.cpp index 1b7b548..7a4ec47 100644 --- a/vdr-vdrmanager/helpers.cpp +++ b/vdr-vdrmanager/helpers.cpp @@ -50,6 +50,10 @@ string cHelpers::SetTimer(string args) { return SafeCall(SetTimerIntern, args); } +string cHelpers::DelRecording(string args) { + return SafeCall(DelRecordingIntern, args); +} + string cHelpers::SearchEvents(string args) { args = Trim(args); @@ -172,6 +176,23 @@ string cHelpers::GetEventsIntern(string wantedChannels, string when) { return result + "END\r\n"; } +string cHelpers::DelRecordingIntern(string args) { + + if(args.size() == 0){ + return "!ERROR:DelRecording;empty args\r\n"; + } + + int index = atoi(args.c_str()); + + cRecording * r = Recordings.Get(index); + + if(!r){ + return "!ERROR:DelRecording;Wrong recording index -> "+args+"\r\n"; + } + Recordings.DelByName(r->FileName()); + return "START\r\nEND\r\n"; +} + string cHelpers::SetTimerIntern(string args) { // separete timer number @@ -288,25 +309,36 @@ string cHelpers::ToText(cRecording * recording){ time_t startTime = event->StartTime(); time_t endTime = event->EndTime(); + + sprintf(buf, "%d", recording->Index()); + result = buf; + result += ":"; sprintf(buf, "%lu", startTime); result += buf; result += ":"; + sprintf(buf, "%lu", endTime); result += buf; result += ":"; - sprintf(buf, "%d", DirSizeMB(recording->FileName())); - result += buf; - result += ":"; + result += info -> ChannelName(); result += ":"; + result += MapSpecialChars(event->Title()); result += ":"; + result += MapSpecialChars(event->ShortText() ? event->ShortText() : ""); result += ":"; + result += MapSpecialChars(event->Description() ? event->Description() : ""); result += ":"; - result += recording->FileName(); + + result += MapSpecialChars(recording->FileName()); + result += ":"; + + sprintf(buf, "%d", DirSizeMB(recording->FileName())); + result += buf; result += "\r\n"; return result; } |