6 require "src/logger.pl";
7 require "src/modules.pl";
8 require "src/Files.pl";
10 require "src/Factoids/DBCommon.pl";
12 if ( !scalar @ARGV ) {
13 print "Usage: txt2mysql.pl <input.txt>\n";
19 open( IN, $txtfile ) or die "error: cannot open txtfile '$txtfile'.\n";
21 # read the bot config file.
22 &loadConfig("files/infobot.config");
24 &openDB( $param{'DBName'}, $param{'SQLUser'}, $param{'SQLPass'} );
26 ### now pipe all the data to the mysql server...
28 print "converting factoid db to mysql...\n";
32 if (/^(.*)\s+=>\s+(.*)$/) {
34 # verify if it already exists?
35 my ( $key, $val ) = ( $1, $2 );
36 if ( $key =~ /^\s*$/ or $val =~ /^\s*$/ ) {
37 print "warning: broken => '$_'.\n";
41 if ( &IsParam("freshmeat")
42 and &dbGet( "freshmeat", "name", $key, "name" ) )
44 if ( &getFactoid($key) ) {
49 &setFactInfo( lc $key, "factoid_value", $val );
53 print "$i... " if ( $i % 100 == 0 );
56 print "warning: invalid => '$_'.\n";
64 # vim:ts=4:sw=4:expandtab:tw=80