diff --git a/webif/cgi-bin/epg/info.jim b/webif/cgi-bin/epg/info.jim index 9e60c69d..31bbac70 100755 --- a/webif/cgi-bin/epg/info.jim +++ b/webif/cgi-bin/epg/info.jim @@ -84,11 +84,13 @@ puts " if {[$record showing]} { puts [progressbar [$record percent]] } +set icon [$record type_icon] +if {$icon != ""} { set icon "" } puts " Type - [$record get content_type] ([$record get content_code]) + $icon [$record get content_type] ([$record get content_code]) " diff --git a/webif/html/browse/assets.jim b/webif/html/browse/assets.jim index 91c2ec62..507ed883 100755 --- a/webif/html/browse/assets.jim +++ b/webif/html/browse/assets.jim @@ -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 { diff --git a/webif/html/browse/epgtitle.jim b/webif/html/browse/epgtitle.jim index 9601fafe..36c1c4ae 100755 --- a/webif/html/browse/epgtitle.jim +++ b/webif/html/browse/epgtitle.jim @@ -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 "}" diff --git a/webif/html/browse/file.jim b/webif/html/browse/file.jim index 94cb5669..e35e86dd 100755 --- a/webif/html/browse/file.jim +++ b/webif/html/browse/file.jim @@ -131,6 +131,13 @@ if {$type eq "ts"} { Channel [epg channelicon [$ts get channel_name] 50 "vertical-align: middle"] [$ts get channel_num] - [$ts get channel_name] + + " + lassign [$ts genre_info] txt img + puts " + + Genre + $txt ([$ts genrenib]) Start Time " diff --git a/webif/html/browse/index.jim b/webif/html/browse/index.jim index aecac16e..d0b9c710 100755 --- a/webif/html/browse/index.jim +++ b/webif/html/browse/index.jim @@ -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 diff --git a/webif/lib/epg.class b/webif/lib/epg.class index 98e1e5bb..0b65b367 100644 --- a/webif/lib/epg.class +++ b/webif/lib/epg.class @@ -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 { diff --git a/webif/lib/ts.class b/webif/lib/ts.class index 9a83cc74..c9591f64 100644 --- a/webif/lib/ts.class +++ b/webif/lib/ts.class @@ -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] +} +