File: vdr-recordingaction

package info (click to toggle)
vdr 2.4.1-4.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 6,404 kB
  • sloc: ansic: 60,322; perl: 966; makefile: 703; sh: 637; python: 86
file content (43 lines) | stat: -rwxr-xr-x 1,512 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
#
# VDR Recording Action Script  - Tobias Grimm <tg@e-tobi.net>
# ---------------------------
#
# This script gets executed by VDR before a recording starts, after a
# recording ends and after a recording has been edited.
# In order to allow other addons to hook into this process, this script will
# search for any executables in /usr/share/vdr/recording-hooks. These
# hooks are called in their alphabetical order and should follow this
# naming scheme:
#
# R<XX>.<identifier>
#
# Where <XX> is a two digit number, that mainly specifies the execution order
# and <identifier> is a unique descriptor.
#
# Two parameters are passed to each recording hook:
#
# 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
    if [ -x $recordinghook ]; then
        logger -t recordingaction "executing $recordinghook $@"
        $recordinghook "$@"
    else
        logger -t recordingaction "executing shell script $recordinghook $@"
        /bin/sh $recordinghook "$@"
    fi
    [ $? -ne 0 ] && logger -t recordingaction "error when executing $recordinghook"
done