]> git.vomp.tv Git - vompserver.git/commitdiff
Add protocol command to reset recording resume point
authorChris Tallon <chris@vomp.tv>
Sun, 29 Sep 2019 15:32:17 +0000 (16:32 +0100)
committerChris Tallon <chris@vomp.tv>
Sun, 29 Sep 2019 15:32:17 +0000 (16:32 +0100)
vdrcommand.h
vompclientrrproc.c
vompclientrrproc.h

index c9e4032d6307532fda14f5c988c438aa0f9f3f57..fb37ead6fb831cfe8772731ca649c42b25de288c 100644 (file)
@@ -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;
index eff80c6d2631df2137dba4ee207c9ff592dd2eaf..524da47a5a34b7bad1a46ece1063b2f73a139977 100644 (file)
@@ -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");
index 1c0fb6b40d259c7cfa37269d46c234be72965cce..3087c71cfe5e1370a010691247371b2c021a36ea 100644 (file)
@@ -65,6 +65,7 @@ class VompClientRRProc : public Thread
 #ifndef VOMPSTANDALONE
     int processGetRecordingsList();
     int processDeleteRecording();
+    int processDeleteRecResume();
     int processMoveRecording();
     int processGetChannelsList();
     int processStartStreamingChannel();