#!/bin/sh

# notification exec sample

# WARNING:
#
# copy this file to your HDD or USB stick before editing
# changes in /srv/pvr/ are lost on updates

# environment variables
#
#   PVR_alert_type			- 100
#   PVR_alert_name			- timerAdd
#   PVR_alert_cat			- Timer
#   PVR_alert_body			- some text...
# 
# optional
#   PVR_t_id				- pvr timerid (optional block)
#   PVR_date_start_stamp	- unix timestamp
#   PVR_date_end_stamp		- unix timestamp
#   PVR_stationid			- normalized station name
#   PVR_caption				- title/name/..
#   PVR_tagline				- subtitle/episode name/tagline/..

LOGFILE="/tmp/CHANGE_ME_AWAY_FROM_THIS_PARTITION"

addlog() {
    echo "`date +%Y%m%d\ %H%M%S` [notifyexec] $1" >>$LOGFILE 2>&1;
}

# get variables from environment
#addlog `env`				# preset env vars

# - OR - get variables from STDIN
#addlog `cat`				# stdin (read)

case "$PVR_alert_type" in
	100)addlog "new timer added"
		# exec your real destination
		#nohup  /do/whatever/you/like/but/do/it/in/background.sh >/dev/null 2>&1 &
		;;
	*)	addlog "unmatched alert type $PVR_alert_type / $PVR_alert_name"
		;;
esac

# EOF.

