Archive:MythTV PVR Client/DVB-EIT-categories

From Official Kodi Wiki
Jump to navigation Jump to search
Home icon grey.png   ▶ Add-on:MythTV PVR Client ▶ DVB-EIT-categories

Kodi PVR and the MythTV add-on have support for Digital Video Broadcasting-Service Information (DVB-SI) Event Information Table (EIT) categories only. In case you get your guide data from other sources (such as XMLTV), the genre names show up as Other/Unknown and you will not get a colored Electronic Program Guide (EPG). MythTV (MythFrontend and MythWeb), however, supports a more comprehensive category colorization scheme.

This page describes an approach for getting Kodi to recognize your categories by replacing the categories in the MythTV database with the corresponding DVB-SI EIT categories.

You need to setup MythTV to run a wrapper script as a mythfilldatabase replacement. This wrapper script will load a epg.sql database file that manages the category conversions. Since the categories depend on the source of your guide, you will have to adapt epg.sql to match your data.

1 Mythfilldatabase replacement

The MythTV backend needs to be configured to use /usr/local/bin/my-mythfilldatabase as a replacement:

#!/usr/bin/env bash

LANG="en_GB.UTF-8"
LC_ALL="en_GB.UTF-8"
typeset -gx LANG LC_ALL

if /usr/bin/mythfilldatabase --loglevel debug -- "--days 18"; then
  mysql -h htpc -u mythtv -p mythtv -D mythconverg </usr/local/bin/epg.sql
else
  exit 1
fi

2 Source specific categories

The SQL database file /usr/local/bin/epg.sql performs the category conversion. Below are some examples for the conversion script; most likely they will have to be adapted to match your guide source.

You can get all currently used categories from your database with the following command:

mysql --host=htpc --user=mythtv --password=mythtv --database=mythconverg <<<"SELECT DISTINCT category FROM program;"

2.1 Germany (epgdata.com)

/*
 * See DVB-SI spec (ETSI EN 300 468 V1.11.1 (2010-04), page 40 at
 * <https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.11.01_60/en_300468v011101p.pdf>
 *
 * Undefined
 * 0x0 0x0 to 0xF undefined content
 *
 * Movie/Drama:
 *
 * 0x1 0x0 movie/drama (general)
 * 0x1 0x1 detective/thriller
 * 0x1 0x2 adventure/western/war
 * 0x1 0x3 science fiction/fantasy/horror
 * 0x1 0x4 comedy
 * 0x1 0x5 soap/melodrama/folkloric
 * 0x1 0x6 romance
 * 0x1 0x7 serious/classical/religious/historical movie/drama
 * 0x1 0x8 adult movie/drama
 * 0x1 0x9 to 0xE reserved for future use
 * 0x1 0xF user defined
 */

UPDATE program SET category = 'Movie' WHERE category IN ('filme','action','kurzfilm');
UPDATE program SET category = 'Movie - Detective/Thriller' WHERE category IN ('krimi', 'thriller');
UPDATE program SET category = 'Movie - Adventure/Western/War' WHERE category IN ('abenteuer', 'western');
UPDATE program SET category = 'Movie - Science Fiction/Fantasy/Horror' WHERE category IN ('science fiction', 'fantasy', 'mystery+horror');
-- Comedy
UPDATE program SET category = 'Movie - Soap/melodrama/folkloric' WHERE category IN ('serien', 'soap', 'krankenhaus');
UPDATE program SET category = 'Movie - Romance' WHERE category = 'romantik/liebe';
-- Classical
UPDATE program SET category = 'Movie - Adult ' WHERE category = 'erotik';
UPDATE program SET category = 'Drama' WHERE category = 'drama';

/*
 * News/Current affairs:
 *
 * 0x2 0x0 news/current affairs (general)
 * 0x2 0x1 news/weather report
 * 0x2 0x2 news magazine
 * 0x2 0x3 documentary
 * 0x2 0x4 discussion/interview/debate
 * 0x2 0x5 to 0xE reserved for future use
 * 0x2 0xF user defined
 */

UPDATE program SET category = 'News' WHERE category = 'nachrichten';
-- weather
UPDATE program SET category = 'News magazine' WHERE category = 'magazin';
UPDATE program SET category = 'Documentary' WHERE category = 'dokumentarfilm';
-- discussion

/*
 * Show/Game show:
 *
 * 0x3 0x0 show/game show (general)
 * 0x3 0x1 game show/quiz/contest
 * 0x3 0x2 variety show
 * 0x3 0x3 talk show
 * 0x3 0x4 to 0xE reserved for future use
 * 0x3 0xF user defined
 */

