mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2026-05-09 05:21:13 +02:00
First rough version of reporting continue_on_chapter_error chapters.
This commit is contained in:
parent
f08b922a80
commit
ec75736717
5 changed files with 31 additions and 5 deletions
|
|
@ -1856,6 +1856,7 @@ class FanFicFarePlugin(InterfaceAction):
|
|||
book_list = job.result
|
||||
good_list = [ x for x in book_list if x['good'] ]
|
||||
bad_list = [ x for x in book_list if not x['good'] ]
|
||||
chapter_error_list = [ x for x in book_list if 'chapter_error_count' in x ]
|
||||
try:
|
||||
good_list = sorted(good_list,key=lambda x : x['reportorder'])
|
||||
bad_list = sorted(bad_list,key=lambda x : x['reportorder'])
|
||||
|
|
@ -1865,9 +1866,15 @@ class FanFicFarePlugin(InterfaceAction):
|
|||
#print("book_list:%s"%book_list)
|
||||
payload = (good_list, bad_list, options)
|
||||
|
||||
if chapter_error_list:
|
||||
info_dialog(self.gui, _('FanFicFare: ')+_('Some Failed Chapters'),
|
||||
_('Some of the stories downloaded have failed chapters. Click View Log in the next dialog to see which.'),
|
||||
show=True,
|
||||
show_copy_button=False)
|
||||
|
||||
if merge:
|
||||
if len(good_list) < 1:
|
||||
info_dialog(self.gui, _('No Good Stories for Anthology'),
|
||||
info_dialog(self.gui, _('FanFicFare: ')+_('No Good Stories for Anthology'),
|
||||
_('No good stories/updates where downloaded, Anthology creation/update aborted.'),
|
||||
show=True,
|
||||
show_copy_button=False)
|
||||
|
|
|
|||
|
|
@ -247,7 +247,16 @@ def do_download_for_worker(book,options,merge,notification=lambda x,y:x):
|
|||
inject_cal_cols(book,story,configuration)
|
||||
writer.writeStory(outfilename=outfile, forceOverwrite=True)
|
||||
|
||||
book['comment'] = _('Download %s completed, %s chapters.')%(options['fileform'],story.getMetadata("numChapters"))
|
||||
if adapter.story.chapter_error_count > 0:
|
||||
book['comment'] = _('Download %(fileform)s completed, %(failed)s failed chapters, %(total)s total chapters.')%\
|
||||
{'fileform':options['fileform'],
|
||||
'failed':adapter.story.chapter_error_count,
|
||||
'total':story.getMetadata("numChapters")}
|
||||
book['chapter_error_count'] = adapter.story.chapter_error_count
|
||||
else:
|
||||
book['comment'] = _('Download %(fileform)s completed, %(total)s chapters.')%\
|
||||
{'fileform':options['fileform'],
|
||||
'total':story.getMetadata("numChapters")}
|
||||
book['all_metadata'] = story.getAllMetadata(removeallentities=True)
|
||||
if options['savemetacol'] != '':
|
||||
book['savemetacol'] = story.dump_html_metadata()
|
||||
|
|
@ -297,8 +306,13 @@ def do_download_for_worker(book,options,merge,notification=lambda x,y:x):
|
|||
inject_cal_cols(book,story,configuration)
|
||||
writer.writeStory(outfilename=outfile, forceOverwrite=True)
|
||||
|
||||
book['comment'] = _('Update %(fileform)s completed, added %(added)s chapters for %(total)s total.')%\
|
||||
{'fileform':options['fileform'],'added':(urlchaptercount-chaptercount),'total':urlchaptercount}
|
||||
if adapter.story.chapter_error_count > 0:
|
||||
book['comment'] = _('Update %(fileform)s completed, added %(added)s chapters, %(failed)s failed chapters, for %(total)s total.')%\
|
||||
{'fileform':options['fileform'],'added':(urlchaptercount-chaptercount),'total':urlchaptercount}
|
||||
book['chapter_error_count'] = adapter.story.chapter_error_count
|
||||
else:
|
||||
book['comment'] = _('Update %(fileform)s completed, added %(added)s chapters for %(total)s total.')%\
|
||||
{'fileform':options['fileform'],'added':(urlchaptercount-chaptercount),'total':urlchaptercount}
|
||||
book['all_metadata'] = story.getAllMetadata(removeallentities=True)
|
||||
if options['savemetacol'] != '':
|
||||
book['savemetacol'] = story.dump_html_metadata()
|
||||
|
|
|
|||
|
|
@ -255,6 +255,7 @@ class BaseSiteAdapter(Configurable):
|
|||
</div>"""%(url,traceback.format_exc().replace("&","&").replace(">",">").replace("<","<")))
|
||||
title = title+self.getConfig("chapter_title_error_mark","(CHAPTER ERROR)")
|
||||
url="chapter url removed due to failure"
|
||||
self.story.chapter_error_count += 1
|
||||
else:
|
||||
raise
|
||||
|
||||
|
|
|
|||
|
|
@ -521,7 +521,9 @@ def do_download(arg,
|
|||
import json
|
||||
print(json.dumps(metadata, sort_keys=True,
|
||||
indent=2, separators=(',', ':')))
|
||||
|
||||
if adapter.story.chapter_error_count > 0:
|
||||
print("%s chapters errored downloading %s"%(adapter.story.chapter_error_count,
|
||||
url))
|
||||
del adapter
|
||||
|
||||
except exceptions.InvalidStoryURL as isu:
|
||||
|
|
|
|||
|
|
@ -476,6 +476,8 @@ class Story(Configurable):
|
|||
|
||||
self.replacements_prepped = False
|
||||
|
||||
self.chapter_error_count = 0
|
||||
|
||||
def prepare_replacements(self):
|
||||
if not self.replacements_prepped and not self.is_lightweight():
|
||||
# logger.debug("prepare_replacements")
|
||||
|
|
|
|||
Loading…
Reference in a new issue