[mythtv] DVB 3.4 patch report #2 - attachment

Hamish Moffatt hamish at cloud.net.au
Sat Jan 8 06:04:32 EST 2005


And now with the script attached.
-- 
Hamish Moffatt VK3SB <hamish at debian.org> <hamish at cloud.net.au>
-------------- next part --------------
#!/usr/bin/perl

print "DELETE FROM dtv_multiplex;\n";
print "DELETE FROM channel;\n";

$source = 1;

while (<>) {
    chomp;
    next if (m/^\s*$/); # skip blank lines
    next if (m/^#/); # skip comments

    @d = split(" ");
    # Format:
    #  0 = "T"
    #  1 = Frequency
    #  2 = bandwidth ("7MHz")
    #  3 = fec_hi
    #  4 = fec_lo (might be "NONE")
    #  5 = modulation ("QAM64")
    #  6 = transmission-mode ("8k")
    #  7 = guard-interval ("1/16")
    #  8 = hierarchy ("NONE")

    $bw = substr $d[2], 0, 1;
    $mode = substr $d[6], 0, 1;

    if ($d[5] =~ m/QAM(.*)/) {
        $modul = "qam_$1";
    } else {
        die "Unknown modulation $d[5]";
    }

    if ($d[4] =~ m/NONE/i) {
        $fec_lo = "auto";
    } else {
        $fec_lo = $d[4];
    }

    print <<EOF;
INSERT INTO dtv_multiplex VALUES (
    NULL,
    $source,
    NULL,
    NULL,
    $d[1],
    'a',
    NULL,
    '$d[3]',
    NULL,
    NULL,
    '$bw',
    '$fec_lo',
    '$mode',
    '$d[7]',
    0,
    '$modul',
    'n',
    '$d[3]',
    NULL,
    NULL,
    NULL
);
EOF

}


More information about the mythtv-dev mailing list