UPDATE program SET category = 'Entertainment' WHERE category IN ('humor', 'comedy');
UPDATE program SET category = 'Game Show' WHERE category IN ('show','shows','spielshows');
UPDATE program SET category = 'Variety Show' WHERE category = 'familien-show';
UPDATE program SET category = 'Talk Show' WHERE category IN ('talkshows','gerichtsshow','reality');

/*
 * Sports:
 *
 * 0x4 0x0 sports (general)
 * 0x4 0x1 special events (Olympic Games, World Cup, etc.)
 * 0x4 0x2 sports magazines
 * 0x4 0x3 football/soccer
 * 0x4 0x4 tennis/squash
 * 0x4 0x5 team sports (excluding football)
 * 0x4 0x6 athletics
 * 0x4 0x7 motor sport
 * 0x4 0x8 water sport
 * 0x4 0x9 winter sports
 * 0x4 0xA equestrian
 * 0x4 0xB martial sports
 * 0x4 0xC to 0xE reserved for future use
 * 0x4 0xF user defined
 */

UPDATE program SET category = 'Sports' WHERE category IN ('extremsport', 'golf', 'us-sport');
-- special events
-- magazines
UPDATE program SET category = 'Football (Soccer)' WHERE category = 'fussball';
UPDATE program SET category = 'Tennis/Squash' WHERE category = 'tennis';
UPDATE program SET category = 'Misc. Team Sports' WHERE category IN ('handball', 'volleyball');
UPDATE program SET category = 'Athletics' WHERE category = 'leichtathletik';
UPDATE program SET category = 'Motor Sport' WHERE category = 'motorsport';
UPDATE program SET category = 'Water Sport' WHERE category = 'wassersport';
UPDATE program SET category = 'Winter Sports' WHERE category = 'wintersport';
-- equestrian
UPDATE program SET category = 'Martial Sports' WHERE category = 'boxen';

/*
 * Children's/Youth programmes:
 *
 * 0x5 0x0 children's/youth programmes (general)
 * 0x5 0x1 pre-school children's programmes
 * 0x5 0x2 entertainment programmes for 6 to14
 * 0x5 0x3 entertainment programmes for 10 to 16
 * 0x5 0x4 informational/educational/school programmes
 * 0x5 0x5 cartoons/puppets
 * 0x5 0x6 to 0xE reserved for future use
 * 0x5 0xF user defined
 */

UPDATE program SET category = 'Kids' WHERE category = 'jugend';
-- pre-school
-- 6-14
-- 10-16
-- informational
UPDATE program SET category = 'Cartoons/Puppets' WHERE category IN ('zeichentrick', 'anime');

/*
 * Music/Ballet/Dance:
 *
 * 0x6 0x0 music/ballet/dance (general)
 * 0x6 0x1 rock/pop
 * 0x6 0x2 serious music/classical music
 * 0x6 0x3 folk/traditional music
 * 0x6 0x4 jazz
 * 0x6 0x5 musical/opera
 * 0x6 0x6 ballet
 * 0x6 0x7 to 0xE reserved for future use
 * 0x6 0xF user defined
 */

UPDATE program SET category = 'Music/Ballet/Dance' WHERE category = 'musik';
UPDATE program SET category = 'Rock/Pop' WHERE category IN ('rock', 'pop', 'alternative');
UPDATE program SET category = 'Classical Music' WHERE category = 'klassik';
UPDATE program SET category = 'Folk Music' WHERE category = 'volksmusik';
UPDATE program SET category = 'Jazz' WHERE category = 'jazz';
UPDATE program SET category = 'Musical/Opera' WHERE category = 'musical';
-- ballet

/*
 * Arts/Culture (without music):
 *
 * 0x7 0x0 arts/culture (without music, general)
 * 0x7 0x1 performing arts
 * 0x7 0x2 fine arts
 * 0x7 0x3 religion
 * 0x7 0x4 popular culture/traditional arts
 * 0x7 0x5 literature
 * 0x7 0x6 film/cinema
 * 0x7 0x7 experimental film/video
 * 0x7 0x8 broadcasting/press
 * 0x7 0x9 new media
 * 0x7 0xA arts/culture magazines
 * 0x7 0xB fashion
 * 0x7 0xC to 0xE reserved for future use
 * 0x7 0xF user defined
 */

