[vdr] CUTR patch for vdr-1.3.27

Harald Milz hm at seneca.muc.de
Tue Jul 5 08:13:03 CEST 2005


Hi,

I recently upgraded my main vdr to 1.3.27 and applied my CUTR patch... feel
free to use and comment :-) 


diff -ur vdr-1.3.27/svdrp.c vdr-1.3.27-CUTR/svdrp.c
--- vdr-1.3.27/svdrp.c	2005-05-26 11:59:09.000000000 +0200
+++ vdr-1.3.27-CUTR/svdrp.c	2005-07-03 10:25:58.304310180 +0200
@@ -36,6 +36,7 @@
 #include "timers.h"
 #include "tools.h"
 #include "videodir.h"
+#include "cutter.h"
 
 // --- cSocket ---------------------------------------------------------------
 
@@ -184,6 +185,10 @@
   "    it returns the current channel number and name.",
   "CLRE\n"
   "    Clear the entire EPG list.",
+  "CUTR <number>\n"
+  "    Cut the numbered recording. Before a recording can be\n"
+  "    cut, an LSTR command must have been executed in order to retrieve\n"
+  "    the recording numbers."
   "DELC <number>\n"
   "    Delete channel.",
   "DELR <number>\n"
@@ -466,6 +471,31 @@
      Reply(550, "Unable to find channel \"%d\"", cDevice::CurrentChannel());
 }
 
+void cSVDRP::CmdCUTR(const char *Option)
+{
+  if (*Option) {
+     if (isnumber(Option)) {
+        cRecording *recording = Recordings.Get(strtol(Option, NULL, 10) - 1);
+        if (recording) {
+           if (cCutter::Start(recording->FileName())) {
+              Reply(250, "Cutting recording \"%s\"", recording->FileName());
+              ::Recordings.Load(); // must make sure the global recordings list is updated
+              }
+           else
+              Reply(554, "Error while cutting recording!");
+           }
+        else
+           Reply(550, "Recording \"%s\" not found%s", recording->FileName(), Recordings.Count() ? "" : " (use LSTR before cutting)");
+        }
+     else
+        Reply(501, "Error in recording number \"%s\"", Option);
+     }
+  else
+     Reply(501, "Missing recording number");
+}
+
+
+
 void cSVDRP::CmdCLRE(const char *Option)
 {
   cSchedules::ClearAll();
@@ -1122,6 +1152,7 @@
   s = skipspace(s);
   if      (CMD("CHAN"))  CmdCHAN(s);
   else if (CMD("CLRE"))  CmdCLRE(s);
+  else if (CMD("CUTR"))  CmdCUTR(s);
   else if (CMD("DELC"))  CmdDELC(s);
   else if (CMD("DELR"))  CmdDELR(s);
   else if (CMD("DELT"))  CmdDELT(s);
diff -ur vdr-1.3.27/svdrp.h vdr-1.3.27-CUTR/svdrp.h
--- vdr-1.3.27/svdrp.h	2004-01-17 14:30:52.000000000 +0100
+++ vdr-1.3.27-CUTR/svdrp.h	2005-07-03 10:25:58.305310034 +0200
@@ -54,6 +54,7 @@
   void Reply(int Code, const char *fmt, ...);
   void CmdCHAN(const char *Option);
   void CmdCLRE(const char *Option);
+  void CmdCUTR(const char *Option);
   void CmdDELC(const char *Option);
   void CmdDELR(const char *Option);
   void CmdDELT(const char *Option);

-- 
Under a government which imprisons any unjustly, the true place for a
just man is also in prison.
		-- Henry David Thoreau



More information about the vdr mailing list