sf2slash

pudge on 2001-04-21T00:00:12

#!perl -w use strict; use LWP::Simple; use Slash::DB; use Slash::Utility;

createEnvironment('useperl'); my $url = 'http://sourceforge.net/developer/diary.php?diary_user=3660&diary_id='; my @ids = qw(2477 2418 2356 2312 2261 2244 2152 2126 2082 1952 1936 1857 1848 1777 1753 1738 1724 1643 1637 1542 1536 1527 1488 1461 1427 1394 1384 1318 1297 1282 1272);

my $slashdb = getCurrentDB();

for (@ids) { my($date, $subj, $body); $_ = get($url . $_);

s/\015//g; m|Date: (.+?)
|s; $date = $1; m|Subject: (.+?)

|s; $subj = $1; m|Body:
(.+?)|s; ($body = $1) =~ s/
\n
\n/\n\n/g; $body =~ s/
\n//g;

for ($date, $subj, $body) { s/^\s+//; s/\s+$//; }

$slashdb->sqlInsert('journals', { uid => 1, description => $subj, date => $date, posttype => 1, });

my($id) = $slashdb->sqlSelect('LAST_INSERT_ID()'); $slashdb->sqlInsert('journals_text', { id => $id, article => strip_plaintext($body), });

print "Inserted $id\n";

}

__END__