[mythtv-users] SD UK - "To be announced" data in listings (was: only 4 days listings ?)

Ian Campbell ijc at hellion.org.uk
Fri Sep 30 07:16:39 UTC 2016


On Tue, 2016-09-20 at 15:45 +0100, Ian Campbell wrote:
> At one point I started on a wrapper, but the need for it went away
> before I got around to make it work well.

Here's what I ended up with, it's a _little_ over engineered ;-) but
having the cache of before and after data is often handy...

I also spotted a separate Movie TBA so this filters those too.

Ian.


$ cat /usr/local/bin/tv_grab_sd_json_filtered 
#!/bin/bash

cmd=$(basename ${0%_filtered})
log=/var/cache/mythtv/$cmd.log
exec 3>>$log
date >&3

set -e

echo "Invoked as $0 $@" >&3
if [ $# -lt 1 ] ; then
    echo >&2 "Not enough arguments!"
    exit 1
fi
if [ x$1 != x--config-file ] ; then
    echo "Passthrough: $cmd $@" >&3
    echo >&3
    exec $cmd "$@"
fi

if [ $# -lt 4 ] ; then
    echo >&2 "Not enough arguments!"
    exit 1
fi
if [ x$3 != x--output ] ; then
    echo >&2 "Unexpected arguments!"
fi

# $1 == --config-file
config=$2
# $3 == --output
output=$4
shift 4

source=$(basename $config .xmltv)
raw=/var/cache/mythtv/$cmd.$source.raw.xml
filtered=/var/cache/mythtv/$cmd.$source.xml

echo "Fetching and filtering:" >&3
echo "$cmd --config-file $config $@ ($raw)" >&3
echo "tv_grep --not --desc '^Movie to be announced\.$' --and --not --desc '^Programming to be announced\.$'" >&3
$cmd --config-file $config "$@" | tee $raw | tv_grep --not --desc '^Movie to be announced\.$' --and --not --desc '^Programming to be announced\.$' | tee $filtered > $output

echo "" >&3

savelog -c 7 -n $log >&3
savelog -c 7 -n $raw >&3
savelog -c 7 -n $filtered >&3

exit 0


More information about the mythtv-users mailing list