Difference between revisions of "Channel icons"

From MythTV Official Wiki
Jump to: navigation, search
(Add details of where new channel icons go in the file system and how to finish channel icon setup in MythWeb)
(Link to MYTHCONFDIR)
 
(56 intermediate revisions by 22 users not shown)
Line 1: Line 1:
If you would like to ensure that channel icons for your local/subscribed channels are automatically available to anyone (including yourself) configuring a MythTV system, you can help create the "master" (all-inclusive) map of icons to channels.
+
=Channel Icon Download System=
 +
As of 0.21, MythTV includes a channel icon download system in ''mythtv-setup'' which will attempt to automatically download icons for channels in your database from services.mythtv.org. If it cannot find an icon it will present you with a list of options, and the ability to define your own search parameters.
  
One of the best sources of channel icons is http://www.lyngsat-logo.com/ . There, you can browse the available icons and choose those appropriate for your system. However, doing so can be a lot of work (requiring many page hits and a lot of time).
+
To configure icon downloading in mythtv-setup:
 +
* run "mythtv-setup"
 +
* select "Channel Editor"
 +
* click on "Icon Download"
 +
* select either "Download all icons.." or "Rescan for missing icons.." or "Download icon for <selected channel>"
  
An easier approach is to use some new features in the post-0.20-SVN branch of MythTV to quickly look up the information.  And, the best part is that you can use this new feature (and help out with the development of MythTV) even if you're not using SVN--there's no need to upgrade ''any'' part of your MythTV installation.
 
  
First, checkout the appropriate portion of the SVN branch with:
+
==Universal Location==
 +
Starting with version 0.27, a single location for channel icons is used.
 +
It's usually in the ''.mythtv/channels'' directory of the user
 +
that runs ''mythbackend''. Typically, ''mythtv''. The location is defined
 +
in the built-in ChannelIcons Storage Group (it's not necessary to create
 +
a ChannelIcons Storage Group. ( Note this is not normally visible in the Storage group Setup menu of mythtv-setup, it is a system storage group and hence remains hidden).
  
<pre>
+
Note that users that set [[MYTHCONFDIR]] before starting MythTV programs
svn co http://svn.mythtv.org/svn/trunk/mythtv/contrib/master_iconmap
+
override the HOME directory of the user running the backend.
</pre>
 
  
Doing so will create a directory called "master_iconmap" underneath the current directory.  The master_iconmap directory contains a directory called "lyngsat" which contains a file lyngsat_stations.txt--a plain text listing of /all/ the available icons (small channel icons--listed on the line containing [ls-icon]) and logos (larger channel icons--often "widescreen" versions--listed on the line containing [ls-logo]) at LyngSat.
+
Run ''mythtv-setup'' as the same user that runs ''mythbackend'' and
 +
get a new set of channel icons. They'll be stored
 +
in the directory above.
  
Open the lyngsat/lyngsat_stations.txt file in one text editor so you can search it for your stations. You'll need to decide whether to use the icons or the logos (I used the logos for my stations).
+
A [[Services API]] endpoint (''<backend>:6544/Guide/GetChannelIcon?ChanId=<chanid>'') works with this
 +
feature. In fact, mythfrontend, mythweb and WebFrontend all use this to retrieve icons making this
 +
the prefect troubleshooting tool. If it doesn't work, no icons will display. [it is possible that some stale
 +
cached icons exist, but the endpoint must work for new icons.]
  
Then open and edit data/{baseurl,callsigntonetwork,networktourl}.txt in another editor(s).
+
If icons are not displayed when using the above API it is possible to verify if an icon file exists by interrogating the Database directly using the following command. Note this shows all visible channel entries within the Database.  
  
* baseurl.txt - shouldn't require any changes
+
<code><pre>
* callsigntonetwork.txt - create a mapping between a callsign (left column) and a network name (right column); it's /very/ important that you use the callsigns used by your listings provider (i.e. DataDirect) or something appropriate for everyone (if callsigns aren't generally used in your country); ''see below for information on naming networks''
+
mysql -u mythtv -p mythconverg -e "SELECT channum,chanid,icon FROM channel WHERE visible ORDER BY channum+0;"
* networktourl.txt - create a mapping between a network name (left column--use the name you defined in callsigntonetwork.txt) and an icon/logo URL (right column--copied straight out of lyngsat_stations.txt)
 
  
When naming networks, please try to use the following convention:
+
(chanid is a generated ID number for the channel that happens when it is scanned into the database)
* If the station is a local station, append a dash followed by the station's callsign to the name of the network with which the station is affiliated.  For example, WKMG is the callsign of a CBS affiliate, so its network name should be CBS-WKMG.
+
</pre></code>
* Stations that were affiliated with the WB and UPN networks are changing networks.  Some are becoming affiliates of the new CW network and others of the MyNetworkTV (MyTV) network and some of neither.  Note, though, that it's not a simple substitution (some WB networks are becoming CW and others are becoming MyTV and some are going independent, and the same for UPN stations).  The best source of information is probably http://www.wikipedia.org/.  For affiliates of CW, use "CW-" and for affiliates of MyTV, use "MYTV-".
 
