Hopfully a simple question for someone.
I found the following script online for exporting a channels.conf file from the mythtv database. I want to be able to do this so if I reinstall LMCE, I can import all of my channels again. I know I will have to update user\pass for it to work.
#!/usr/bin/perl -w
use strict;
use DBI;
use Getopt::Long;
my $dbhost="127.0.0.1";
my $database="mythconverg";
my $user="mythtv";
my $pass="mythtv";
my $sourceid = 1;
my $hidden = 0;
GetOptions('dbhost=s'=>\$dbhost,
'database=s'=>\$database,
'user=s'=>\$user,
'pass=s'=>\$pass,
'sourceid=i'=>\$sourceid,
'hidden!'=>\$hidden
) || die "Usage:";
my $dbh = DBI->connect("dbi:mysql:database=$database:host=$dbhost","$user","$pass") || die "Cannot connect to database ($!)\n";
my $sql = sprintf("SELECT callsign, frequency, modulation, serviceid
FROM channel JOIN dtv_multiplex USING (mplexid)
WHERE channel.sourceid = ? %s
ORDER BY frequency",
($hidden ? "" : "AND channel.visible = 1")
);
my $sth = $dbh->prepare($sql);
$sth->execute($sourceid);
while (my @row=$sth->fetchrow_array) {
my $callsign = $row[0];
my $frequency = $row[1];
my $modulation = uc $row[2];
my $serviceid = $row[3];
printf "$callsign:$frequency:$modulation:0:0:$serviceid\n";
}
$dbh->disconnect;
Reason I want to do this:
For my area (Bay Area, California, Comcast Digital Cable), only 6 channels are identified and the rest are unknown. In addition, if I choose to exclude encrypted channels, several channels are not scanned. So basically I am scanning everything and then manually correcting each respective channel and removing the encryted ones. Once finished, I want to be able to export this so if i ever perform a reinstall, I will not have to do it again.
Also, If I am going about this the wrong way, let me know before i get to far into manually editing the channels.
Thanks,
Greg