prevent duplicate entries from different feeds

This commit is contained in:
Ronald Schaten 2013-04-10 00:17:15 +02:00
parent 1dfb7e5067
commit 0839980a45
2 changed files with 3 additions and 3 deletions

View File

@ -122,7 +122,7 @@ def fetch_all_feeds(session):
filter_by(enabled=1).\
order_by(Feed.id)
for feed in allfeeds:
feed.fetch()
feed.fetch(session)
print
def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):

View File

@ -57,7 +57,7 @@ class Feed(Base):
def __repr__(self):
return "<Feed('%d','%s')>" % (self.id, self.url)
def fetch(self):
def fetch(self, session):
print 'processing %d: %s' % (self.id, self.url)
fetched = False
if self.feedinfo:
@ -88,7 +88,7 @@ class Feed(Base):
entries_total = 0
for entry in parser.entries:
entries_total += 1
thisentry = self.entries.\
thisentry = session.query(Entry).\
filter(Entry.title == entry.title).\
filter(Entry.link == entry.link).\
first()