Implemented SVDRP command EDIT

This commit is contained in:
Klaus Schmidinger 2005-08-28 14:18:24 +02:00
parent 7f8d96c1af
commit d3cfd9721d
4 changed files with 44 additions and 2 deletions

View File

@ -1453,3 +1453,6 @@ Marcus Hilbrich <s4440288@mail.inf.tu-dresden.de>
Hardy Flor <HFlor@web.de>
for a patch that was used as a base to implement SVDRP commands for plugins
for implementing the SVDRP command PLAY
Harald Milz <hm@seneca.muc.de>
for his CUTR patch, which was used as a base to implement the SVDRP command EDIT

View File

@ -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).

38
svdrp.c
View File

@ -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 <unistd.h>
#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 <number>\n"
" Delete timer.",
"EDIT <number>\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 <filename> [ jpeg | pnm [ <quality> [ <sizex> <sizey> ] ] ]\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);

View File

@ -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);