user => 'dpavlin',
passwd => '',
catalog => {
- path => '/rest/references/PgGeneratBits/bits',
- title => 'PostgreSQL General Bits',
+ name => 'PostgreSQL General Bits',
+ path => '/rest/references/PgGeneratBits/bits',
uri => 'http://www.varlena.com/varlena/GeneralBits/archive.php',
+ type => 'pgbits',
},
};
relationships => 1,
);
-my $this_catalog = $l->find_class('catalog_webarchive')->find_or_create( $self->{catalog} );
-$this_catalog->dbi_commit;
+my $top = $l->find_class('topics_webarchive')->find_or_create( $self->{catalog} );
+$top->dbi_commit;
sub issue {
my $file = shift || die;
$issue_date = $1;
print "## issue $issue_no on $issue_date [$file]\n";
- $this_entry = $l->find_class('entries_pgbits')->find_or_create(
+ $issue = $l->find_class('topics_pgbits')->find_or_create(
+ name => "issue $issue_no",
date => $issue_date,
- issue => $issue_no,
path => $file,
- title => $self->{catalog}->{title} . " :: $issue_no",
+ issue => $issue_no,
+ type => 'pgbits',
+ parent_id => $top->id,
);
- $this_entry->dbi_commit;
+ $issue->dbi_commit;
- $l->find_class('catalog_entry')->find_or_create(
- catalog_id => $this_catalog->id,
- entry_id => $this_entry->id,
- e_type => 'pgbits',
- )->dbi_commit;
} else {
warn "can't find issue number and date in $file, skipping\n";
return;
while($html =~ s#^.*?<!-- IKEY="([^"]+)" -->.+?<MYTITLE>\s*([^<]+)\s*</MYTITLE>.+?<ITITLE>\s*([^<]+)\s*</ITITLE>.+?<IDATE>\s*([^<]+)\s*</IDATE>.+?</TABLE>\s*(.+?)\s*<ICONT>\s*(.+?)\s*</ICONT>##si){
my $row = {
- title => $2 . ( $3 ? " :: $3" : ""),
+ name => $2 . ( $3 ? " :: $3" : ""),
ikey => $1,
mytitle => $2,
html => $5,
contributors => $6,
- entry_id => $this_entry->id,
- i_type => 'pgbits',
+ type => 'pgbits',
};
-
- print $row->{title}," ", $row->{date},"\n";
- $l->find_class('items_pgbits')->find_or_create( $row )->dbi_commit;
+
+ print $row->{name}," ", $row->{date},"\n";
+ my $article = $l->find_class('items_pgbits')->find_or_create( $row );
+ $article->dbi_commit;
+
+ $l->find_class('item_topics')->find_or_create(
+ topic_id => $issue->id,
+ item_id => $article->id,
+ )->dbi_commit;
}
}