EPG missing the whole channel 4 data for tomorrow

MymsMan

Ad detector
No but I am in South region,
RS EPG is sourced from the first machine in each region to connect and so doesn't always reflect what the webif EPG shows

There have been many reports of gaps in the EPG over the years - nothing that that can be done about it
 

hairy_mutley

Active Member
That looks like a bug, it appears to depend on the display width.
If you display 6am with a width of 6 hours, it appears OK, if you change the display width to 4 or 5 the channel vanishes (you can change it in the URL). By messing around with the width in the URL (setting 2 or 3) you can get other channels to vanish.
I presume that there must be a problem if the programme at the start and end of the period is the same?
EDIT ... there must be another factor as well, because some channels remain even though the programme doesn't change.
Best "rule" I can come up with so far is that the channel vanishes if the grid start matches the programme start time and the programme ends after the grid width.
 
Last edited:

MymsMan

Ad detector
I agree with @hairy_mutley and can make BBC 1 disappear by settings hours=3 in the URL

I have previously reported other display anomalies where the RS schedule database has two programmes in the same time slot an which is shown varies depending on where you start the display (can't find the thread)

The same bug also exists in the webif epg
1613505985021.png
 
Last edited:

/df

Well-Known Member
I can reproduce this with eg BBC 4HD in the WebIf EPG starting at 03:30 and hours set to 1, SeaMonkey 2.53.6, under conditions like those proposed by @hairy_mutley: the channel line is not shown if no programme either starts or ends (as each end is followed by a start, this may be the same thing, off-by-1s) within the bounds of the scaled EPG, with the start and end times not included.

When off the air, the channel has 2-hour "This is BBC Four" programmes starting at 03:30. With EPG start (stt) = 03:30 and hours = 2, there is no BBC4HD line; with hours = 2.05, it reappears. Similarly, with start = 04:00 and hours = 1.5, there's no line; with hours = 1.55, it reappears (including the previous programme partially within the scaled period).

Each line of the EPG display comprises a div with class xechan (the channel cell) followed by a sequence of divs with class xeprog and a fixed pixel width calculated from the hour scale as a proportion of 1000px, representing each scheduled programme. The whole EPG is a sequence of such divs: there isn't any per-row nesting (maybe a 2-column table with a row per channel would have been a more semantically accurate structure).

The Mozilla developer tools as well as the View source function show all the divs for BBC FOUR HD absent from the page, which fingers this in /mod/webif/html/xepg/index.jim (line 82ff., 87 in particular), as an empty records is the only condition that doesn't write the channel cell:
Code:
if {$::qepg} {                                                                
        set args [list -trange "$stt:$ett" -ljoin 1]                          
        if {$favgroup} {                                                      
                lappend args -fav $favgroup                                   
        }                                                                     
        set records [epg dbfetch dump {*}$args]                               
} else {                                                                      
...
Apparently it only asks for EPG data within the scale of the display: here stt is the start time rounded down to the nearest half-hour and ett is the scaled end time.

The problem is in /mod/webif/lib/epg.class: a typo where $stt should be $ett, but also a logical one where the opposite of < is >= and not >, I think.
Code:
--- /mod/webif/lib/epg.class.org
+++ /mod/webif/lib/epg.class
@@ -480,11 +480,11 @@
                                -trange {
                                        lassign [split $v :] stt ett
                                        append q "and (e.start is null or
                                        (e.start > $stt and e.start < $ett) or
                                        (e.end > $stt and e.end < $ett) or
-                                       (e.start < $stt and e.end > $stt)
+                                       (e.start <= $stt and e.end >= $ett)
                                        ) "
                                }
                                -fav {
                                        set v $(1 << ($v - 1))
                                        append from \
 

hairy_mutley

Active Member
/df's webif mod brings back missing channels for me.

It is interesting looking at webif vs RS that the bracketed start & end times shown for programmes differ between the two.
RS always shows the programme's actual start and end time (as I might expect), see post #6
webif shows these times (unexpectedly) clipped to the grid range;
- e.g. in post #9 "This is BBC Four (06:00 - 09:00)"; the times match the grid range, but the programme almost certainly starts earlier and finishes later (typically it might be 05:30 - 18:58)
 

/df

Well-Known Member
There's a good reason why that happens: the start and end times are trimmed to calculate the display width before the display text is constructed (the last two lines of the first patch chunk below). Try this:
Code:
--- /mod/webif/html/xepg/index.jim.org
+++ /mod/webif/html/xepg/index.jim
@@ -263,6 +263,15 @@
 
        if {$es < $le} continue
 
+       set perc [$e percent]
+       set showing 0
+       if {$perc > 0 && $perc < 100} { set showing 1 }
+
+       set txt [list [cgi_quote_html [$e get name]] "([\
+           clock format $es -format "%H:%M"] - [\
+           clock format $ee -format "%H:%M"])[\
+           expr {$showing? " ($perc%)": ""}]"]
+
        if {$es < $stt} { set es $stt }
        if {$ee > $ett} { set ee $ett }
 
@@ -292,21 +301,6 @@
        set recopts 1
        if {[$e get series_crid] ne ""} { set recopts 2 }
 
-       set perc [$e percent]
-       set showing 0
-       if {$perc > 0 && $perc < 100} { set showing 1 }
-
-       set txt "[cgi_quote_html [$e get name]] <span>([\
-           clock format $es -format "%H:%M"] - [\
-           clock format $ee -format "%H:%M"])"
-       if {$showing} { append txt " ($perc%)" }
-       append txt "</span>"
-
-       set htxt "[cgi_quote_html [$e get name]] ([\
-           clock format $es -format "%H:%M"] - [\
-           clock format $ee -format "%H:%M"])"
-       if {$showing} { append hxt " ($perc%)" }
-
        set lbg $bg
        # Set backround if scheduled. 1 1-off, 2 series, 3 recorded, 4 skipped
        switch -- [$e scheduled] {
@@ -318,11 +312,11 @@
        }
 
        puts "<div class=\"xeprog $lbg\"
-           style=\"width: [expr $px - 4]px;\" title=\"$htxt\">
+           style=\"width: [expr $px - 4]px;\" title=\"[join $txt]\">
            <a class=event href=# xs=[$e get service_id]
                xe=[$e get event_id] sch=[$e get sched_type]
                rec=$recopts>"
-       puts $txt
+       puts [format "%s <span>%s</span>" {*}$txt]
        puts "</a>"
        puts "</div>"
 }
 

hairy_mutley

Active Member
The first one was easy to test, I patched by hand. The second is a bit bigger, and I can't remember the incantation to apply the patch.
 

hairy_mutley

Active Member
@/df Fair enough, use the already patched :). Machines updated, that seems to work, thanks.

