[mythtvnz] Getting the current Freeview icons

Robert Fisher robert at fisher.net.nz
Wed Jul 6 00:43:50 BST 2022


Maybe I got lucky but all I did to get the new icons (they were not all 
available immediately after the recent channel changes) was, after a 
rescan I ran (on the backend):-

Channel Editor > Icon Download

Easy.

On 16/04/22 00:41, Stephen Worthington wrote:
> The FreeviewHD EPG downloadable from here:
>
> https://nzxmltv.github.io/xmltv/guide.xml
>
> is created by scraping the freeviewnz.tv site's guide pages here:
>
> https://freeviewnz.tv/tvguide/whats-on/
>
> and I noticed that it also scrapes the icon URLs for the channels.
> Since my channel icons are well out of date, I wanted to update them
> to the same ones used by freeviewnz.tv.  So I wrote some Python to
> parse the guide.xml file and extract the data I wanted:
>
> http://www.jsw.gen.nz/mythtv/get-freeview-icons.py
>
> To use this, do this:
>
> cd /tmp
> wget http://www.jsw.gen.nz/mythtv/get-freeview-icons.py
> chmod +x get-freeview-icons.py
> wget https://nzxmltv.github.io/xmltv/guide.xml
> ./get-freeview-icons.py guide.xml
> chmod +x download-icons.sh
>
> This will read the guide.xml file and create these two files from it:
>
> download-icons.sh
> freeview-icons.sql
>
> The download-icons.sh file is a script containing wget commands to
> download the icons.  To use it, do this:
>
> cd /home/mythtv/.mythtv/channels
> /tmp/download-icons.sh
> chown mythtv:mythtv *
> chmod u=rw,g=rw,o=r *
>
> Then you need to update your channel table to use the new icons.  You
> can do this manually, but it would be very tedious.  So that is what
> the freeview-icons.sql file is for - it contains the SQL to create a
> new freeview-icons table in your database that contains the data
> needed to use an update command to change all the icons automatically.
>
> To use it, first backup your channel table in case there are any
> problems:
>
> sudo su
> cd /tmp
> mysqldump mythconverg channel >channel.sql
> exit
>
> Should you need to restore the old channel table, you need to first
> shut down mythbackend and then do these commands:
>
> sudo su
> cd /tmp
> mysql mythconverg
> drop table channel;
> source channel.sql
> quit
> exit
>
> Now create the freeview_icons table:
>
> sudo su
> mysql mythconverg <freeview-icons.sql
>
> Then you can look at the freeview_icons table to see if you think it
> is ok:
>
> select * from freeview_icons;
>
> If that is good, you can then do the icon updates.  First display the
> current icons:
>
> select channum,callsign,icon from channel where sourceid=1 order by
> channum+0;
>
> You will need to change the "sourceid=1" in this and subsequent SQL
> commands to the correct sourceid number for your database.
>
> Now do the update:
>
> update channel c set icon=(select icon from freeview_icons f where
> c.channum=f.channum) where sourceid=1 and (select count(*) from
> freeview_icons f where c.channum=f.channum)!=0;
>
> Check the icons by displaying them again:
>
> select channum,callsign,icon from channel where sourceid=1 order by
> channum+0;
>
> Then tidy up and exit:
>
> drop table freeview_icons;
> quit
> exit
>
> Now check the icons that show in mythfrontend in the Guide.  If you
> are unhappy with the result restore your channel table as above.
>
> _______________________________________________
> mythtvnz mailing list
> mythtvnz at lists.ourshack.com
> https://lists.ourshack.com/mailman/listinfo/mythtvnz
> Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/



More information about the mythtvnz mailing list