Epgdb » History » Version 22
Adam Sutton, 2012-11-13 18:06
1 | 22 | Adam Sutton | h1. EPG database |
---|---|---|---|
2 | 2 | Dave Chapman | |
3 | 22 | Adam Sutton | Tvheadend maintains an internal (in memory) EPG database for the purpose of providing a viewable programming schedule and scheduling recordings etc. |
4 | 2 | Dave Chapman | |
5 | 22 | Adam Sutton | This document describes the basic structures (and connections) that make up the database. |
6 | 5 | Dave Chapman | |
7 | 22 | Adam Sutton | h2. On-disk format |
8 | 1 | Dave Chapman | |
9 | 22 | Adam Sutton | The database is written out to disk on shutdown and loaded in on startup. This avoids having to wait for the various grabbers to re-populate it. |
10 | 1 | Dave Chapman | |
11 | 22 | Adam Sutton | The details of the on-disk structure are not covered here (yet), though in essence its just a serialised representation of the in-memory format. |
12 | 1 | Dave Chapman | |
13 | 22 | Adam Sutton | Should you wish to convert the binary format into a human readable format then you can use epgdump script provided in the source package: |
14 | 1 | Dave Chapman | |
15 | 22 | Adam Sutton | <pre> |
16 | ./support/epgdump PATH_TO_DB |
||
17 | </pre> |
||
18 | 1 | Dave Chapman | |
19 | 22 | Adam Sutton | Note: in most cases PATH_TO_DB will be ~TVH_USER/.hts/epgdb.v2 |
20 | 1 | Dave Chapman | |
21 | 22 | Adam Sutton | h2. Memory format |
22 | 1 | Dave Chapman | |
23 | 22 | Adam Sutton | All objects have an _id_ field that is internally generated within Tvheadend and is an auto-incrementing number that is global across all object types. This is generally the ID that is also used for referencing object within the HTSP API. |
24 | 1 | Dave Chapman | |
25 | 22 | Adam Sutton | The tables below provide detailed information about each object. |
26 | 1 | Dave Chapman | |
27 | 22 | Adam Sutton | * The _HTSP_ column indicates the name of the field in the HTSP event messages (see "eventAdd":https://www.lonelycoder.com/redmine/projects/tvheadend/wiki/HTSP#eventAdd-Added-in-version-6) |
28 | 1 | Dave Chapman | |
29 | 22 | Adam Sutton | * The _Grabber_ columns indicate which grabbers support the fields. Though it should be noted whether a specific field is actually filled in will depend on the upstream EPG source data. |
30 | 1 | Dave Chapman | |
31 | 22 | Adam Sutton | * Fields marked NA are either internally generated, represent linkages or are not in use within the object. |
32 | 1 | Dave Chapman | |
33 | 22 | Adam Sutton | * Some fields may be supported by the grabber protocols but simply not (yet) processed by TVH, in this case the fields are marked _N_. |
34 | 1 | Dave Chapman | |
35 | 22 | Adam Sutton | h3. Object URIs |
36 | 1 | Dave Chapman | |
37 | 22 | Adam Sutton | The object unique references provided by the grabbers (URIs) are used to help differentiate between data that represents the same thing. This can be very useful for DVR operations where you need to be able to detect a set of broadcasts to record and eliminate duplicates content etc... |
38 | 1 | Dave Chapman | |
39 | 22 | Adam Sutton | Not all grabbers provide such IDs, however for all EPG object (except broadcast and episode_number) they are required within TVH. Therefore if no URI is provided by the grabber TVH will generate one internally. This will have the format: |
40 | |||
41 | <pre> |
||
42 | tvh://channel-CHANID/bcast-BCASTID/episode |
||
43 | </pre> |
||
44 | |||
45 | Within the grabber types the presence of unique IDs will depend a lot on the upstream data source. For example EIT only has support for systems using CRIDs (e.g. Freesat or Freeview in the UK), XMLTV only has support for systems using dd_progid (Note: this will change in future as other systems exist). |
||
46 | |||
47 | h3. Brand object - epg_brand_t |
||
48 | |||
49 | Brands can be seen as analogous to a TV Show. |
||
50 | |||
51 | Examples might include _The Simpsons_, _24_, _Eastenders_, etc. |
||
52 | |||
53 | |\4=. | |\4=.Grabbers| |
||
54 | |_.Field|_.Type|_.Description|_.HTSP| |_.DVB EIT|_.OpenTV|_.XMLTV|_.PyEPG| |
||
55 | |id|uint32_t|Internal ID|brandId| |\4=. NA| |
||
56 | |uri|char*|Unique ID (from grabber)| | |=. N|=. N|=. N|=. Y| |
||
57 | |title|lang_str_t*|Brand name| | |=. N|=. N|=. N|=. Y| |
||
58 | |summary|lang_str_t*|Brand summary| | |=. N|=. N|=. N|=. Y| |
||
59 | |season_count|uint16_t|Total number of seasons| | |=. N|=. N|=. N|=. Y| |
||
60 | |image|char*|Brand image| | |=. N|=. N|=. N|=. Y| |
||
61 | |seasons|epg_season_list_t|Season list| ||\4=. NA| |
||
62 | |episodes|epg_episode_list_t|Episode list| ||\4=. NA| |
||
63 | |||
64 | Note: At present the XMLTV standard does not allow for proper brand identification, however some custom extensions exist that will eventually be supported. |
||
65 | |||
66 | h3. Season object - epg_season_t |
||
67 | |||
68 | A Season represents a single season of a TV Show. |
||
69 | |||
70 | Examples might include _The Simpsons - Season 10_, _24 - Season 2_, etc. |
||
71 | |||
72 | |\4=. | |\4=.Grabbers| |
||
73 | |_.Field|_.Type|_.Description|_.HTSP| |_.DVB EIT|_.OpenTV|_.XMLTV|_.PyEPG| |
||
74 | |id|uint32_t|Internal ID|seasonId| |\4=. NA| |
||
75 | |uri|char*|Unique ID (from grabber)| | |=. N|=. N|=. N|=. Y| |
||
76 | |summary|lang_str_t*|Season summary| | |=. N|=. N|=. N|=. Y| |
||
77 | |number|uint16_t|The season number| | |=. N|=. N|=. N|=. Y| |
||
78 | |episode_count|uint16_t|Total number of episodes| | |=. N|=. N|=. N|=. Y| |
||
79 | |image|char*|Season image| | |=. N|=. N|=. N|=. Y| |
||
80 | |brand|epg_brand_t|Parent brand| | |\4=. NA| |
||
81 | |episodes|epg_episode_list_t|Episode list| | |\4=. NA| |
||
82 | |||
83 | Note: At present the XMLTV standard does not allow for proper season identification, however some custom extensions exist that will eventually be supported. |
||
84 | |||
85 | h3. Episode object - epg_episode_t |
||
86 | |||
87 | An episode represents the information that is shared between broadcasts of the same content. |
||
88 | |||
89 | |\4=. | |\4=.Grabbers| |
||
90 | |_.Field|_.Type|_.Description|_.HTSP| |_.DVB EIT|_.OpenTV|_.XMLTV|_.PyEPG| |
||
91 | |id|uint32_t|Internal ID|episodeId| |\4=. NA| |
||
92 | |uri|char*|Unique ID (from grabber)| | |=. Y^1|=. N|=. Y^2|=. Y| |
||
93 | |title|lang_str_t*|Title|title| |=. Y|=. Y|=. Y|=. Y| |
||
94 | |subtitle|lang_str_t*|Sub-title| | |=. N|=. N|=. Y|=. Y| |
||
95 | |summary|lang_str_t*|Summary|summary^3| |=. Y|=. N|=. Y|=. Y| |
||
96 | |description|lang_str_t*|An extended description|description^3| |=. Y|=. N|=. Y|=. Y| |
||
97 | |image|char*|URL of episode image|image| |=. N|=. N|=. N|=. Y| |
||
98 | |genre|epg_genre_list_t|Episode genre(s)|contentType^4| |=. Y|=. Y|=. Y|=. Y| |
||
99 | |epnum|epg_episode_num_t|Episode numbering| | |\4=. NA (see below)| |
||
100 | |is_bw|uint8_t|Is black and white| | |=. Y|=. N|=. Y|=. Y| |
||
101 | |star_rating|uint8_t|Star rating|starRating| |=. N|=. N|=. Y|=. N| |
||
102 | |age_rating|uint8_t|Age certificate|ageRating| |=. Y|=. N|=. N|=. N| |
||
103 | |first_aired|time_t|Original airdate|firstAired| |=. N|=. N|=. N|=. N| |
||
104 | |brand|epg_brand_t*|(Grand-)Parent brand| | |\4=. NA| |
||
105 | |season|epg_season_t*|Parent season| | |\4=. NA| |
||
106 | |broadcasts|epg_broadcast_list_t|Broadcast list| | |\4=. NA| |
||
107 | |||
108 | * ^1 This is only provided by EIT systems supporting the CRID system. |
||
109 | * ^2 This is only currently provided by XMLTV systems using the dd_progid namespace. |
||
110 | * ^3 Summary/description will be replaced with the versions in the specific broadcast, if they differ. |
||
111 | * ^4 contentType contains only the first genre in the case where multiple genres are stored. |
||
112 | |||
113 | h4. Episode numbering object - epg_episode_num_t: |
||
114 | |||
115 | The episode number can contains both episode and season numbering. Season information is duplicated here to remove the requirement to create "dummy" season objects simply to support a season number. |
||
116 | |||
117 | |\4=. | |\4=.Grabbers| |
||
118 | |_.Field|_.Type|_.Description|_.HTSP| |_.DVB EIT|_.OpenTV|_.XMLTV|_.PyEPG| |
||
119 | |s_num|uint16_t|Series number|seasonNumber| |=. N|=. N|=. Y|=. Y| |
||
120 | |s_cnt|uint16_t|Series count|seasonCount| |=. N|=. N|=. Y|=. Y| |
||
121 | |e_num|uint16_t|Episode number|episodeNumber| |=. N|=. N|=. Y|=. Y| |
||
122 | |e_cnt|uint16_t|Episode count|episodeCount| |=. N|=. N|=. Y|=. Y| |
||
123 | |p_num|uint16_t|Part number|partNumber| |=. N|=. N|=. Y|=. Y| |
||
124 | |p_cnt|uint16_t|Part count|partCount| |=. N|=. N|=. Y|=. Y| |
||
125 | |text|char*|Arbitary text description of episode num|episodeOnscreen| |=. N|=. N|=. Y|=. N| |
||
126 | |||
127 | h3. Broadcast object - epg_broadcast_t |
||
128 | |||
129 | 17 | Dave Chapman | This object contains the details of a specific airing (channel & time) of an episode. |
130 | 19 | Dave Chapman | |
131 | 22 | Adam Sutton | |\4=. | |\4=.Grabbers| |
132 | 17 | Dave Chapman | |_.Field|_.Type|_.Description|_.HTSP| |_.DVB EIT|_.OpenTV|_.XML TV|_.PyEPG| |
133 | 22 | Adam Sutton | |id|uint32_t|Internal ID|eventId| | |\4=. NA| |
134 | |uri|char*|Unique ID (from grabber)| | |\4=. NA| |
||
135 | |dvb_eid|uint16_t|DVB Event ID| | |=. Y|=. N|=. N|=. N| |
||
136 | |start|time_t|Start time (UTC)|start| |=. Y|=. Y|=. Y|=. Y| |
||
137 | |stop|time_t|Stop time (UTC)|stop| |=. Y|=. Y|=. Y|=. Y| |
||
138 | |is_widescreen|uint8_t|Is widescreen| | |=. Y|=. N|=. Y|=. Y| |
||
139 | |is_hd|uint8_t|Is HD| | |=. Y|=. N|=. Y|=. Y| |
||
140 | |lines|uint16_t|Lines in image (quality)| | |=. Y|=. N|=. Y|=. N| |
||
141 | |aspect|uint16_t|Aspect ratio (*100)| | |=. Y|=. N|=. Y|=. N| |
||
142 | |is_deafsigned|uint8_t|In screen signing| | |=. Y|=. N|=. Y|=. N| |
||
143 | |is_subtitled|uint8_t|Teletext subtitles| | |=. Y|=. N|=. Y|=. N| |
||
144 | |is_audio_desc|uint8_t|Audio description| | |=. Y|=. N|=. Y|=. N| |
||
145 | |is_new|uint8_t|New series / film premiere| | |=. N|=. N|=. Y|=. Y| |
||
146 | |is_repeat|uint8_t|Repeat screening| | |=. N|=. N|=. Y|=. Y| |
||
147 | |summary|lang_str_t*|Summary|summary^1| |=. Y|=. Y|=. Y|=. Y| |
||
148 | |description|lang_str_t*|An extended description|description^1| |=. Y|=. Y|=. Y|=. Y| |
||
149 | |episode|epg_episode_t*|Link to tvheadend episode object| | |\4=. NA| |
||
150 | |serieslink|epg_serieslink_t*|SeriesLink| | |\4=. NA| |
||
151 | |channel|struct channel*|Channel being broadcast on|channelId| |\4=. NA| |
||
152 | 1 | Dave Chapman | |
153 | 22 | Adam Sutton | ^1 summary/description will override the versions in the episode object |
154 | 1 | Dave Chapman | |
155 | 22 | Adam Sutton | h3. SeriesLink object - epg_serieslink_t |
156 | 1 | Dave Chapman | |
157 | 22 | Adam Sutton | This object represents a related set of broadcasts intended to be automatically recorded by a DVR. |
158 | 1 | Dave Chapman | |
159 | 22 | Adam Sutton | |\4=. | |\4=.Populated from| |
160 | 1 | Dave Chapman | |_.Field|_.Type|_.Description|_.HTSP| |_.DVB EIT|_.OpenTV|_.XML TV|_.PyEPG| |
161 | 22 | Adam Sutton | |id|uint32_t|Internal ID|serieslinkId| |\4=. NA| |
162 | |uri|char*|Unique ID (from grabber)| | |=. Y|=. Y|=. Y|=. N| |
||
163 | |broadcasts|epg_broadcast_list_t|List of broadcasts| | |\4=. NA| |