[mythtv-users] System event 'Recording started' triggered twice (MythTV-0.28)
Rajil Saraswat
rajil.s at gmail.com
Sun Nov 26 18:17:29 UTC 2017
Hello,
I am trying to setup 'System event' to trigger a channel change. I am
using a cut down version of the script posted in the wiki
(https://www.mythtv.org/wiki/IPTV_Encoders_as_a_Capture_Device#mythtv_recording_started.sh).
It seems that the system event call is triggered twice whenever the
channel is changed (rather than once). Here is the log when a channel is
changed.
Log (/var/log/mythtv/MyScripts.log):
script mythtv_recording_started start
20171126060117 mythtv_recording_started.sh launch
20171126060117 recording_started.sh: CardID 5 Channel 2532
20171126060117 recording_started.sh: Cardid 5 change channel
script mythtv_recording_started end
script mythtv_recording_started start
20171126060118 mythtv_recording_started.sh launch
20171126060118 recording_started.sh: CardID 5 Channel 2532
20171126060118 recording_started.sh: Cardid 5 change channel
script mythtv_recording_started end
The comment 'script mythtv_recording_started start' is called twice
above. Any idea why the system event `Recording started` is invoked twice?
Thanks
-------------------------------------------------------------
Here is the full script:
$ cat /usr/local/bin/mythtv_recording_started.sh
#!/bin/bash -x
logfile="/var/log/mythtv/MyScripts.log" # point this to where you want
the log files
echo "script mythtv_recording_started start" >> "$logfile"
CardID="$1"
Channel="$2"
StartTime="$3"
echo $StartTime "mythtv_recording_started.sh launch" >> "$logfile"
Chan_Change_Cmd="/usr/local/bin/lirc1_1.sh"
##############################################################################################
echo $StartTime "recording_started.sh: CardID" $CardID "Channel "
$Channel >> "$logfile"
Enc_Status=`which mythtv_encoder_status`
#############################################################################
# if cardid is 5 and this is LiveTV,
# change the channel
case $CardID in
5)
Encoder_status=`mythtv_encoder_status --encoder=$CardID`
if [ "$Encoder_status" = "WatchingLiveTV" ]
then
Channel=${Channel#?}
Channel=$((10#$Channel))
###### update the channel change command as needed #######
Channum=`mythtv_get_channum_from_chanid.sh $Channel`
$Chan_Change_Cmd $Channum &
###########################################################
echo $StartTime "recording_started.sh: Cardid $CardID change
channel" >> $logfile
fi
;;
*)
echo $StartTime "recording_started.sh: Cardid" $CardID "NO ACTION"
>> "$logfile"
;;
esac
echo "script mythtv_recording_started end" >> "$logfile"
exit 0
More information about the mythtv-users
mailing list