[mythtv-users] SchedulesDirect Freview&freesat pointing to one json config file

Simon Hobson linux at thehobsons.co.uk
Tue Jun 14 07:29:46 UTC 2016

Tim Draper <veehexx at zoho.com> wrote:

> ok, spent the evening doing this; ended up with 2 xmltv files, one for each source and manually went through configuring each file for only that sources channels.

Manually editing files isn't my idea of fun !

I've updated my channel setting script (must update the wiki page), so now I have :

> #!/bin/bash
> # Set MythTV channel numbers
> . /etc/mythtv/mysql.txt
> echo '
>   update channel set useonairguide=0 ;
>   update channel set channum=channum+10000 where channum < 600 ;
>   update channel set visible=0 where not channum between 700 and 799 ;
>   update channel set visible=1,channum=1  ,xmltvid="24325"                    where callsign="BBC ONE N West" ;
>   update channel set visible=1,channum=2  ,xmltvid="17154"                    where callsign="BBC TWO" ;
>   update channel set visible=1,channum=4  ,xmltvid="20684"                    where callsign="BBC FOUR" ;
> ...
>   update channel set visible=1,xmltvid="24439"             where callsign="Classic FM" ;
>   update channel set visible=1,xmltvid="33579"             where callsign="LBC" ;
> ' | mysql --database=${DBName} --user=${DBUserName} --password=${DBPassword}

That will need "a certain amount of adaptation" where there's Freeview & Freesat involved - at the least, you'll probably need two sets of update statements, referencing the source id.

Then, to get an up to date list of chennels to fetch, I have this :

> conf='.xmltv/tv_grab_sd_json.conf'
> xmlfile='sd.xml'
> cd
> cp ${conf}.base ${conf}
> mysql --host= --user=mythtv --database=mythconverg --password=88shyqgR \
>   -e "select 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}
> tv_grab_sd_json --config-file ${conf}  --output ${xmlfile}

This gets the xmltv ids for only those channels which are visible and aren't set to use the on-air guide. Again, you'd either need to use the source id to make two config files, or get them all across all sources (might want to make it "select distinct(xmltvid) ...".

My base config file only holds this :
> cache=/home/simon/.xmltv/tv_grab_sd_json.cache
> channel-id-format=mythtv
> username=*****
> password=*****
> mode=channels
> channels=GBR-0001305-DEFAULT

So between them, I only have to maintain the channel setting script as channels come and go, the rest picks up the information from that. Avoids all those problems of changing information in more than one place and getting out of sync.

One for those with more knowledge than I have ...
If we don't use the built-in mythfilldatabase scheduler, would it work to have one config file to fetch the XML for all the channels across both sets of inputs ? There'll be a lot of overlap (channels the same on both Freeview and Freesat, and some where it's different (AIUI, some channels have slightly different listings on the different systems).
Then run mythfilldatabase for each source, using the one XML file ?

Interesting times for all of us !
But really, a lot of thanks to those who've built the tools to make this work :-)

More information about the mythtv-users mailing list