Mailing List Archive

Detecting new channels
Using tv_grab_zz_sdjson_sqlite, is there some easy way, perhaps via a
CLI option or enabling some logging, to notice if a new channel (really,
station or callsign) has appeared? I imagine I could write something
which periodically ran sdjson-sqlite-select (as the myth user! :) or
tv_grab_zz_sdjson_sqlite --list-channels (ditto) and compared the output
to the last time, but is there some easier way? (I suppose I could also
periodically query the DB's channels table or somesuch.) I note that
xmltv logging does show how many channels are being downloaded, but even
if I noticed a change in the number, it's not very helpful unless it also
tells me what's new.

(This is on a cable system, and the issue here is that new channels
occasionally pop up, but they're often untunable because they're not
part of my subscription package. Yet myth may try to tune because
something matched a rule, but this leads to lots of failed recordings
until I periodically clean them out, so I'd like to notice faster and
make them invisible/delete them from my lineup if so. But I'd also
rather not disable the ability to notice new channels if a tuneable
one does pop up.)

I've done some web searching but it's awfully hard to separate the wheat
from the chaff on such a generic set of keywords. Tnx.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Detecting new channels [ In reply to ]
On Wed, Jan 04, 2023 at 06:06:31PM -0500, f-myth-users@media.mit.edu wrote:
> Using tv_grab_zz_sdjson_sqlite, is there some easy way, perhaps via a
> CLI option or enabling some logging, to notice if a new channel (really,
> station or callsign) has appeared? I imagine I could write something
> which periodically ran sdjson-sqlite-select (as the myth user! :) or
> tv_grab_zz_sdjson_sqlite --list-channels (ditto) and compared the output
> to the last time, but is there some easier way? (I suppose I could also
> periodically query the DB's channels table or somesuch.) I note that
> xmltv logging does show how many channels are being downloaded, but even
> if I noticed a change in the number, it's not very helpful unless it also
> tells me what's new.
>
> (This is on a cable system, and the issue here is that new channels
> occasionally pop up, but they're often untunable because they're not
> part of my subscription package. Yet myth may try to tune because
> something matched a rule, but this leads to lots of failed recordings
> until I periodically clean them out, so I'd like to notice faster and
> make them invisible/delete them from my lineup if so. But I'd also
> rather not disable the ability to notice new channels if a tuneable
> one does pop up.)
>
> I've done some web searching but it's awfully hard to separate the wheat
> from the chaff on such a generic set of keywords. Tnx.

https://github.com/garybuhrmaster/MythUtil

I'd like to eventually include much/all? of the functionality in
MythTV proper but ENOTIME and higher priority tasks keep preventing
it. If anyone wants to volunteer, I'll shepherd the process of
getting it merged.

David
--
David Engel
david@istwok.net
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Detecting new channels [ In reply to ]
On 2023-01-04 23:06, f-myth-users@media.mit.edu wrote:
> Using tv_grab_zz_sdjson_sqlite, is there some easy way, perhaps via a
> CLI option or enabling some logging, to notice if a new channel
> (really,
> station or callsign) has appeared? I imagine I could write something
> which periodically ran sdjson-sqlite-select (as the myth user! :) or
> tv_grab_zz_sdjson_sqlite --list-channels (ditto) and compared the
> output
> to the last time, but is there some easier way?

I run this as part of a cron job that fetches the listings every day.
Run it as the user mythtv and you'll get an email diff of the changes.

# Run the grabber and dump just the channels so this script can check
for changes.
# Because the grabber caches programmes it doesn't double the amount of
data fetched.
GRAB=tv_grab_zz_sdjson
export XML="$HOME/.xmltv/$GRAB.xml"
$GRAB --quiet --days 0 --output "$XML.new"
if [ ! -s "$XML.new" ]
then
echo "Grabber failed to produce any output."
exit 1
fi
# Reformat XML to have the channel names on one line (in reverse order
for sorting).
awk --field-separator '[<>"]' \
'/channel id/ {id=$3};
/display-name/ {name=$3 "\t" name};
/\/channel/ {print name "\t" id; name=""}' $XML.new \
| expand --tabs=4,13,60 \
| sort --numeric > $XML.new.txt
diff -uw "$XML.txt" "$XML.new.txt"
mv "$XML.new.txt" "$XML.txt"
rm "$XML.new"
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org