Change Channel ID feature from V2

Discussion of Version 3 and developing lua grabbers
Post Reply
simon
Posts: 1
Joined: Sun Mar 05, 2006 10:35 am

Change Channel ID feature from V2

Post by simon »

Hi,

I have upgraded from v2 to the latest v3 and am using the UK_RT grabber. One feature I can't seem to find is the ability to change the punctuation in the channel IDs. For example, in v2 I could change the colon in TMF:The Music Channel to TMF. The Music Channel. This allowed me to use a Channel logo in GBPVR.

Can anyone help me and show me where this feature is in v3?

Thanks,

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

Post by alanbirtles »

you would need to write a post processor script to do this
alanbirtles
Site Admin
Posts: 495
Joined: Mon Sep 06, 2004 4:44 pm

Post by alanbirtles »

add the following code to the end of lib\xgui_lib.lua

Code: Select all

XGUI_Lib.XS.Replace = function (xstr,str)
if not xstr then return str
	elseif not str then return xstr
	end
local xtype=XGUI_Lib.XS.Type(xstr)
if xtype==XGUI_Lib.XS.Type_String then return str
	elseif xtype==XGUI_Lib.XS.Type_XString then
		xstr.Value=str
		return xstr
	else 
		xstr[1]=XGUI_Lib.XS.Replace(xstr[1],str)
		return xstr
		end
end
then save this script to the scripts directory

Code: Select all

require("XGUI_Lib")

local RepChar

local function Pass1Func(proc,channel)
	local cname=XGUI_Lib.XS.Val(channel.Name)
	XGUI.SetStatus(2,"Processing "..cname)
	cname,_=string.gsub(cname,":",RepChar)
	channel.Name=XGUI_Lib.XS.Replace(channel.Name,cname)
	return channel
	end

local function Pass1Start(proc)
	RepChar=XGUI.GetSetting(proc,"RepChar","-")
	return XGUI.OK
	end

local function Init(proc)
	XGUI.AddSetting(proc,"RepChar",XGUI.SettingType.String,"-","Character(s) to replace \":\" with:")
	return XGUI.OK
	end

PostProcs.ChanColon={
	Name = "Channel Colon Replacer",
	Version = "1.00.00",
	Author = "Alan Birtles",
	InfoURL = "http://www.birtles.org.uk/xmltv/wiki/index.php?title=ChanColon",
	Passes={
		Pass1={
			Start=Pass1Start,
			Type=XGUI.PassTypes.Channel,
			Func=Pass1Func,
			},
		},
	Init=Init,		
	}
alanbirtles
Site Admin
Posts: 495
Joined: Mon Sep 06, 2004 4:44 pm

Post by alanbirtles »

the above script is now included in v3.03.00
Post Reply