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).\
|
filter_by(enabled=1).\
|
||||||
order_by(Feed.id)
|
order_by(Feed.id)
|
||||||
for feed in allfeeds:
|
for feed in allfeeds:
|
||||||
feed.fetch()
|
feed.fetch(session)
|
||||||
print
|
print
|
||||||
|
|
||||||
def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):
|
def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):
|
||||||
|
@ -57,7 +57,7 @@ class Feed(Base):
|
|||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<Feed('%d','%s')>" % (self.id, self.url)
|
return "<Feed('%d','%s')>" % (self.id, self.url)
|
||||||
|
|
||||||
def fetch(self):
|
def fetch(self, session):
|
||||||
print 'processing %d: %s' % (self.id, self.url)
|
print 'processing %d: %s' % (self.id, self.url)
|
||||||
fetched = False
|
fetched = False
|
||||||
if self.feedinfo:
|
if self.feedinfo:
|
||||||
@ -88,7 +88,7 @@ class Feed(Base):
|
|||||||
entries_total = 0
|
entries_total = 0
|
||||||
for entry in parser.entries:
|
for entry in parser.entries:
|
||||||
entries_total += 1
|
entries_total += 1
|
||||||
thisentry = self.entries.\
|
thisentry = session.query(Entry).\
|
||||||
filter(Entry.title == entry.title).\
|
filter(Entry.title == entry.title).\
|
||||||
filter(Entry.link == entry.link).\
|
filter(Entry.link == entry.link).\
|
||||||
first()
|
first()
|
||||||
|
Loading…
Reference in New Issue
Block a user