local channels={{id="1856",start=6,stop=18}}
local function Pass1Func(proc,program)
local dst,starthour,stophour
local i,n
XGUI.SetStatus(2,"Processing "..XGUI_Lib.XS.Val(program.Title))
dst=time.IsEUDST(program.Start)
if dst then
starthour=program.Start.Hour+1
stophour=program.Stop.Hour+1
else
starthour=program.Start.Hour
stophour=program.Stop.Hour
end
n=table.getn(channels)
for i=1,n do
if program.Channel==channels[i].id then
if (starthour<channels[i].start)or(stophour<channels[i].start)
or(starthour>=channels[i].stop)or(stophour>channels[i].stop)
or((stophour==channels[i].stop)and(program.Stop.Minute>0))
or((stophour==channels[i].start)and(program.Stop.Minute==0)) then
return XGUI.OK
else return program
end
end
end
return program
end
PostProcs.UK_RT_Free_Limit={
Name = "UK - Radio Times freeview channel time limiter",
Version = "1.0",
Author = "Alan Birtles",
InfoURL = "http://www.birtles.org.uk/xmltv",
Grabber = "UK_RT",
Passes={
Pass1={
Type=XGUI.PassTypes.Program,
Func=Pass1Func,
},
},
}
save to scripts\uk_rt\ukrt_freeview_limit.lua
to add additional channels simply add a channels id its start and stop hour to the array at the top of the script
local function Pass1Func(proc,program)
local dst,starthour,stophour
local i,n
XGUI.SetStatus(2,"Processing "..XGUI_Lib.XS.Val(program.Title))
dst=time.IsEUDST(program.Start)
if dst then
starthour=program.Start.Hour+1
stophour=program.Stop.Hour+1
else
starthour=program.Start.Hour
stophour=program.Stop.Hour
end
n=table.getn(channels)
for i=1,n do
if program.Channel==channels[i].id then
local start1=channels[i].start
local stop1=channels[i].stop
if start1<stop1 then
if (((starthour>=start1)and(stophour<stop1))
or((stophour==stop1)and(program.Stop.Minute==0)))
and((stop1==0)or(stophour>=starthour)) then
return program
else return XGUI.OK
end
else
if (starthour>=start1)
or (stophour<stop1)
or ((stophour==stop1)and(program.Stop.Minute==0))then
return program
else return XGUI.OK
end
end
end
end
return program
end
Thanks for this reply the other day, you were quick & it worked fine.
Is it possible to amend this script to display a message like "Closedown" when the programs are not broadcasting on the EPG grid instead, as it just shows No Epg data avaibale in my software.
else
local p2={}
p2.Start=program.Start
p2.Stop=program.Stop
p2.Channel=program.Channel
p2.Title="Closedown"
p2.Description="Channel currently off air"
return p2
which would just change the title of each program to "Closedown" instead of deleting them completely. a full solution would be much mroe complex