Centralise genre table and use the same one for EPG & TS.

Add missing 'Drama' genre.
Show genre in recording-details popup.
This commit is contained in:
HummyPkg 2018-01-28 11:38:28 +00:00
parent df05e23415
commit 165b1de49e
7 changed files with 57 additions and 46 deletions

View File

@ -84,11 +84,13 @@ puts "
if {[$record showing]} {
puts [progressbar [$record percent]]
}
set icon [$record type_icon]
if {$icon != ""} { set icon "<img class=genre src=$icon>" }
puts "
</td>
</tr><tr>
<th>Type</th>
<td>[$record get content_type] ([$record get content_code])</td>
<td>$icon [$record get content_type] ([$record get content_code])</td>
</tr>
"

View File

@ -186,9 +186,9 @@ puts {
class="text ui-widget-content ui-corner-all">
}
set glist [ts genrelist]
foreach genre [array names glist] {
lassign $glist($genre) txt img
foreach genre [dict keys $::epg::genrelist] {
lassign $::epg::genrelist($genre) txt img
if {$txt eq "Unknown" } continue
if {$img eq "Unclassified"} {
set img /images/173_3_26_G3_$img.png
} else {

View File

@ -14,6 +14,6 @@ puts "{"
puts "\"title\" : \"[jescape [$ts get title]]\","
puts "\"synopsis\" : \"[jescape [$ts get synopsis]]\","
puts "\"guidance\" : \"[jescape [$ts get guidance]]\","
puts "\"genre\" : [jescape [$ts get genre]]"
puts "\"genre\" : [jescape [$ts genrenib]]"
puts "}"

View File

@ -131,6 +131,13 @@ if {$type eq "ts"} {
<th>Channel</th>
<td>[epg channelicon [$ts get channel_name] 50 "vertical-align: middle"]
[$ts get channel_num] - [$ts get channel_name]</td>
</tr>
"
lassign [$ts genre_info] txt img
puts "
<tr>
<th>Genre</th>
<td><img src=\"$img\">$txt ([$ts genrenib])</td>
</tr><tr>
<th>Start Time</th>
<td>"

View File

@ -188,19 +188,9 @@ proc entry {file} {{i 0}} {
}
icon [epg channeliconpath [$ts get channel_name]] \
[$ts get channel_name] "" "va browsechannel"
set genre [$ts get genre]
set glist [ts genrelist]
if {[dict exists $glist $genre]} {
set ret $glist($genre)
} else {
set ret $glist(0)
}
lassign $ret txt img
if {$img eq "Unclassified"} {
icon "/images/173_3_26_G3_$img.png" $txt "" "va genre"
} else {
icon "/images/173_3_00_G3_$img.png" $txt "" "va genre"
}
lassign [$ts genre_info] txt img
icon "$img" $txt "" "va genre"
lassign [ts iconset $ts] icons attrs

View File

@ -21,6 +21,27 @@ if {[file exists $::epgdbpath]} {
set ::qepg 1
}
# Maps the top nibble of descriptor 84 (content_type) to a description and
# icon.
set ::epg::genrelist {
0 { Unclassified Unclassified }
1 { Film Movie }
2 { "News & Factual" News }
3 { Entertainment Show }
4 { Sport Sports }
5 { Children Children }
6 { Entertainment Music }
7 { Art Art }
8 { Society Society }
9 { Education Education }
10 { Lifestyle Leisure }
11 { Unknown Unclassified }
12 { Unknown Unclassified }
13 { Unknown Unclassified }
14 { Unknown Unclassified }
15 { Drama Show }
}
# * service_id, event_id, start, duration, encrypted, name, text
# * warning, content code, content type,
# * event CRID, series CRID, rec CRID, warning mode
@ -95,19 +116,7 @@ epg method end {} {
}
epg method type_icon {} {
set img ""
switch -- $content_code {
1 { set img "Movie" }
2 { set img "News" }
3 { set img "Show" }
4 { set img "Sports" }
5 { set img "Children" }
6 { set img "Music" }
7 { set img "Art" }
8 { set img "Society" }
9 { set img "Education" }
10 { set img "Leisure" }
}
lassign $::epg::genrelist($content_code) x img
if {$img != ""} {
return "/images/173_3_00_G3_$img.png"
} else {

View File

@ -313,6 +313,9 @@ ts method setguidance {newguidance} {
}
ts method setgenre {newgenre} {
if {$newgenre <= 15} {
set newgenre $($newgenre << 4)
}
exec /mod/bin/hmt "+setgenre=-${newgenre}" $file
set genre $newgenre
}
@ -492,21 +495,6 @@ proc {ts touchgroup} {target ref} {
}
}
proc {ts genrelist} {} {
return {
0 { Unclassified Unclassified }
16 { Film Movie }
32 { "News & Factual" News }
48 { Entertainment Special }
64 { Sport Sports }
80 { Children Children }
96 { Entertainment Special }
144 { Education Education }
160 { Lifestyle Leisure }
240 { Drama Show }
}
}
proc {ts resetnew} {dir} {
if {![file isdirectory $dir]} return
if {![file exists "$dir/.series"]} {
@ -809,3 +797,18 @@ ts method tsr {} {
return $tsr
}
ts method genrenib {} {
return $($genre >> 4)
}
ts method genre_info {} {
set g [$self genrenib]
lassign $::epg::genrelist($g) txt img
if {$img eq "Unclassified"} {
set img "/images/173_3_26_G3_$img.png"
} else {
set img "/images/173_3_00_G3_$img.png"
}
return [list $txt $img]
}