diff options
-rw-r--r-- | vdr-vdrmanager/handler.cpp | 4 | ||||
-rw-r--r-- | vdr-vdrmanager/helpers.cpp | 40 | ||||
-rw-r--r-- | vdr-vdrmanager/helpers.h | 2 |
3 files changed, 42 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; } diff --git a/vdr-vdrmanager/helpers.h b/vdr-vdrmanager/helpers.h index b5cd08e..4da5cca 100644 --- a/vdr-vdrmanager/helpers.h +++ b/vdr-vdrmanager/helpers.h @@ -16,6 +16,7 @@ public: static string GetChannelEvents(string args); static string GetTimeEvents(string args); static string GetRecordings(string args); + static string DelRecording(string args); static string SetTimer(string args); static string SearchEvents(string args); static string ToUpper(string text); @@ -29,6 +30,7 @@ private: static string GetRecordingsIntern(); static string GetChannelsIntern(string wantedChannels); static string GetEventsIntern(string wantedChannels, string when); + static string DelRecordingIntern(string index); static string SetTimerIntern(string args); static string SearchEventsIntern(string wantedChannels, string pattern); static bool IsWantedEvent(cEvent * event, string pattern); |