summaryrefslogtreecommitdiff
path: root/scripts/extract_vdr_chan_ids.pl
blob: e40bbb9ddbece48789ca942dcff21a5cd7991675 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/perl -w
#
# extract VDR channel ID's from channels conf
#

use strict;
use File::Path;

my $channelsConf = "../channels.conf";
my $Usage = qq{
Usage: $0 (default: ../channels.conf)
       $0 /path/to/channels.conf
};

$channelsConf  = "@ARGV" if @ARGV;

#my $file;
open(MYINPUTFILE, "<$channelsConf") or die("Could not open $channelsConf" . $Usage);

foreach (<MYINPUTFILE>)
{
    chomp;
    if ( /^:.*/ )
    {
        print $_ . "\n";
        next;
    }

    my($line) = $_;

    my(@tokens) = split(":");

    my($chanID) = "$tokens[3]-$tokens[10]-$tokens[11]-$tokens[9] $tokens[0]";

    print $chanID . "\n"

}