+1 Script - extra channels?

Discussion of Version 3 and developing lua grabbers
Post Reply
b00sfuk
Posts: 31
Joined: Wed Dec 14, 2005 11:18 am

+1 Script - extra channels?

Post by b00sfuk » Wed Jan 11, 2006 11:01 am

Alan, the More+1 script works great, when you get a minute could you please add in FX+2 (FX=1461) and Paramount +1 (Paramount=1061) as options please. I tried to edit the script myself but was not 100% certain which parts to duplicate.
Many thanks again

alanbirtles
Site Admin
Posts: 495
Joined: Mon Sep 06, 2004 4:44 pm

Post by alanbirtles » Wed Jan 11, 2006 11:14 am

try this one

Code: Select all

local channels={}
local grabber

local availablechannels={{name="More4+1",offset=1,id="1959"},{name="FX+2",offset=2,id="1461"},{name="Paramount Comedy+1",offset=1,id="1061"}}

require("timezones")
require("XGUI_Lib")

local function Pass1Func(proc,program)
	local dst,starthour,stophour
	local i,n
	XGUI.SetStatus(2,"Processing "..XGUI_Lib.XS.Val(program.Title))
	n=table.getn(channels)
	for i=1,n do
		if program.Channel==channels[i].id then
			local p2
			p2=table.copy(program)
			p2.Channel=p2.Channel.."+"..channels[i].offset
			p2.Start.Hour=p2.Start.Hour+channels[i].offset
			p2.Start=time.Fix(p2.Start)
			p2.Stop.Hour=p2.Stop.Hour+channels[i].offset
			p2.Stop=time.Fix(p2.Stop)
			XGUI.AddProgram(grabber,p2)
			end
		end
	return program
	end

local function Start(proc)
	grabber=XGUI.GetGrabber("UK_RT")
	channels={}
	local i,n
	n=table.getn(availablechannels)
	for i=1,n do
		if toboolean(XGUI.GetSetting(proc,availablechannels[i].name,"false")) then
			table.insert(channels,{id=availablechannels[i].id,offset=availablechannels[i].offset})
			end
		end
	--[[if toboolean(XGUI.GetSetting(proc,"More4+1","false")) then
		table.insert(channels,{id="1959",offset=1})
		end]]
	n=table.getn(channels)
	for i=1,n do
		local ch
		ch=XGUI.GetChannel(grabber,channels[i].id)
		ch.ID=channels[i].id.."+"..channels[i].offset
		ch.Name=XGUI_Lib.XS.Cat(ch.Name,"+"..channels[i].offset)
		XGUI.AddUserChannel(grabber,ch)
		end
	end

local function Init(proc)
	local i,n
	n=table.getn(availablechannels)
	for i=1,n do
		XGUI.AddSetting(proc,availablechannels[i].name,XGUI.SettingType.Boolean,"false",availablechannels[i].name)
		end
	return XGUI.OK
	end

	
PostProcs.UK_RT_Plus_One={
	Name = "UK - Radio Times Plus one generator",
	Version = "1.0",
	Author = "Alan Birtles",
	InfoURL = "http://www.birtles.org.uk/xmltv",
	Grabber = "UK_RT",
	Passes={
		Pass1={
			Type=XGUI.PassTypes.Program,
			Func=Pass1Func,
			Start=Start,
			},
		},
	Init=Init,
	}

b00sfuk
Posts: 31
Joined: Wed Dec 14, 2005 11:18 am

Post by b00sfuk » Wed Jan 11, 2006 11:37 am

Alan, awesome, all working great thanks...and a solution posted within 13mins.

b00sfuk
Posts: 31
Joined: Wed Dec 14, 2005 11:18 am

Post by b00sfuk » Thu Jan 19, 2006 12:40 pm

Update: More4+1 and FX+ have just been added to the native RT list.

b00sfuk
Posts: 31
Joined: Wed Dec 14, 2005 11:18 am

Post by b00sfuk » Thu Jan 19, 2006 1:04 pm

Alan, don't know if it is a problem with your code or me but I'm now getting this leap year error with the +1 script. I guess as feb is <14 days away and it needs to check.

C:\Program Files\XMLTV GUI\lib/timezones.lua:7: attempt to call global `IsLeap' (a nil value)

cheers

alanbirtles
Site Admin
Posts: 495
Joined: Mon Sep 06, 2004 4:44 pm

Post by alanbirtles » Thu Jan 19, 2006 1:07 pm

on line 7 of lib\timezones.lua change "IsLeap" to "time.IsLeap"

b00sfuk
Posts: 31
Joined: Wed Dec 14, 2005 11:18 am

Post by b00sfuk » Thu Jan 19, 2006 1:27 pm

Thanks again, all working again now.

Post Reply