Merge remote-tracking branch 'origin/pr/296'
This commit is contained in:
commit
6d0a1d08b7
4 changed files with 79 additions and 8 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -11,6 +11,7 @@ data/dvb-scan
|
|||
|
||||
*.pyc
|
||||
.*.sw[op]
|
||||
*.bak
|
||||
|
||||
debian/changelog
|
||||
debian/files
|
||||
|
|
50
src/epggrab/module/xmltv.c
Normal file → Executable file
50
src/epggrab/module/xmltv.c
Normal file → Executable file
|
@ -352,6 +352,9 @@ static int _xmltv_parse_previously_shown
|
|||
|
||||
/*
|
||||
* Star rating
|
||||
* <star-rating>
|
||||
* <value>3.3/5</value>
|
||||
* </star-rating>
|
||||
*/
|
||||
static int _xmltv_parse_star_rating
|
||||
( epggrab_module_t *mod, epg_episode_t *ee, htsmsg_t *body )
|
||||
|
@ -359,6 +362,7 @@ static int _xmltv_parse_star_rating
|
|||
double a, b;
|
||||
htsmsg_t *stars, *tags;
|
||||
const char *s1, *s2;
|
||||
char *s1end, *s2end;
|
||||
|
||||
if (!mod || !ee || !body) return 0;
|
||||
if (!(stars = htsmsg_get_map(body, "star-rating"))) return 0;
|
||||
|
@ -366,12 +370,51 @@ static int _xmltv_parse_star_rating
|
|||
if (!(s1 = htsmsg_xml_get_cdata_str(tags, "value"))) return 0;
|
||||
if (!(s2 = strstr(s1, "/"))) return 0;
|
||||
|
||||
a = atof(s1);
|
||||
b = atof(s2 + 1);
|
||||
a = strtod(s1, &s1end);
|
||||
b = strtod(s2 + 1, &s2end);
|
||||
if ( a == 0.0f || b == 0.0f) return 0;
|
||||
|
||||
return epg_episode_set_star_rating(ee, (100 * a) / b, mod);
|
||||
}
|
||||
|
||||
/*
|
||||
* Tries to get age ratingform <rating> element.
|
||||
* Expects integer representing minimal age of watcher.
|
||||
* Other rating types (non-integer, for example MPAA or VCHIP) are ignored.
|
||||
*
|
||||
* Attribute system is ignored.
|
||||
*
|
||||
* Working example:
|
||||
* <rating system="pl"><value>16</value></rating>
|
||||
*
|
||||
* Currently non-working example:
|
||||
* <rating system="MPAA">
|
||||
* <value>PG</value>
|
||||
* <icon src="pg_symbol.png" />
|
||||
* </rating>
|
||||
*
|
||||
* TODO - support for other rating systems:
|
||||
* [rating system=VCHIP] values TV-PG, TV-G, etc
|
||||
* [rating system=MPAA] values R, PG, G, PG-13 etc
|
||||
* [rating system=advisory] values "strong sexual content","Language", etc
|
||||
*/
|
||||
static int _xmltv_parse_age_rating
|
||||
( epggrab_module_t *mod, epg_episode_t *ee, htsmsg_t *body )
|
||||
{
|
||||
uint8_t age;
|
||||
htsmsg_t *rating, *tags;
|
||||
const char *s1;
|
||||
|
||||
if (!mod || !ee || !body) return 0;
|
||||
if (!(rating = htsmsg_get_map(body, "rating"))) return 0;
|
||||
if (!(tags = htsmsg_get_map(rating, "tags"))) return 0;
|
||||
if (!(s1 = htsmsg_xml_get_cdata_str(tags, "value"))) return 0;
|
||||
|
||||
age = atoi(s1);
|
||||
|
||||
return epg_episode_set_age_rating(ee, age, mod);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse category list
|
||||
*/
|
||||
|
@ -509,8 +552,7 @@ static int _xmltv_parse_programme_tags
|
|||
|
||||
save3 |= _xmltv_parse_star_rating(mod, ee, tags);
|
||||
|
||||
|
||||
// TODO: parental rating
|
||||
save3 |= _xmltv_parse_age_rating(mod, ee, tags);
|
||||
}
|
||||
|
||||
/* Stats */
|
||||
|
|
4
src/webui/extjs.c
Normal file → Executable file
4
src/webui/extjs.c
Normal file → Executable file
|
@ -762,6 +762,10 @@ extjs_epg(http_connection_t *hc, const char *remain, void *opaque)
|
|||
htsmsg_add_u32(m, "start", e->start);
|
||||
htsmsg_add_u32(m, "end", e->stop);
|
||||
htsmsg_add_u32(m, "duration", e->stop - e->start);
|
||||
if(ee->star_rating)
|
||||
htsmsg_add_u32(m, "starrating", ee->star_rating);
|
||||
if(ee->age_rating)
|
||||
htsmsg_add_u32(m, "agerating", ee->age_rating);
|
||||
|
||||
if(e->serieslink)
|
||||
htsmsg_add_str(m, "serieslink", e->serieslink->uri);
|
||||
|
|
32
src/webui/static/app/epg.js
Normal file → Executable file
32
src/webui/static/app/epg.js
Normal file → Executable file
|
@ -40,6 +40,8 @@ tvheadend.epgDetails = function(event) {
|
|||
content += '</div>';
|
||||
content += '<div class="x-epg-desc">' + event.episode + '</div>';
|
||||
content += '<div class="x-epg-desc">' + event.description + '</div>';
|
||||
content += '<div class="x-epg-meta">' + event.starrating + '</div>';
|
||||
content += '<div class="x-epg-meta">' + event.agerating + '</div>';
|
||||
content += '<div class="x-epg-meta">' + tvheadend.contentGroupLookupName(event.contenttype) + '</div>';
|
||||
|
||||
if (event.ext_desc != null)
|
||||
|
@ -228,6 +230,10 @@ tvheadend.epg = function() {
|
|||
dateFormat : 'U' /* unix time */
|
||||
}, {
|
||||
name : 'duration'
|
||||
}, {
|
||||
name : 'starrating'
|
||||
}, {
|
||||
name : 'agerating'
|
||||
}, {
|
||||
name : 'contenttype'
|
||||
}, {
|
||||
|
@ -272,11 +278,17 @@ tvheadend.epg = function() {
|
|||
}
|
||||
}
|
||||
|
||||
function renderText(value, meta, record, rowIndex, colIndex, store) {
|
||||
setMetaAttr(meta, record);
|
||||
function renderText(value, meta, record, rowIndex, colIndex, store) {
|
||||
setMetaAttr(meta, record);
|
||||
|
||||
return value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
function renderInt(value, meta, record, rowIndex, colIndex, store) {
|
||||
setMetaAttr(meta, record);
|
||||
|
||||
return '' + value;
|
||||
}
|
||||
|
||||
var epgCm = new Ext.grid.ColumnModel([ actions, {
|
||||
width : 250,
|
||||
|
@ -321,6 +333,18 @@ tvheadend.epg = function() {
|
|||
header : "Channel",
|
||||
dataIndex : 'channel',
|
||||
renderer : renderText
|
||||
}, {
|
||||
width : 50,
|
||||
id : 'starrating',
|
||||
header : "Stars",
|
||||
dataIndex : 'starrating',
|
||||
renderer : renderInt
|
||||
}, {
|
||||
width : 50,
|
||||
id : 'agerating',
|
||||
header : "Age",
|
||||
dataIndex : 'agerating',
|
||||
renderer : renderInt
|
||||
}, {
|
||||
width : 250,
|
||||
id : 'contenttype',
|
||||
|
|
Loading…
Add table
Reference in a new issue