UPDATE program SET category = 'Arts/Culture' WHERE category = 'kultur';
UPDATE program SET category = 'Performing Arts' WHERE category = 'theater';
-- fine arts
-- religion
-- pop
-- literature
-- film
-- experimental film
-- broadcasting
-- new media
-- arts
-- fashion

/*
 * Social/Political issues/Economics:
 *
 * 0x8 0x0 social/political issues/economics (general)
 * 0x8 0x1 magazines/reports/documentary
 * 0x8 0x2 economics/social advisory
 * 0x8 0x3 remarkable people
 * 0x8 0x4 to 0xE reserved for future use
 * 0x8 0xF user defined
 */

UPDATE program SET category = 'Social/Policical/Economics' WHERE category = 'politik';
UPDATE program SET category = 'Magazines/Reports/Documentary' WHERE category IN ('reportagen','dokumentation','heimat','geschichte');
UPDATE program SET category = 'Economics/Social Advisory' WHERE category IN ('ratgeber','wirtschaft');
-- remarkable people

/*
 * Education/Science/Factual topics:
 *
 * 0x9 0x0 education/science/factual topics (general)
 * 0x9 0x1 nature/animals/environment
 * 0x9 0x2 technology/natural sciences
 * 0x9 0x3 medicine/physiology/psychology
 * 0x9 0x4 foreign countries/expeditions
 * 0x9 0x5 social/spiritual sciences
 * 0x9 0x6 further education
 * 0x9 0x7 languages
 * 0x9 0x8 to 0xE reserved for future use
 * 0x9 0xF user defined
 */

UPDATE program SET category = 'Education/Science/Factual' WHERE category = 'wissen';
UPDATE program SET category = 'Nature/animals/Environment' WHERE category = 'natur';
-- technology
UPDATE program SET category = 'Medicine/Physiology/Psychology' WHERE category = 'gesundheit';
-- foreign countries
UPDATE program SET category = 'Social/Spiritual Sciences' WHERE category = 'familie';
-- further education
-- languages

/*
 * Leisure hobbies:
 *
 * 0xA 0x0 leisure hobbies (general)
 * 0xA 0x1 tourism/travel
 * 0xA 0x2 handicraft
 * 0xA 0x3 motoring
 * 0xA 0x4 fitness and health
 * 0xA 0x5 cooking
 * 0xA 0x6 advertisement/shopping
 * 0xA 0x7 gardening
 * 0xA 0x8 to 0xE reserved for future use
 * 0xA 0xF user defined
 */

-- leisure hobbies
UPDATE program SET category = 'Tourism/Travel' WHERE category = 'reise';
UPDATE program SET category = 'Handicraft' WHERE category = 'heimwerken';
UPDATE program SET category = 'Motoring' WHERE category = 'motor+verkehr';
UPDATE program SET category = 'Fitness & Health' WHERE category = 'gymnastik';
UPDATE program SET category = 'Cooking' WHERE category = 'kochshow';
UPDATE program SET category = 'Advertizement/Shopping' WHERE category = 'homeshopping';
-- gardening

2.2 English (generic)

/*
 * See DVB-SI spec (ETSI EN 300 468 V1.11.1 (2010-04), page 40 at
 * <https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.11.01_60/en_300468v011101p.pdf>
 *
 * Undefined
 * 0x0 0x0 to 0xF undefined content
 * 
 * Movie/Drama:
 *
 * 0x1 0x0 movie/drama (general)
 * 0x1 0x1 detective/thriller
 * 0x1 0x2 adventure/western/war
 * 0x1 0x3 science fiction/fantasy/horror
 * 0x1 0x4 comedy
 * 0x1 0x5 soap/melodrama/folkloric
 * 0x1 0x6 romance
 * 0x1 0x7 serious/classical/religious/historical movie/drama
 * 0x1 0x8 adult movie/drama
 * 0x1 0x9 to 0xE reserved for future use
 * 0x1 0xF user defined
 */

UPDATE program SET category = 'Movie' WHERE category IN ('category','musical','n/a','other');
UPDATE program SET category = 'Movie - Detective/Thriller' WHERE category IN ('thriller','crime','crime/mystery');
UPDATE program SET category = 'Movie - Adventure/Western/War' WHERE category IN ('adventure','action','war','western');
UPDATE program SET category = 'Movie - Science Fiction/Fantasy/Horror' WHERE category IN ('science fiction', 'fantasy', 'mystery','horror');
UPDATE program SET category = 'Movie - Soap/melodrama/folkloric' WHERE category IN ('soap');
UPDATE program SET category = 'Movie - Romance' WHERE category IN ( 'romance','romantic comedy');
UPDATE program SET category = 'Movie - Comedy' WHERE category IN ('sitcom', 'drama/comedy');
-- Classical
UPDATE program SET category = 'Movie - Adult ' WHERE category = 'erotic';
UPDATE program SET category = 'Drama' WHERE category = 'drama';

