From 0b987ba5cbf259c9ec639e36cefcaac91096977a Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 29 Sep 2019 16:32:17 +0100 Subject: [PATCH] Add protocol command to reset recording resume point --- vdrcommand.h | 1 + vompclientrrproc.c | 51 ++++++++++++++++++++++++++++++++++++++++++++-- vompclientrrproc.h | 1 + 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/vdrcommand.h b/vdrcommand.h index c9e4032..fb37ead 100644 --- a/vdrcommand.h +++ b/vdrcommand.h @@ -42,6 +42,7 @@ const static ULONG VDR_RESPONSE_FLAG =0x1000000; const static ULONG VDR_LOGIN = 1; const static ULONG VDR_GETRECORDINGLIST = 2; const static ULONG VDR_DELETERECORDING = 3; +const static ULONG VDR_DELETERECRESUME = 4; const static ULONG VDR_GETCHANNELLIST = 5; const static ULONG VDR_STREAMCHANNEL = 6; const static ULONG VDR_GETBLOCK = 7; diff --git a/vompclientrrproc.c b/vompclientrrproc.c index eff80c6..524da47 100644 --- a/vompclientrrproc.c +++ b/vompclientrrproc.c @@ -45,8 +45,8 @@ bool ResumeIDLock; -ULONG VompClientRRProc::VOMP_PROTOCOL_VERSION_MIN = 0x00000301; -ULONG VompClientRRProc::VOMP_PROTOCOL_VERSION_MAX = 0x00000400; +ULONG VompClientRRProc::VOMP_PROTOCOL_VERSION_MIN = 0x00000302; +ULONG VompClientRRProc::VOMP_PROTOCOL_VERSION_MAX = 0x00000401; // format is aabbccdd // cc is release protocol version, increase with every release, that changes protocol // dd is development protocol version, set to zero at every release, @@ -246,6 +246,9 @@ bool VompClientRRProc::processPacket() case 3: result = processDeleteRecording(); break; + case 4: + result = processDeleteRecResume(); + break; case 5: result = processGetChannelsList(); break; @@ -834,6 +837,50 @@ int VompClientRRProc::processDeleteRecording() return 1; } +int VompClientRRProc::processDeleteRecResume() +{ + // data is a pointer to the fileName string + +#if VDRVERSNUM < 20301 + resp->addULONG(5); // Not supported + resp->finalise(); + x.tcp.sendPacket(resp->getPtr(), resp->getLen()); + return 1; +#endif + + cStateKey StateKey; + const cRecordings* Recordings = cRecordings::GetRecordingsRead(StateKey); + const cRecording* recording = Recordings->GetByName((char*)req->data); + + if (recording) + { + log->log("RRProc", Log::DEBUG, "deleting recording resume : %s", recording->Name()); + + cResumeFile ResumeFile(recording->FileName(), recording->IsPesRecording()); + StateKey.Remove(); + + if (ResumeFile.Read() >= 0) + { + ResumeFile.Delete(); + resp->addULONG(1); // success + } + else + { + resp->addULONG(2); // failed, no resume point saved + } + } + else + { + StateKey.Remove(); + resp->addULONG(4); // failed to find recording + } + + resp->finalise(); + x.tcp.sendPacket(resp->getPtr(), resp->getLen()); + + return 1; +} + int VompClientRRProc::processMoveRecording() { log->log("RRProc", Log::DEBUG, "Process move recording"); diff --git a/vompclientrrproc.h b/vompclientrrproc.h index 1c0fb6b..3087c71 100644 --- a/vompclientrrproc.h +++ b/vompclientrrproc.h @@ -65,6 +65,7 @@ class VompClientRRProc : public Thread #ifndef VOMPSTANDALONE int processGetRecordingsList(); int processDeleteRecording(); + int processDeleteRecResume(); int processMoveRecording(); int processGetChannelsList(); int processStartStreamingChannel(); -- 2.39.2