Well, here's a first attempt. It did the job for me but I know it has shortcomings. I had to learn LUA along the way!
Here's the lua script and the configuration file that I use to transform the Radio Times names into those that appear on the Freeview transmissions. Now, when I scan with GBPVR they are linked immediately rather than having to do it by hand. Put both files in the UK_RT folder under scripts. and configure the postprocessor to read the text file (using the XMLTVGUI configuration settings).
The deficiency in the script (if it is a deficiency) is that it doesn't cope with the full generality of the spec and just assumes that "Name" contains a "Value". This seems to be always the case for the RT scanner.
Script
Code: Select all
local channels
local function Pass1Func(grabber,channel)
local oldname,newname,str
XGUI.SetStatus(2,"Processing "..channel.Name.Value)
oldname=channel.Name.Value
newname=channels[oldname]
if newname~=nil then
print(string.format("Changing '%s' --> '%s'",oldname,newname))
channel.Name.Value=newname
end
return channel
end
local function Start(grabber)
local fn=XGUI.GetSetting(grabber,"FileName","altchnames.txt")
local line
local first=true
channels={}
for line in io.lines(fn) do
local name,alt
for name,alt in string.gfind(line,"(.-),(.+)") do
-- note that this requires comma separated strings since names can contain spaces but hopefully not commas
if not first then
print(string.format("config '%s' --- '%s'",name,alt))
channels[name]=alt
else first=false
end
end
end
return XGUI.OK
end
local function Init(grabber)
XGUI.AddSetting(grabber,"FileName",XGUI.SettingType.Directory,"altchnames.txt","Channel names file")
return XGUI.OK
end
PostProcs.UK_RT_ALTNAMES_Text={
Name = "UK - Radio Times - Text Altnames reader",
Version = "1.00.00",
Author = "Mel Earp modified from Alan Birtles",
-- InfoURL = "http://www.birtles.org.uk/xmltv/wiki/index.php?title=UK_RT_Alt_Text",
-- There is no separate InfoURL
Grabber = "UK_RT",
Init=Init,
Passes={
Pass1={
Start=Start,
Type=XGUI.PassTypes.Channel,
Func=Pass1Func,
},
},
}
Here's my configuration file (it does do null transformations for those that are not different, so that it's easier to change). You will have to change the "North West" names to ones that suit you.
Code: Select all
RT Guide Name,TV Name
BBC1 North West,BBC ONE
BBC2 North West,BBC TWO
ITV1 Granada,ITV1
Channel 4,Channel 4
Five,Five
ITV2,ITV2
BBC3,BBC THREE
BBC4,BBC FOUR
ITV3,ITV3
Sky Three,SKY THREE
UKTV History,UKTV History
More4,More 4
E4,E4
ABC1,abc1
QVC,QVC
The Hits,The Hits
UKTV Bright Ideas,UKTV Br'tIdeas
Ftn,f tn
TMF: The Music Factory,TMF
Ideal World,Ideal World
Price-drop tv,price-drop tv
ITV4,ITV4
Film4,Film4
E4 +1,E4+1
ITV Play,ITV Play
FilmFour +1,Film4+1
Five US,Five US
Five Life,Five Life
CBBC,CBBC Channel
CBeebies,CBeebies
CITV,CITV
BBC News 24,BBC NEWS 24
BBC Parliament,BBC Parliament
Sky News,Sky News
Sky Sports News,Sky Spts News