/*
 * News/Current affairs:
 *
 * 0x2 0x0 news/current affairs (general)
 * 0x2 0x1 news/weather report
 * 0x2 0x2 news magazine
 * 0x2 0x3 documentary
 * 0x2 0x4 discussion/interview/debate
 * 0x2 0x5 to 0xE reserved for future use
 * 0x2 0xF user defined
 */

UPDATE program SET category = 'News' WHERE category IN ('current affairs', 'news','local news/sport');
UPDATE program SET category = 'News/Weather Report' WHERE category IN ('weather');
-- weather
UPDATE program SET category = 'News magazine' WHERE category = 'magazine';
UPDATE program SET category = 'Documentary' WHERE category IN( 'documentary','historical');
-- discussion

/*
 * Show/Game show:
 *
 * 0x3 0x0 show/game show (general)
 * 0x3 0x1 game show/quiz/contest
 * 0x3 0x2 variety show
 * 0x3 0x3 talk show
 * 0x3 0x4 to 0xE reserved for future use
 * 0x3 0xF user defined
 */

UPDATE program SET category = 'Entertainment' WHERE category IN ('humor', 'comedy','light entertainment/arts');
UPDATE program SET category = 'Game Show' WHERE category IN ('game show','game/reality','reality');
UPDATE program SET category = 'Variety Show' WHERE category IN ( 'entertainment','variety');
UPDATE program SET category = 'Talk Show' WHERE category IN ('reality/real-life','lifestyle','lifestyle/documentaries','talk show');

/*
 * Sports:
 *
 * 0x4 0x0 sports (general)
 * 0x4 0x1 special events (Olympic Games, World Cup, etc.)
 * 0x4 0x2 sports magazines
 * 0x4 0x3 football/soccer
 * 0x4 0x4 tennis/squash
 * 0x4 0x5 team sports (excluding football)
 * 0x4 0x6 athletics
 * 0x4 0x7 motor sport
 * 0x4 0x8 water sport
 * 0x4 0x9 winter sports
 * 0x4 0xA equestrian
 * 0x4 0xB martial sports
 * 0x4 0xC to 0xE reserved for future use
 * 0x4 0xF user defined
 */

UPDATE program SET category = 'Sports' WHERE category IN ('live sport','sport');
-- special events
-- magazines
UPDATE program SET category = 'Football (Soccer)' WHERE category = 'football';
UPDATE program SET category = 'Tennis/Squash' WHERE category = 'tennis';
UPDATE program SET category = 'Misc. Team Sports' WHERE category IN ('handball', 'volleyball');
UPDATE program SET category = 'Athletics' WHERE category = 'athletics';
UPDATE program SET category = 'Motor Sport' WHERE category = 'motorsport';
UPDATE program SET category = 'Water Sport' WHERE category = 'watersport';
UPDATE program SET category = 'Winter Sports' WHERE category = 'wintersport';
-- equestrian
UPDATE program SET category = 'Martial Sports' WHERE category = 'boxing';

/*
 * Children's/Youth programmes:
 *
 * 0x5 0x0 children's/youth programmes (general)
 * 0x5 0x1 pre-school children's programmes
 * 0x5 0x2 entertainment programmes for 6 to14
 * 0x5 0x3 entertainment programmes for 10 to 16
 * 0x5 0x4 informational/educational/school programmes
 * 0x5 0x5 cartoons/puppets
 * 0x5 0x6 to 0xE reserved for future use
 * 0x5 0xF user defined
 */

UPDATE program SET category = 'Kids' WHERE category = 'children';
UPDATE program SET category = 'Pre-School' WHERE category = 'pre-school';
-- pre-school
-- 6-14
-- 10-16
-- informational
UPDATE program SET category = 'Cartoons/Puppets' WHERE category IN ('animation');
UPDATE program SET category = 'Informational/Educational/School Programmes' WHERE category IN ('education','information');

