Hi all,
I created a simple perl script that will download the channel names and epg categories from Sky epg online service. It will then create a nicely formatted channels.conf with the proper epg categories.
Copy the following code into a file called Sky_to_vdrchannels.pl.
#!/usr/bin/perl -w
=head1 AUTHOR
Chris Monks - 20-10-2010
=cut
#use strict;
use LWP::Simple qw/get/;
use JSON;
use HTML::Entities;
use HTTP::Cookies;
use DateTime;
use Data::Dumper;
use LWP::UserAgent;
@cat_sorted="";
&replicate_skyepg;
exit 0;
sub replicate_skyepg
{
my $ua = new LWP::UserAgent;
$ua->agent("$0/0.1 " . $ua->agent);
my $req = new HTTP::Request 'GET' => 'http://epgservices.sky.com/tvlistings-proxy/TVListingsProxy/init.json';
$req->header('Cookie' => 'epg_myChannels=data%20%3D%20%7B%22provider%22%3A%20%220%22%2C%20%22packages%22%3A%20%5B%22%22%5D%2C%20%22region%22%3A%20%224100_50%22%7D; epg_channelPrefs=data%20%3D%20%7B%22provider%22%3A%20%220%22%2C%20%22packages%22%3A%20%5B%22%22%5D%2C%20%22region%22%3A%20%224100_50%22%7D;');
$data_file="channels_temp.conf";
open(DAT, $data_file) || die("Could not open file!");
@raw_data=<DAT>;
close(DAT);
my $res = $ua->request($req);
my $genre_data = decode_json $res->content;
foreach my $genre (@{$genre_data->{epggenre}})
{
my $genreid = $genre->{genreid};
my $genre_name = $genre->{name};
print ":=== $genre_name ===\n";
foreach my $channel (@{$genre_data->{channels}})
{
my $title = $channel->{title};
my $changenreid = $channel->{epggenre};
if ($genreid == $changenreid) {
foreach $channelconf (@raw_data)
{
chomp($channelconf);
($ChannelName,$Conf)=split(/\;/,$channelconf);
if($ChannelName eq $title){
print "$ChannelName;$Conf\n";
push(@cat_sorted,"$ChannelName");
}
}
}
}
}
my $notfound = 0;
print ":=== Unsorted ===\n";
foreach $channelconf (@raw_data)
{
chomp($channelconf);
($ChannelName,$Conf)=split(/\;/,$channelconf);
foreach $channelsorted(@cat_sorted)
{
if($channelsorted eq $ChannelName)
{
$found = 1;
}
}
if ($found==0)
{
print "$ChannelName;$Conf\n";
}
$found=0;
}
}
Alles anzeigen
Stop vdr and you should be able to do run this all in one go. Like this
sudo w_scan -f s -cGB -sS28E2 -a /dev/dvb/adapter0/ channels_temp.conf;perl Sky_to_vdrchannels.pl>channels.conf
The end result is a channels.conf file formatted like this
:=== Entertainment ===
BBC 1 London;BSkyB:10773:hC56:S28.5E:22000:5000:5001=eng,5002=NAR:5003:0:6301:2:2045:0
BBC 2 England;BSkyB:10773:hC56:S28.5E:22
:=== Lifestyle & Culture ===
Disc.RealTime;BSkyB:11875:hC23:S28.5E:27500:2313:2314=eng,2315=NAR:2316:960,961,963:6203:2:2009:0
Disc.RT+1;BSkyB:11390:hC23:S28.5E:27500:2313:2314=eng,2315=NAR:2316:960,961,963:52445:2:2315:0000:5100:5101=eng,5102=NAR:5103:0:6302:2:2045:0
THre are a couple of things the script relies on a file called channels_temp.conf is the same directory. (No need for this if you use my above example how to run). You could use a conf file from
hxxp://www.vdr-settings.com/download/channels/S28.2E_channels.conf. and rename to channels_temp.conf and use that instead, but i've not tried. Also I couldn't change the epg region from sky's website so it's stuck the default uk region, which should be fine for most.
its my first contribution so hope it's useful to someone
Chris