Compare commits

..

No commits in common. "a157f9e8e4a430c5a6bb11847c3addb40b016169" and "41380bb04f126e8805f6938c5d70447c000923ae" have entirely different histories.

2 changed files with 3 additions and 16 deletions

View File

@ -21,12 +21,10 @@ use Try::Tiny;
use Cache::Memcached;
use Encode qw(decode_utf8);
use HTML::Entities;
use HTTP::Date;
use XML::Atom::Client;
use XML::RAI;
with 'MooseX::Log::Log4perl';
has 'id' => (
@ -118,16 +116,10 @@ sub update {
$issued = $guess_issued;
}
my $title = $item->title;
$self->log->info("item " . $item->link . " new");
if ($self->{decode_title}) {
$self->log->debug("decoding title $title");
$title = decode_entities($title);
$self->log->debug("decoded title $title");
}
$dbh->do("insert into items(title, link, content, issued, seen, feed_id) values(?, ?, ?, ?, ?, ?)",
{},
$title, $item->link, $item->content, $issued, $now, $self->{id}
$item->title, $item->link, $item->content, $issued, $now, $self->{id}
);
$self->invalidate_item_info;
}
@ -143,7 +135,7 @@ sub update {
$atomfeed = $api->getFeed($self->{url});
} catch {
$self->log->error("error fetching $self->{url}: $@");
};
}
if ($atomfeed) {
my @items = $atomfeed->entries;
for my $item (@items) {

View File

@ -1,9 +1,4 @@
CREATE TABLE feeds (
id serial primary key, url varchar, active boolean,
last_update int, title varchar, type varchar, allow_img boolean,
expire int, lang varchar,
decode_title boolean
);
CREATE TABLE feeds (id serial primary key, url varchar, active boolean, last_update int, title varchar, type varchar, allow_img boolean, expire int, lang varchar);
CREATE TABLE items (id serial primary key, title varchar, link varchar, content varchar, issued int, seen int, feed_id integer, old int);
CREATE TABLE read(item_id integer, username varchar, foreign key (item_id) references items(id));
CREATE INDEX on items(link);