/*
 * Music/Ballet/Dance:
 *
 * 0x6 0x0 music/ballet/dance (general)
 * 0x6 0x1 rock/pop
 * 0x6 0x2 serious music/classical music
 * 0x6 0x3 folk/traditional music
 * 0x6 0x4 jazz
 * 0x6 0x5 musical/opera
 * 0x6 0x6 ballet
 * 0x6 0x7 to 0xE reserved for future use
 * 0x6 0xF user defined
 */

UPDATE program SET category = 'Music/Ballet/Dance' WHERE category = 'music';
UPDATE program SET category = 'Rock/Pop' WHERE category IN ('rock', 'pop', 'alternative');
UPDATE program SET category = 'Classical Music' WHERE category = 'classical';
UPDATE program SET category = 'Folk Music' WHERE category = 'folk music';
UPDATE program SET category = 'Jazz' WHERE category = 'jazz/blues';
UPDATE program SET category = 'Musical/Opera' WHERE category = 'musical';
-- ballet

/*
 * Arts/Culture (without music):
 *
 * 0x7 0x0 arts/culture (without music, general)
 * 0x7 0x1 performing arts
 * 0x7 0x2 fine arts
 * 0x7 0x3 religion
 * 0x7 0x4 popular culture/traditional arts
 * 0x7 0x5 literature
 * 0x7 0x6 film/cinema
 * 0x7 0x7 experimental film/video
 * 0x7 0x8 broadcasting/press
 * 0x7 0x9 new media
 * 0x7 0xA arts/culture magazines
 * 0x7 0xB fashion
 * 0x7 0xC to 0xE reserved for future use
 * 0x7 0xF user defined
 */

UPDATE program SET category = 'Arts/Culture' WHERE category = 'arts and culture';
UPDATE program SET category = 'Religion' WHERE category = 'religion';
-- fine arts
-- religion
-- pop
-- literature
-- film
-- experimental film
-- broadcasting
-- new media
-- arts
-- fashion

/*
 * Social/Political issues/Economics:
 *
 * 0x8 0x0 social/political issues/economics (general)
 * 0x8 0x1 magazines/reports/documentary
 * 0x8 0x2 economics/social advisory
 * 0x8 0x3 remarkable people
 * 0x8 0x4 to 0xE reserved for future use
 * 0x8 0xF user defined
 */

UPDATE program SET category = 'Social/Policical/Economics' WHERE category IN ('business','business and finance');
-- UPDATE program SET category = 'Magazines/Reports/Documentary' WHERE category IN ('documentary');
UPDATE program SET category = 'Remarkable People' WHERE category IN ('biography','people/culture');
-- remarkable people

/*
 * Education/Science/Factual topics:
 *
 * 0x9 0x0 education/science/factual topics (general)
 * 0x9 0x1 nature/animals/environment
 * 0x9 0x2 technology/natural sciences
 * 0x9 0x3 medicine/physiology/psychology
 * 0x9 0x4 foreign countries/expeditions
 * 0x9 0x5 social/spiritual sciences
 * 0x9 0x6 further education
 * 0x9 0x7 languages
 * 0x9 0x8 to 0xE reserved for future use
 * 0x9 0xF user defined
 */

UPDATE program SET category = 'Education/Science/Factual' WHERE category = 'science';
UPDATE program SET category = 'Nature/animals/Environment' WHERE category IN ( 'nature','science/nature');
-- technology
UPDATE program SET category = 'Medicine/Physiology/Psychology' WHERE category = 'health';
-- foreign countries
-- UPDATE program SET category = 'Social/Spiritual Sciences' WHERE category = 'familie';
-- further education
-- languages

/*
 * Leisure hobbies:
 *
 * 0xA 0x0 leisure hobbies (general)
 * 0xA 0x1 tourism/travel
 * 0xA 0x2 handicraft
 * 0xA 0x3 motoring
 * 0xA 0x4 fitness and health
 * 0xA 0x5 cooking
 * 0xA 0x6 advertisement/shopping
 * 0xA 0x7 gardening
 * 0xA 0x8 to 0xE reserved for future use
 * 0xA 0xF user defined
 */

-- leisure hobbies
UPDATE program SET category = 'Tourism/Travel' WHERE category = 'travel';
-- UPDATE program SET category = 'Handicraft' WHERE category = 'heimwerken';
-- UPDATE program SET category = 'Motoring' WHERE category = 'motor+verkehr';
-- UPDATE program SET category = 'Fitness & Health' WHERE category = 'gymnastik';
-- UPDATE program SET category = 'Cooking' WHERE category = 'kochshow';
UPDATE program SET category = 'Advertizement/Shopping' WHERE category = 'shopping';
-- gardening