* If the station is not affiliated with a national network (i.e. it's an "independent" channel), append the callsign to "IND-".  For example, WSBK decided not to affiliate with the new CW or MyTV networks, but instead became an independent station, so its network name is "IND-WSBK".
 
* If the channel is a cable channel, use a descriptive name for it (i.e. "CARTOONNETWORK" was chosen because it is much more descriptive than "TOON" or "CN").
 
* If the above doesn't apply (for non-US stations, for example), choose an appropriate convention and document it here.
 
  
Test your changes by running:
+
Symlinks added for prior MythTV versions, duplicate ''channels'' directories and
 +
any ''ChannelIcons'' [[Storage Groups]] and their contents can be removed. If linking is
 +
used be sure that both user ''mythtv'' and the frontend user
 +
have write permission on the directory! Some programs/apps create additional versions of the
 +
icons with different sizes , e.g. for ''cbs.jpg'', ''cbs.jpg.0x57.png'' may be created.
  
./build_map.pl
+
A Note of Caution: Some Myth distributions run ''mythtv-setup'' as the frontend user created on installation, where as the backend is frequently run as ''mythtv'', even if the frontend and backend are on same machine. This requires a symlink (ln -s /home/myuser/.mythtv/channels /home/mythtv/.mythtv/channels) or copy files. Once fixed the icons will automatically appear on mythweb and other frontends as describe above.
  
from the master_iconmap directory to incorporate your changes into the master_iconmap.xml file.  Then, '''as the user who runs the mythfrontend program''', run (again, from the master_iconmap directory):
+
OSX all-in-one installations should put their icons here: ''/opt/dvr/var/mythtvuser/.mythtv/channels'.
  
mythfilldatabase --reset-icon-map all
+
== Pre 0.27 Instructions==
 +
By default the icon will be downloaded to the ''/home/<user>/.mythtv/channels'' directory. This is not very friendly when you have multiple frontends and wish them all to share the icons. One method to get around this is to use a symlink for this directory that directs to a network located directory that all your frontends have access to, say ''/var/mythtv/channels'' for example.
  
to clear your current channel icons and
+
Before downloading the icons, do the following, or similar as per your distribution:
  
mythfilldatabase --import-icon-map master_iconmap.xml --update-icon-map
+
<code><pre>
 +
rm ~/.mythtv/channels -rf
 +
sudo mkdir /var/mythtv/channels
 +
sudo chown <user>:<group> /var/mythtv/channels
 +
ln -s /var/mythtv/channels ~/.mythtv/channels
 +
</pre></code>
  
to import icons using the updated master_iconmap.xml file (which now contains your changes).  Mythfilldatabase will download icon files for stations in your channel lineup that have matching callsigns to those now defined in master_iconmap.xml.  The icon image files will go into the directory .mythtv/channels located in your current user's home directory. At this point, verify all your channels have icons.
+
You will want to run
 +
<code><pre>
 +
rm ~/.mythtv/channels -rf
 +
ln -s /var/mythtv/channels ~/.mythtv/channels
 +
</pre></code>
 +
for all the users that can run MythTV as well.
  
Note that if you check for icons with MythWeb, you'll have to delete MythWeb's icon cache with the following (change path as appropriate) and copy in the updated icons. You may also have to set permissions on the icon files to ensure they are readable by the web server's user account.
+
=Channel Icon Sources=
 +
One of the best sources of channel icons is http://www.lyngsat-logo.com/ .  There, you can browse the available icons and choose those appropriate for your system.  However, doing so can be a lot of work (requiring many page hits and a lot of time).  Once downloaded you should put the resulting JPEG files into ''.mythtv/channels/'' for the user running the front-end. To add them to a channel you will need to run ''mythtv-setup'' and go to the channel editor and specify the icon file name for each channel.
  
rm /var/www/htdocs/mythtv/data/tv_icons/*
+
This command will download all .png files on a web page and put them in the directory specified by the --directory-prefix parameter:
cp ~/.mythtv/channels/* /var/www/htdocs/mythtv/data/tv_icons
 
chmod a+r /var/www/htdocs/mythweb/data/tv_icons/*
 
  
Once everything looks good, run
+
$ wget --no-directories --recursive --level=1 --directory-prefix=/tmp/ --accept=png "https://www.example.com/page.html"
  
  svn diff data > ~/master_iconmap.patch
+
'''As of 9th February 2018 and earlier this service has blocked direct download of icons in mythtv-setup. Although the downloads appear to work and you will find PNGs in /home/<user>/.mythtv/channels/ they will be approx. 300 bytes in size and upon opening with a text editor will show a forbidden message.'''
 +
 
 +
Another source of channel icons is http://www.iconharmony.com/ which is targeted for icons for the harmony remote. Some of the available icons are more stylized than the official icon (the person running the site is a graphic artist).  As with the previous source, finding an appropriate icon can be a lot of work.
 +
 
 +
==International Channel Logos==
 +
* [https://github.com/AshKyd/australian-tv-network-logos Australia]
  
from the master_iconmap directory to create a patch for Trac.  See http://svn.mythtv.org/trac/ticket/2365 for an example patch (look at the newest patch on the ticket--the first one was for a very different (and harder to edit) style).
 
 
[[Category:HOWTO]]
 
[[Category:HOWTO]]

Latest revision as of 15:18, 22 April 2020

Channel Icon Download System

As of 0.21, MythTV includes a channel icon download system in mythtv-setup which will attempt to automatically download icons for channels in your database from services.mythtv.org. If it cannot find an icon it will present you with a list of options, and the ability to define your own search parameters.

To configure icon downloading in mythtv-setup:

  • run "mythtv-setup"
  • select "Channel Editor"
  • click on "Icon Download"
  • select either "Download all icons.." or "Rescan for missing icons.." or "Download icon for <selected channel>"


Universal Location

Starting with version 0.27, a single location for channel icons is used. It's usually in the .mythtv/channels directory of the user that runs mythbackend. Typically, mythtv. The location is defined in the built-in ChannelIcons Storage Group (it's not necessary to create a ChannelIcons Storage Group. ( Note this is not normally visible in the Storage group Setup menu of mythtv-setup, it is a system storage group and hence remains hidden).

Note that users that set MYTHCONFDIR before starting MythTV programs override the HOME directory of the user running the backend.

Run mythtv-setup as the same user that runs mythbackend and get a new set of channel icons. They'll be stored in the directory above.

A Services API endpoint (<backend>:6544/Guide/GetChannelIcon?ChanId=<chanid>) works with this feature. In fact, mythfrontend, mythweb and WebFrontend all use this to retrieve icons making this the prefect troubleshooting tool. If it doesn't work, no icons will display. [it is possible that some stale cached icons exist, but the endpoint must work for new icons.]

If icons are not displayed when using the above API it is possible to verify if an icon file exists by interrogating the Database directly using the following command. Note this shows all visible channel entries within the Database.

mysql -u mythtv -p mythconverg -e "SELECT channum,chanid,icon FROM channel WHERE visible ORDER BY channum+0;"

(chanid is a generated ID number for the channel that happens when it is scanned into the database)

Symlinks added for prior MythTV versions, duplicate channels directories and any ChannelIcons Storage Groups and their contents can be removed. If linking is used be sure that both user mythtv and the frontend user have write permission on the directory! Some programs/apps create additional versions of the icons with different sizes , e.g. for cbs.jpg, cbs.jpg.0x57.png may be created.

A Note of Caution: Some Myth distributions run mythtv-setup as the frontend user created on installation, where as the backend is frequently run as mythtv, even if the frontend and backend are on same machine. This requires a symlink (ln -s /home/myuser/.mythtv/channels /home/mythtv/.mythtv/channels) or copy files. Once fixed the icons will automatically appear on mythweb and other frontends as describe above.

OSX all-in-one installations should put their icons here: /opt/dvr/var/mythtvuser/.mythtv/channels'.

Pre 0.27 Instructions

By default the icon will be downloaded to the /home/<user>/.mythtv/channels directory. This is not very friendly when you have multiple frontends and wish them all to share the icons. One method to get around this is to use a symlink for this directory that directs to a network located directory that all your frontends have access to, say /var/mythtv/channels for example.

Before downloading the icons, do the following, or similar as per your distribution:

rm ~/.mythtv/channels -rf
sudo mkdir /var/mythtv/channels
sudo chown <user>:<group> /var/mythtv/channels
ln -s /var/mythtv/channels ~/.mythtv/channels

You will want to run

rm ~/.mythtv/channels -rf
ln -s /var/mythtv/channels ~/.mythtv/channels

for all the users that can run MythTV as well.

Channel Icon Sources

One of the best sources of channel icons is http://www.lyngsat-logo.com/ . There, you can browse the available icons and choose those appropriate for your system. However, doing so can be a lot of work (requiring many page hits and a lot of time). Once downloaded you should put the resulting JPEG files into .mythtv/channels/ for the user running the front-end. To add them to a channel you will need to run mythtv-setup and go to the channel editor and specify the icon file name for each channel.

This command will download all .png files on a web page and put them in the directory specified by the --directory-prefix parameter:

$ wget --no-directories --recursive --level=1 --directory-prefix=/tmp/ --accept=png "https://www.example.com/page.html"

As of 9th February 2018 and earlier this service has blocked direct download of icons in mythtv-setup. Although the downloads appear to work and you will find PNGs in /home/<user>/.mythtv/channels/ they will be approx. 300 bytes in size and upon opening with a text editor will show a forbidden message.

Another source of channel icons is http://www.iconharmony.com/ which is targeted for icons for the harmony remote. Some of the available icons are more stylized than the official icon (the person running the site is a graphic artist). As with the previous source, finding an appropriate icon can be a lot of work.

International Channel Logos