Ticket #2877: myth.rebuilddatabase.pl.patch

File myth.rebuilddatabase.pl.patch, 1.7 KB (added by anonymous, 17 years ago)
  • myth.rebuilddatabase.pl

     
    185185                'norename'=>\$norename
    186186                );
    187187
     188print "db = dbi:mysql:database=$database:host=$dbhost user = $user pass = $pass\n";
    188189my $dbh = DBI->connect("dbi:mysql:database=$database:host=$dbhost",
    189190                "$user","$pass") or die "Cannot connect to database ($!)\n";
    190191
     
    314315
    315316    # have enough to look for an past recording?
    316317    if ($ssecond) {
     318        print "Checking for a recording...\n";
    317319        $starttime = "$syear$smonth$sday$shour$sminute$ssecond";
    318320
    319321        my $guess = "select title, subtitle, description from oldrecorded where chanid=(?) and starttime=(?)";
     
    333335        print "End time:   $emonth/$eday/$eyear - $ehour:$eminute:$esecond\n";
    334336    }
    335337
     338    # what about checking for guide data?
     339    if($guess_description =~ /^Recovered file/) {
     340        print "Checking for guide data...\n";
     341        my $guess = "select title, subtitle, description from program where chanid='$channel'".
     342                    " and starttime='$syear-$smonth-$sday $shour:$sminute:$ssecond'";
     343        print "$guess\n";
     344        $sth = $dbh->prepare($guess);
     345        $sth->execute()
     346            or die "Could not execute ($guess)\n";
     347
     348        if (my @row = $sth->fetchrow_array) {
     349            $guess_title = $row[0];
     350            $guess_subtitle = $row[1];
     351            $guess_description = $row[2];
     352            print "Using guide data informaton for defaults\n";
     353        }
     354    }
     355
    336356    my $newtitle = $guess_title;
    337357    my $newsubtitle = $guess_subtitle;
    338358    my $newdescription = $guess_description;