From d3cfd9721df84b34666c4e0f94b5f8e9c8ba86a3 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 28 Aug 2005 14:18:24 +0200 Subject: [PATCH] Implemented SVDRP command EDIT --- CONTRIBUTORS | 3 +++ HISTORY | 2 ++ svdrp.c | 38 +++++++++++++++++++++++++++++++++++++- svdrp.h | 3 ++- 4 files changed, 44 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index b8a39254..0a9c8ae2 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1453,3 +1453,6 @@ Marcus Hilbrich Hardy Flor for a patch that was used as a base to implement SVDRP commands for plugins for implementing the SVDRP command PLAY + +Harald Milz + for his CUTR patch, which was used as a base to implement the SVDRP command EDIT diff --git a/HISTORY b/HISTORY index 7a5b6ee4..d7d9d1b4 100644 --- a/HISTORY +++ b/HISTORY @@ -3744,3 +3744,5 @@ Video Disk Recorder Revision History See PLUGINS/src/svdrpdemo for an example of how to use this feature. - The new SVDRP command PLAY can be used to start replaying a recording (thanks to Hardy Flor). +- The new SVDRP command EDIT can be used to start the editing process of a recording + (based on the CUTR patch by Harald Milz). diff --git a/svdrp.c b/svdrp.c index 46e317e5..889ffe41 100644 --- a/svdrp.c +++ b/svdrp.c @@ -10,7 +10,7 @@ * and interact with the Video Disk Recorder - or write a full featured * graphical interface that sits on top of an SVDRP connection. * - * $Id: svdrp.c 1.76 2005/08/28 10:32:15 kls Exp $ + * $Id: svdrp.c 1.77 2005/08/28 14:12:00 kls Exp $ */ #include "svdrp.h" @@ -28,6 +28,7 @@ #include #include "channels.h" #include "config.h" +#include "cutter.h" #include "device.h" #include "eitscan.h" #include "keys.h" @@ -195,6 +196,10 @@ const char *HelpPages[] = { " RECORDING - BE SURE YOU KNOW WHAT YOU ARE DOING!", "DELT \n" " Delete timer.", + "EDIT \n" + " Edit the recording with the given number. Before a recording can be\n" + " edited, an LSTR command must have been executed in order to retrieve\n" + " the recording numbers.", "GRAB [ jpeg | pnm [ [ ] ] ]\n" " Grab the current frame and save it to the given file. Images can\n" " be stored as JPEG (default) or PNM, at the given quality (default\n" @@ -607,6 +612,36 @@ void cSVDRP::CmdDELT(const char *Option) Reply(501, "Missing timer number"); } +void cSVDRP::CmdEDIT(const char *Option) +{ + if (*Option) { + if (isnumber(Option)) { + cRecording *recording = Recordings.Get(strtol(Option, NULL, 10) - 1); + if (recording) { + cMarks Marks; + if (Marks.Load(recording->FileName()) && Marks.Count()) { + if (!cCutter::Active()) { + if (cCutter::Start(recording->FileName())) + Reply(250, "Editing recording \"%s\" [%s]", Option, recording->Title()); + else + Reply(554, "Can't start editing process"); + } + else + Reply(554, "Editing process already active"); + } + else + Reply(554, "No editing marks defined"); + } + else + Reply(550, "Recording \"%s\" not found%s", Option, Recordings.Count() ? "" : " (use LSTR before editing)"); + } + else + Reply(501, "Error in recording number \"%s\"", Option); + } + else + Reply(501, "Missing recording number"); +} + void cSVDRP::CmdGRAB(const char *Option) { char *FileName = NULL; @@ -1301,6 +1336,7 @@ void cSVDRP::Execute(char *Cmd) else if (CMD("DELC")) CmdDELC(s); else if (CMD("DELR")) CmdDELR(s); else if (CMD("DELT")) CmdDELT(s); + else if (CMD("EDIT")) CmdEDIT(s); else if (CMD("GRAB")) CmdGRAB(s); else if (CMD("HELP")) CmdHELP(s); else if (CMD("HITK")) CmdHITK(s); diff --git a/svdrp.h b/svdrp.h index 80db28d6..baa4fb33 100644 --- a/svdrp.h +++ b/svdrp.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: svdrp.h 1.22 2005/08/28 09:25:39 kls Exp $ + * $Id: svdrp.h 1.23 2005/08/28 14:10:32 kls Exp $ */ #ifndef __SVDRP_H @@ -58,6 +58,7 @@ private: void CmdDELC(const char *Option); void CmdDELR(const char *Option); void CmdDELT(const char *Option); + void CmdEDIT(const char *Option); void CmdGRAB(const char *Option); void CmdHELP(const char *Option); void CmdHITK(const char *Option);