Commit 2933168d authored by Tobias Grimm's avatar Tobias Grimm

Updated recording hooks to include the 'editing' hook as well

parent 82b6da7c
......@@ -2,10 +2,12 @@
# Custom VDR Recording Action Hook
# ----------------------------------
#
# This is a custom Recording Action Hook. It gets called by vdr
# before a recording starts, after a recording ended and after a
# recording has been edited. It is maintained as a config file in the vdr
# package. All other recording hooks get executed before this one!
# before a recording starts, after a recording ended, after editing was
# started, and after a recording has been edited. It is maintained as
# a config file in the vdr package. All other recording hooks get
# executed before this one!
#
# If you want to create your own recording hook that may get executed
# before any other hook, create it in /usr/share/vdr/recording-hooks or
......@@ -19,7 +21,8 @@
#
# Two parameters are passed:
#
# Parameter 1 can have the values "before", "after" and "edited", depending
# Parameter 1 can have the values "before", "started", "after", "editing", "edited" and "deleted"
, and "edited", depending
# on whether the recording hook is called before the recording starts,
# after the recording ends or after the recording has been edited.
#
......@@ -40,6 +43,11 @@ case $1 in
# do here whatever you would like to do right AFTER
# the recording $2 ENDED
;;
editing)
# do here whatever you would like to do right AFTER
# the editing of recording $2 has been started,
# $3 is the original recording
;;
edited)
# do here whatever you would like to do right AFTER
# the recording $2 has been EDITED
......
......@@ -17,32 +17,26 @@
#
# Two parameters are passed to each recording hook:
#
# Parameter 1 can have the values "before", "after" and "edited", depending
# on whether the recording hook is called before the recording starts,
# after the recording ends or after the recording has been edited.
# Parameter 1 can have the values "before", "started", "after", "editing",
# "edited" and "deleted".
#
# Parameter 2 is the directory of the recording. Be aware, that this directory
# doesn't exist before the recording starts.
#
# Parameter 3 is used only after "editing"/"edited" a recording and is the
# directory of the original recording.
#
REC_HOOKS_DIR=/usr/share/vdr/recording-hooks
recordinghooks=`find $REC_HOOKS_DIR -maxdepth 1 -xtype f | sort`
for recordinghook in $recordinghooks; do
case $1 in
before|after)
action="$1 recording $2"
;;
edited)
action="after cutting recording $2 from $3"
;;
esac
if [ -x $recordinghook ]; then
logger -t recordingaction "executing $recordinghook $action"
logger -t recordingaction "executing $recordinghook $@"
$recordinghook "$@"
else
logger -t recordingaction "executing $recordinghook $action as shell script"
logger -t recordingaction "executing shell script $recordinghook $@"
/bin/sh $recordinghook "$@"
fi
[ $? -ne 0 ] && logger -t recordingaction "error when executing $recordinghook"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment