[mythtv-users] Culling my MythTV channels

Simon Hobson linux at thehobsons.co.uk
Mon Mar 22 20:26:37 UTC 2021


Fred Hamilton <fred at yonkitime.com> wrote:

> - My source.xmltv file looks like:
>      cache=/home/fred/.xmltv/tv_grab_zz_sdjson.cache
>      channel-id-format=mythtv
>      previously-shown-format=date
>      username=*********
>      password=********* 
>      mode=lineup

If you change mode to channels then you can specify what channels you want to fetch. But instead of manually maintaining a list - let the computer do it for you ;-)

Have a look at https://lists.archive.carbon60.com/mythtv/users/631199 where I replied to a different request - but the principle will probably still help you.
IF you maintain your channel list to only have the channels you want as visible, then the script (adapt as required) will fetch the listings for only those channels.

If you find yourself having to redo the chennels selections (e.g. re-scans are more than "very rare") then have a look at the link in that archive above to the wiki https://www.mythtv.org/wiki/Database_editing_script. That's something I setup a long time ago when I got "rather annoyed" at having to redo all my channel changes every time I had to retune - those in charge of UK Freeview seem to think it's fair game to alter things any time there's a 'y' in the day ! It's a right PITA to setup the script, but once done it's less work to maintain. The main think is looking at the channel list (I use mythweb for that) and see if there's anything been shoved out the way & made invisible that you want to watch - then tweaking the script to suit and re-running it.

I use this script to get a list of channels available from SD :
> #!/bin/bash
> 
> # Get full xml listing and extract channel-ids & names
> 
> base="/var/lib/mythtv/.xmltv"
> conf="${base}/tv_grab_sd_json.conf"
> chan_file="${base}/channels"
> 
> rm ${conf}.full ${chan_file}.txt ${chan_file}.xml 2>/dev/null
> 
> sed -e 's/channels/lineup/' < ${conf}.base > ${conf}.full
> 
> tv_grab_zz_sdjson --config-file ${conf}.full --days 0 --output ${chan_file}.xml
> grep 'channel id
> display-name' < ${chan_file}.xml > ${chan_file}.txt
Then I open the output file in ${favourite editor} and search t=for the channels names I need to find IDs for.

The base conf file I use looks like :
> cache=/var/lib/mythtv/.xmltv/tv_grab_sd_json.cache
> channel-id-format=mythtv
> username=user
> password=pass
> mode=channels
> channels=GBR-1000040-DEFAULT

My get_listings script then adds all the channels I have set to visible and which don't use on-air listings to this conf file before using it to fetch listings :
> #!/bin/bash 
> 
> base="/var/lib/mythtv/.xmltv" 
> conf="${base}/tv_grab_sd_json.conf" 
> xmlfile="${base}/listings.xml" 
> xmlfile2="${base}/sd.xml" 
> 
> rm ${conf} ${xmlfile} ${xmlfile2} 2>/dev/null 
> 
> cp ${conf}.base ${conf} 
> 
> mysql --host=localhost --user=mythtv --database=mythconverg --password='*****' \ 
> -e "select distinct(xmltvid) from channel where visible=1 and useonairguide=0 order by xmltvid ;" | 
> grep '[0-9][0-9][0-9][0-9][0-9]' | 
> sed -e 's/^/channel=/' >> ${conf} 
> 
> /usr/bin/tv_grab_zz_sdjson --config-file ${conf} --output ${xmlfile} 
> /usr/bin/tv_grep --output ${xmlfile2} --not --title 'To Be Announced' ${xmlfile} 
> 
> mythfilldatabase --only-update-guide --sourceid 1 --file --xmlfile ${xmlfile2} 2>&1 | grep -v 'Ignoring unknown timestamp format' 



OK, this doesn't help you in picking out the 200 channels you want - but it will deal with only fetching the schedules data you need when you've done it.
It's also using the JSON format - the only format supported by SD for the UK.

Simon


More information about the mythtv-users mailing list