diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2012-09-17 09:03:01 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2012-09-17 09:03:01 +0200 |
commit | e6526ae2691991b7f623ae7345ec05985d3f0005 (patch) | |
tree | 61bbf47a5b491574447bb662713ba2c13445561d | |
parent | 8423b5ea4c756a3e7c554ec51d7989e32ddfcfea (diff) | |
download | vdr-e6526ae2691991b7f623ae7345ec05985d3f0005.tar.gz vdr-e6526ae2691991b7f623ae7345ec05985d3f0005.tar.bz2 |
The script given to VDR with the '-r' option is now also called whenever a recording is deleted
-rw-r--r-- | CONTRIBUTORS | 2 | ||||
-rw-r--r-- | HISTORY | 2 | ||||
-rw-r--r-- | INSTALL | 8 | ||||
-rw-r--r-- | recording.c | 6 | ||||
-rw-r--r-- | recording.h | 3 | ||||
-rw-r--r-- | vdr.c | 5 |
6 files changed, 20 insertions, 6 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 202002f4..4df88b50 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2314,6 +2314,8 @@ Pekka Mauno <pekka.mauno@iki.fi> Alexander Wenzel <hondansx@gmx.de> for fixing the shutdown timeout + for making the script given to VDR with the '-r' option be also called whenever a + recording is deleted Jan Lenz <email@JanLenz.de> for reporting a bug in deleting recordings that have been removed externally when @@ -7245,3 +7245,5 @@ Video Disk Recorder Revision History which means to record only the currently running event (based on a patch from Matti Lehtimäki). - Decreased the ring buffer put/get trigger sizes from 1/3 to 1/10. +- The script given to VDR with the '-r' option is now also called whenever a + recording is deleted (thanks to Alexander Wenzel). @@ -242,7 +242,7 @@ Executing commands before and after a recording: 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. +has finished or a recording has been deleted. The program will be called with two or three (in case of "edited") string parameters. The first parameter is one of @@ -250,11 +250,14 @@ parameters. The first parameter is one of before if this is *before* a recording starts after if this is *after* a recording has finished edited if this is after a recording has been *edited* + deleted if this is after a recording has been *deleted* 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 (second parameter) and the name of the source version (third parameter). +In the "deleted" case the extension of the directory name is ".del" +instead of ".rec". 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 @@ -277,6 +280,9 @@ case "$1" in echo "Edited recording $2" echo "Source recording $3" ;; + deleted) + echo "Deleted recording $2" + ;; *) echo "ERROR: unknown state: $1" ;; diff --git a/recording.c b/recording.c index 49c5276e..6121ee27 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.61 2012/09/13 11:02:17 kls Exp $ + * $Id: recording.c 2.62 2012/09/17 08:54:00 kls Exp $ */ #include "recording.h" @@ -1010,8 +1010,10 @@ bool cRecording::Delete(void) RemoveVideoFile(NewName); } isyslog("deleting recording '%s'", FileName()); - if (access(FileName(), F_OK) == 0) + if (access(FileName(), F_OK) == 0) { result = RenameVideoFile(FileName(), NewName); + cRecordingUserCommand::InvokeCommand(RUC_DELETERECORDING, NewName); + } else { isyslog("recording '%s' vanished", FileName()); result = true; // well, we were going to delete it, anyway diff --git a/recording.h b/recording.h index 84a23b3b..ac44ad5b 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.36 2012/09/06 09:59:11 kls Exp $ + * $Id: recording.h 2.37 2012/09/17 08:53:23 kls Exp $ */ #ifndef __RECORDING_H @@ -240,6 +240,7 @@ public: #define RUC_BEFORERECORDING "before" #define RUC_AFTERRECORDING "after" #define RUC_EDITEDRECORDING "edited" +#define RUC_DELETERECORDING "deleted" class cRecordingUserCommand { private: @@ -22,7 +22,7 @@ * * The project's page is at http://www.tvdr.de * - * $Id: vdr.c 2.38 2012/09/01 13:30:19 kls Exp $ + * $Id: vdr.c 2.39 2012/09/17 08:56:58 kls Exp $ */ #include <getopt.h> @@ -466,7 +466,8 @@ int main(int argc, char *argv[]) " -p PORT, --port=PORT use PORT for SVDRP (default: %d)\n" " 0 turns off SVDRP\n" " -P OPT, --plugin=OPT load a plugin defined by the given options\n" - " -r CMD, --record=CMD call CMD before and after a recording\n" + " -r CMD, --record=CMD call CMD before and after a recording, and after\n" + " a recording has been edited or deleted\n" " --resdir=DIR read resource files from DIR (default: %s)\n" " -s CMD, --shutdown=CMD call CMD to shutdown the computer\n" " --split split edited files at the editing marks (only\n" |