6 require "src/logger.pl";
7 require "src/modules.pl";
8 require "src/Files.pl";
10 require "src/Factoids/DBCommon.pl";
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/blootbot.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+(.*)$/) {
33 # verify if it already exists?
34 my ($key,$val) = ($1,$2);
35 if ($key =~ /^\s*$/ or $val =~ /^\s*$/) {
36 print "warning: broken => '$_'.\n";
40 if (&IsParam("freshmeat") and &dbGet("freshmeat", "name", $key, "name")) {
41 if (&getFactoid($key)) {
45 &setFactInfo(lc $key, "factoid_value", $val);
49 print "$i... " if ($i % 100 == 0);
51 print "warning: invalid => '$_'.\n";