From 78e11d8c6feab964586e11e9396b3b868c086343 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 2 Jun 2012 13:57:41 +0200 Subject: [PATCH] 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 --- CONTRIBUTORS | 4 ++++ HISTORY | 3 +++ INSTALL | 8 +++++--- cutter.c | 4 ++-- recording.c | 16 ++++++++++------ recording.h | 4 ++-- 6 files changed, 26 insertions(+), 13 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index f0c5e3dd..d4ccb893 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2891,3 +2891,7 @@ Michael Schneider Marco Skambraks for fixing resetting CAMs + +Christian Richter + 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 diff --git a/HISTORY b/HISTORY index fb20a60a..bbf20773 100644 --- a/HISTORY +++ b/HISTORY @@ -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). diff --git a/INSTALL b/INSTALL index 1096a31f..21b798ad 100644 --- a/INSTALL +++ b/INSTALL @@ -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" diff --git a/cutter.c b/cutter.c index 320d554c..eb8f8206 100644 --- a/cutter.c +++ b/cutter.c @@ -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; diff --git a/recording.c b/recording.c index 5400d630..b2ac48e1 100644 --- a/recording.c +++ b/recording.c @@ -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 --------------------------------------------------- diff --git a/recording.h b/recording.h index 5d7c2847..30653b05 100644 --- a/recording.h +++ b/recording.h @@ -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):