prevent duplicate entries from different feeds
This commit is contained in:
parent
1dfb7e5067
commit
0839980a45
@ -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!'):
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user