CUTR patch for vdr-1.3.27
Commit Message
Hi,
I recently upgraded my main vdr to 1.3.27 and applied my CUTR patch... feel
free to use and comment :-)
@@ -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);
@@ -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);