summaryrefslogtreecommitdiff
blob: b896ba8af68298cbbc8c2c515ad17f4ba007f29b (plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# $Header: /var/cvsroot/gentoo-x86/media-video/noad/files/record-50-noad.sh,v 1.1 2012/07/04 21:33:43 hd_brummy Exp $
#
# Joerg Bornkessel <hd_brummy@gentoo.org>
# Mathias Schwarzott <zzam@gentoo.org>
#

. /etc/conf.d/vdraddon.noad

CMD="/usr/bin/noad"

# Parameter to start NoAd
# parameter are "no | yes"

FORCE_OFFLINE_SCAN=no

if [ "${VDR_RECORD_STATE}" = "reccmd" ]; then
	# script started from reccmd
	FORCE_OFFLINE_SCAN=yes
	VDR_RECORD_STATE=after
fi


if [ "${FORCE_OFFLINE_SCAN}" != "yes" ]; then
	# allow it to abort on certain conditions

	# automatic noad scan disabled
	[ "${VDR_USE_NOAD}" = "yes" ] || return

	# ptsmarks existing
	if [ "${NOAD_ONLY_SCAN_IF_NO_PTSMARKS}" = "yes" ]; then
		[ -f "${VDR_RECORD_NAME}/ptsmarks.vdr" ] && return
	fi

	# marks existing
	if [ "${NOAD_ONLY_SCAN_IF_NO_MARKS}" = "yes" ]; then
		[ -f "${VDR_RECORD_NAME}/marks.vdr" ] && return
	fi

	# Add Online-scanning parameter
	case "${NOAD_ONLINE}" in
		live|yes)
			CMD="${CMD} --online=1"
			;;
		all)
			CMD="${CMD} --online=2"
			;;
		no)
			# abort stage "before" here
			[ "${VDR_RECORD_STATE}" = "before" ] && return
			;;
	esac
fi

[ "${NOAD_AC3}" = "yes" ] && CMD="${CMD} -a"
[ "${NOAD_JUMP}" = "yes" ] && CMD="${CMD} -j"
[ "${NOAD_OVERLAP}" = "yes" ] && CMD="${CMD} -o"
[ "${NOAD_MESSAGES}" = "yes" ] && CMD="${CMD} -O"

: ${NOAD_NICE_LEVEL:=18}
if [ "${NOAD_NICE_LEVEL}" != "no" ]; then
	NOAD_NICE_LEVEL=$(($NOAD_NICE_LEVEL+0))
	CMD="nice -n ${NOAD_NICE_LEVEL} ${CMD}"
fi

CMD="${CMD} ${NOAD_PARAMETER}"
${CMD} "${VDR_RECORD_STATE}" "${VDR_RECORD_NAME}"