Extended the interface to the script that gets called for recordings, so that in the "edited" case it also provides the name of the original recording

This commit is contained in:
Klaus Schmidinger 2012-06-02 13:57:41 +02:00
parent ebf8a285b2
commit 78e11d8c6f
6 changed files with 26 additions and 13 deletions

View File

@ -2891,3 +2891,7 @@ Michael Schneider <vdrportal_midas@gmx.de>
Marco Skambraks <marco@ammec.de>
for fixing resetting CAMs
Christian Richter <cr@crichter.net>
for extending the interface to the script that gets called for recordings, so that in
the "edited" case it also provides the name of the original recording

View File

@ -7139,3 +7139,6 @@ Video Disk Recorder Revision History
and LEGACY_CRECEIVER.
- Now making sure that the "small font" is never larger than the "osd font".
- Fixed font handling with fontconfig 2.9.0 or newer (thanks to Joerg Bornkessel).
- Extended the interface to the script that gets called for recordings, so that in
the "edited" case it also provides the name of the original recording (thanks to
Christian Richter).

View File

@ -235,8 +235,8 @@ You can use the '-r' option to define a program or script that gets called
before and after a recording is performed, and after an editing process
has finished.
The program will be called with two string parameters. The first parameter
is one of
The program will be called with two or three (in case of "edited") string
parameters. The first parameter is one of
before if this is *before* a recording starts
after if this is *after* a recording has finished
@ -244,7 +244,8 @@ is one of
and the second parameter contains the full name of the recording's
directory (which may not yet exists at that moment in the "before" case).
In the "edited" case it will be the name of the edited version.
In the "edited" case it will be the name of the edited version (second
parameter) and the name of the source version (third parameter).
Within this program you can do anything you would like to do before and/or
after a recording or after an editing process. However, the program must return
@ -265,6 +266,7 @@ case "$1" in
;;
edited)
echo "Edited recording $2"
echo "Source recording $3"
;;
*)
echo "ERROR: unknown state: $1"

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: cutter.c 2.11 2012/02/16 12:08:39 kls Exp $
* $Id: cutter.c 2.12 2012/06/02 13:46:55 kls Exp $
*/
#include "cutter.h"
@ -270,7 +270,7 @@ bool cCutter::Active(const char *FileName)
error = cuttingThread->Error();
Stop();
if (!error)
cRecordingUserCommand::InvokeCommand(RUC_EDITEDRECORDING, editedVersionName);
cRecordingUserCommand::InvokeCommand(RUC_EDITEDRECORDING, editedVersionName, originalVersionName);
originalVersionName = NULL;
editedVersionName = NULL;
ended = true;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: recording.c 2.54 2012/05/20 13:19:15 kls Exp $
* $Id: recording.c 2.55 2012/06/02 13:52:05 kls Exp $
*/
#include "recording.h"
@ -1424,13 +1424,17 @@ cMark *cMarks::GetNext(int Position)
const char *cRecordingUserCommand::command = NULL;
void cRecordingUserCommand::InvokeCommand(const char *State, const char *RecordingFileName)
void cRecordingUserCommand::InvokeCommand(const char *State, const char *RecordingFileName, const char *SourceFileName)
{
if (command) {
cString cmd = cString::sprintf("%s %s \"%s\"", command, State, *strescape(RecordingFileName, "\\\"$"));
isyslog("executing '%s'", *cmd);
SystemExec(cmd);
}
cString cmd;
if (SourceFileName)
cmd = cString::sprintf("%s %s \"%s\" \"%s\"", command, State, *strescape(RecordingFileName, "\\\"$"), *strescape(SourceFileName, "\\\"$"));
else
cmd = cString::sprintf("%s %s \"%s\"", command, State, *strescape(RecordingFileName, "\\\"$"));
isyslog("executing '%s'", *cmd);
SystemExec(cmd);
}
}
// --- cIndexFileGenerator ---------------------------------------------------

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: recording.h 2.31 2012/06/02 13:22:53 kls Exp $
* $Id: recording.h 2.32 2012/06/02 13:46:55 kls Exp $
*/
#ifndef __RECORDING_H
@ -243,7 +243,7 @@ private:
static const char *command;
public:
static void SetCommand(const char *Command) { command = Command; }
static void InvokeCommand(const char *State, const char *RecordingFileName);
static void InvokeCommand(const char *State, const char *RecordingFileName, const char *SourceFileName = NULL);
};
// The maximum size of a single frame (up to HDTV 1920x1080):