diff --git a/var/import.pl b/var/import.pl deleted file mode 100755 index 4c7314e..0000000 --- a/var/import.pl +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/perl - -use Data::Dumper; -use DBI; - -use strict; -use warnings; - -use Text::Soundex qw/soundex/; #didn't know buu did this! - -sub _clean_subject { - my( $subject ) = @_; - - $subject =~ s/^\s+//; - $subject =~ s/\s+$//; - $subject =~ s/\s+/ /g; -# $subject =~ s/[^\w\s]//g; #comment out to fix punct in factoids - $subject = lc $subject; - - return $subject; -} - -my $dbhnew = DBI->connect( - "dbi:SQLite:dbname=factoids.db", - "", - "", - { RaiseError => 1, PrintError => 0 } - ); - -my $dbhold = DBI->connect("dbi:SQLite:dbname=../perlbotstuff/data/facts.db","","", { RaiseError => 1, PrintError => 0 }); - -my @facts; - -my $sth = $dbhold->prepare("SELECT * FROM facts;"); - -$sth->execute(); - -while (my $row =$sth->fetchrow_arrayref()) -{ - print Dumper($row); - push @facts, {subject => $row->[0], predicate => $row->[1], copula => 'is', author => 'perlbot', original_subject => _clean_subject($row->[0]), modified_time => time, soundex => soundex($row->[0])} -} - -for (@facts) -{ -$dbhnew->do( "INSERT INTO factoid - (original_subject,subject,copula,predicate,author,modified_time,soundex,compose_macro) - VALUES (?,?,?,?,?,?,?,?)", - undef, - @$_{qw(original_subject subject copula predicate author modified_time soundex)}, - 0, - ); -} - - -#CREATE TABLE factoid ( -# factoid_id INTEGER PRIMARY KEY AUTOINCREMENT, -# original_subject VARCHAR(100), -# subject VARCHAR(100), -# copula VARCHAR(25), -# predicate TEXT, -# author VARCHAR(100), -# modified_time INTEGER, -# soundex VARCHAR(4), -# compose_macro CHAR(1) DEFAULT '0' diff --git a/var/importkarma.pl b/var/importkarma.pl deleted file mode 100755 index fc53d93..0000000 --- a/var/importkarma.pl +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/perl - -use Data::Dumper; -use DBI; - -use strict; -use warnings; - -use Text::Soundex qw/soundex/; #didn't know buu did this! -use POE::Component::IRC::Common qw(l_irc); - -my $dbhnew = DBI->connect( - "dbi:SQLite:dbname=karma.db", - "", - "", - { RaiseError => 1, PrintError => 0 } - ); - -my $dbhold = DBI->connect("dbi:SQLite:dbname=../perlbotstuff/data/karma.db","","", { RaiseError => 1, PrintError => 0 }); - -my @facts; - -my $sth = $dbhold->prepare("SELECT * FROM karma;"); - -$sth->execute(); - -while (my $row =$sth->fetchrow_arrayref()) -{ - print Dumper($row); - push @facts, {subject => $row->[0], operation=>$row->[1], author=>'perlbot', modified_time=>time} -} - -#CREATE TABLE karma ( -# karma_id INTEGER PRIMARY KEY AUTOINCREMENT, -# subject VARCHAR(250), -# operation TINYINT, -# author VARCHAR(32), -# modified_time INTEGER -# )"; # Stupid lack of timestamp fields - - -for (@facts) -{ -my $lirc = l_irc($_->{subject}) || lc $_->{subject}; -$dbhnew->do( "INSERT INTO karma - (subject,operation,author,modified_time) - VALUES (?,?,?,?)", - undef, - $lirc, @$_{qw(operation author modified_time)}, - ); -} - -