1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

The script given to VDR with the '-r' option is now also called whenever a recording is deleted

This commit is contained in:
Klaus Schmidinger 2012-09-17 09:03:01 +02:00
parent 8423b5ea4c
commit e6526ae269
6 changed files with 20 additions and 6 deletions

View File

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

View File

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

View File

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

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

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.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:

5
vdr.c
View File

@ -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"