1
0
mirror of https://github.com/DigitalDevices/octonet.git synced 2023-10-10 11:36:52 +00:00

Channel/EPG scanning speedup and improved reporting

This commit is contained in:
mvoelkel
2016-02-01 18:50:50 +01:00
parent d1e97185a7
commit 3e15f9e651
4 changed files with 50 additions and 17 deletions

View File

@@ -16,6 +16,8 @@ var hasCable = false;
var hasSat = false;
var hasTer = false;
var StartTime = null;
var xmlhttp = new XMLHttpRequest();
var url = "/channelscan.lua?select=keys";
@@ -156,8 +158,16 @@ function ScanStatus(response)
}
else if( s.status == "done" )
{
var sec = "";
if( StartTime )
{
var t = new Date() - StartTime;
sec = ", time: " + Math.floor(t/1000) + " seconds";
StartTime = null;
}
document.getElementById("scancount").firstChild.nodeValue = s.count;
document.getElementById("scantext").firstChild.nodeValue = s.msg;
document.getElementById("scantext").firstChild.nodeValue = s.msg + sec;
}
else if( s.status == "deleted" )
{
@@ -235,6 +245,7 @@ function InitiateScan()
ScanReq.send("select=scan" + param + "&sitables=1&sort=1&restartdms=1");
document.getElementById("scancount").firstChild.nodeValue = "\u00A0";
document.getElementById("scantext").firstChild.nodeValue = "Scanning...";
StartTime = new Date();
}
else
{
@@ -246,11 +257,12 @@ function InitiateScan()
function InitiateEPGScan()
{
DisableButtons(true);
ScanReq.open("POST", "/channelscan.lua", true);
ScanReq.setRequestHeader("Content-type","application/x-www-form-urlencoded");
ScanReq.send("select=epg");
document.getElementById("scancount").firstChild.nodeValue = "\u00A0";
document.getElementById("scantext").firstChild.nodeValue = "Scanning...";
ScanReq.open("POST", "/channelscan.lua", true);
ScanReq.setRequestHeader("Content-type","application/x-www-form-urlencoded");
ScanReq.send("select=epg");
document.getElementById("scancount").firstChild.nodeValue = "\u00A0";
document.getElementById("scantext").firstChild.nodeValue = "Scanning...";
StartTime = new Date();
}
function PollStatus()

View File

@@ -107,7 +107,8 @@ function LoadEPG()
function ChannelListResponse(response)
{
ChannelList = JSON.parse(response);
if( ChannelList.GroupList[0].ChannelList[0].ID )
var Valid = false;
if( ChannelList.GroupList[0].ChannelList )
{
ChannelLookup = new Object();
for(var i = 0; i < ChannelList.GroupList.length; i += 1)
@@ -115,9 +116,16 @@ function ChannelListResponse(response)
var Group = ChannelList.GroupList[i];
for(var j = 0; j < Group.ChannelList.length; j += 1)
{
ChannelLookup[Group.ChannelList[j].ID] = Group.ChannelList[j];
if( Group.ChannelList[j].ID )
{
Valid = true;
ChannelLookup[Group.ChannelList[j].ID] = Group.ChannelList[j];
}
}
}
}
if( Valid )
{
LoadEPG();
}
else