• The forum software that supports hummy.tv has been upgraded to XenForo 2.1!

    This upgrade brings a number of improvements including the ability to bookmark posts to come back to later. Please bear with us as we continue to tweak things and open a new thread for any questions, issues or suggestions in Site/Forum Issues.

WebIf Tweaks: Button to reset the EPG when incomplete

OP
Matthew

Matthew

Member
So..... do I need to look at making epg more responsive to on-disk database changes?
I suspect it would help, had the issue yesterday, oddly had to do the reset twice before the EPG was back! most channels had only 1 program in the guide.

Ah, thanks. I don't seem to get any of those missing programmes, just completely missing LCNs form time to time. Like the EPG starts at ITV (Ch 3) and 'misses out' BBC1 and BBC2.
Have you tested to see if the reset does anything, I`m wondering if a LCN has no programmes its ignored.
 
OP
Matthew

Matthew

Member
Had the problem again today, this time I noted there were missing LCN and it appears they were missing as they had no programs!

Applying the reset was only partially successful (i.e. some missing LCNs came back with just 1 or 2 programs) this turned out to be due to the simultaneous running of ad-detect, as soon as ad-detect had finished the reset was fully successful, @af123 so it seems population of the EPG is effected by a busy processor!

@Trev contrary to my previous reply, yes this fixes gaps and missing LCNs
 
OP
Matthew

Matthew

Member
Having used this mod for a while its clear the problem is a busy CPU whilst populating the EPG results in missing entries, that means resetting the EPG also only works if the CPU is not too busy.

With that in mind I've modified adding a CPU busy check, the reset only running if the CPU is at 30% or less use (just an arbitrary figure, I'm not sure what percentage is too busy).

First create a new file cpu.jim in /mod/webif/html/xepg/ and place the following in that file.

Code:
#!/mod/bin/jimsh

source /mod/webif/lib/setup

set line [lindex [split [exec /mod/bin/vmstat 3 2] "\n"] end]
regsub -all -- {[[:space:]]+} $line " " line
lassign [split $line " "] \
    x x x x x x x x x x x x x ucpu scpu idle wcpu
set cpuuse [expr $ucpu+$wcpu+$scpu]

httpheader "application/json"

puts "
{
    \"data\":
    { \"cpu\": $cpuuse }
}
"
This file must be made executable, use Diag->File Editor to do that.

index.jim is changed as previously

Code:
--- /mod/webif/html/xepg/index_orig.jim
+++ /mod/webif/html/xepg/index.jim

@@ -317,7 +338,9 @@
<div style=\"clear: both;\">
<small><button id=epgswitch>
     Switch to standard now/next display.
-</button></small>
+</button></small>&nbsp;&nbsp;&nbsp;&nbsp;<button id=resetEPG>
+    Reset EPG
+</button>&nbsp;&nbsp;&nbsp;&nbsp;
+<span id=results></span>
</div>

<a href=/settings/settings.jim>
script.js is now:

Code:
--- /mod/webif/html/xepg/script_orig.js
+++ /mod/webif/html/xepg/script.js
@@ -1,3 +1,13 @@

$(function() {

$('#epgswitch').button().click(function() {
     window.location = '/epg/list.jim';
});

+var rcount = 0;
+$('#resetEPG').button().click(function() {
+     if(!rcount)
+    {
+        $('#results').html('Checking CPU usage').show();
+        $.getJSON('cpu.jim', function(data) {
+            var cpudata = data.data;
+            $('#results').html(cpudata.cpu > 30 ? 'CPU currently too busy for reset! ('+cpudata.cpu+'%)' : (rcount ++ > 0 ? 'Restarting EPG' : 'System ready, click again to reset EPG'));
+            if (cpudata.cpu < 31)
+            {
+            var url = '/cgi-bin/service.jim?action=restart&service=epg';
+            $('#results').load(url, function() {
+               location.reload(true);
+                });
+            }
+            else $('#results').delay(30000).fadeOut("slow");
+        });
+    }
+    else
+    {
+         var url = '/cgi-bin/service.jim?action=restart&service=epg';
+        $('#results').load(url, function() {
+            location.reload(true);
+        });
+    }
+
+});
I wonder if modifications elsewhere could avoid the issue?
 
Last edited:

/df

Active Member
Perhaps one high CPU activity is the Humax s/w updating its version of the EPG, such that if the epg service restarts at the same time it sees inconsistent data? If the Humax s/w happens to continue updating its version of the EPG after updating its timestamp, this might be the result.
 
OP
Matthew

Matthew

Member
It doesn't even need that, from my tests just sweeper or DetectAds running is sufficient to cause the issue.
 
Top