summaryrefslogtreecommitdiff
blob: 4865c6abefe86ee9340b623054abf1ecde049dd3 (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
#
# rc-addon-script for plugin cdplayer
#
# $Header: /var/cvsroot/gentoo-x86/media-plugins/vdr-cdplayer/files/rc-addon.sh,v 1.2 2013/05/26 20:23:22 hd_brummy Exp $

. /etc/conf.d/vdr.cdplayer

CDPLAYER_CACHE_DIR="${CDPLAYER_CACHE_DIR:=/var/cache/vdr/cdplayer}"

make_cachedir() {
	# check, is CDPLAYER_CACHE_DIR available
	if [ ! -d "${CDPLAYER_CACHE_DIR}" ]; then
		mkdir "${CDPLAYER_CACHE_DIR}"
		chown -R vdr:vdr "${CDPLAYER_CACHE_DIR}"
	fi
}

plugin_pre_vdr_start() {

	# default values
	add_plugin_param "-c cdplayer"
	add_plugin_param "-s cd.mpg"

	add_plugin_param "-d ${CDPLAYER_DEVICE:-/dev/cdrom}"

	if yesno ${CDPLAYER_CDDB_QUERY:-yes}; then

	add_plugin_param "-S ${CDPLAYER_CDDB_SERVER:=freedb.freedb.org}"

		if yesno ${CDPLAYER_CDDB_CACHE:-yes}; then
			# CDDB cache directory
			make_cachedir
			add_plugin_param "-C ${CDPLAYER_CACHE_DIR}"
		else
			# disable CDDB cache
			add_plugin_param "-N"
		fi

	else
		# disable CDDB request
		add_plugin_param "-n"

	fi
}