#!/usr/bin/perl -w # # Connects to the mythtv database and repairs/optimizes the tables that it # finds and calls mythfilldatabase. Suggested use is to specify this script # as the "mythfilldatabase Program" in mythfrontend settings. # # This script is basically xris's optimize_mythdb.pl with modifications to # call mythfilldatabase. # # @url $URL$ # @date $Date$ # @version $Revision$ # @author $Author: xris $ # @license GPL # # Includes use DBI; use MythTV; # Location of the mythfilldatabase executable my $mfdb = "mythfilldatabase"; # Connect to mythbackend my $Myth = new MythTV(); # Connect to the database $dbh = $Myth->{'dbh'}; # Repair each table foreach $table ($dbh->tables) { if ($dbh->do("REPAIR TABLE $table")) { print "Repaired: $table\n"; } else { print "Skipped Repair: $table\n"; } } # Call mythfilldatabase passing arguments received by this script system("$mfdb @ARGV"); # Optimize each table foreach $table ($dbh->tables) { if ($dbh->do("OPTIMIZE TABLE $table")) { print "Optimized: $table\n"; } else { print "Skipped Optimize: $table\n"; } }