diff options
-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; } |