Since the RS only has the first of these problems, I presume that it uses a different code base which also need changing?

While we are in that area of the webif; any idea why the right hand end of the grid gets jagged? (as in post #9).
I don't actually think that it is the end that is wrong, I think that the misalignment gets introduced earlier in the line and may be accumulating with the number of programme transitions? Or am I just getting too fussy now?
Is this just an example of a classic accumulated rounding error in the scaling cause by rounding too early?
i.e. what happens if you render 6 * 10 minute programs on a 1 hour 1000pixel grid?
10 minutes rounds to 167 * 6 * 167 = 1002. The only solution is to use float precision and only round as each final grid x position is calculated.
As I said... am I being to fussy?
 
Last edited:

/df

Well-Known Member
Possibly. In post #9 it looks as if the large number of short programmes causes the C5 line to extend. The positions are calculated for each programme div separately, so there's no cumulative rounding error. Looking again, there's actually a gap between each pair of programmes. And this is why (unwanted, or at least inconsistent with the calculated positions, left padding):
Code:
--- /mod/webif/html/xepg/style.css.org
+++ /mod/webif/html/xepg/style.css
@@ -99,7 +99,7 @@
        float: left;
        vertical-align: middle;
        height: 25px;
-       padding: 4px 0 3px 2px;
+       padding: 4px 0 3px 0px;
        margin: 3px 0 3px 2px;
        border: 1px solid #ccc;
        border-radius: 10px;
And
...Since the RS only has the first of these problems, I presume that it uses a different code base which also need changing?
...
Even if the same files were used, the RS server would have to be updated separately. RS is not my area, although I could point out that the size attributes of the login fields cause the fields to overflow the login pseudo-dialogue (if present, should be 30 instead of 40).
 
Last edited:

/df

Well-Known Member
Are you using the beta WebIf 1.4.9-6? Otherwise, please wait for that to be released real soon now and see if you still have problems.
 
Top