Ok, this doesn't seem to be so hard, at least to some degree
I added unique_id to Article class:
def unique_id(self):
md5=hashlib.md5()
md5.update(self.id)
md5.update(self.title)
md5.update(self.url)
return md5.hexdigest()
Then, in news.py after line 920 I added:
if a==0:
last_article=dynamic['recipe_'+self.title+'last_article']
if last_article is not None:
#print last_article
if last_article==article.unique_id():
print " Nothing to do"
raise ValueError('No articles found, aborting')
dynamic['recipe_'+self.title+'last_article']=article.unique_id()
The good: yeey, if the last article is the last article we downloaded processing is aborted
The bad: I see no other (easy) option than throwing an exception, which of course propagates to UI. Any idea where / how to silently handle it?
|