Fix #1020 (Errors occuring during multiple add should not interrupt the process)

This commit is contained in:
Kovid Goyal 2008-09-17 14:26:50 -07:00
parent c66ea072e9
commit fd90212e27
2 changed files with 12 additions and 5 deletions

View File

@ -507,14 +507,17 @@ in which you want to store your books files. Any existing books will be automati
format = os.path.splitext(book)[1] format = os.path.splitext(book)[1]
format = format[1:] if format else None format = format[1:] if format else None
stream = open(book, 'rb') stream = open(book, 'rb')
try:
mi = get_metadata(stream, stream_type=format, use_libprs_metadata=True) mi = get_metadata(stream, stream_type=format, use_libprs_metadata=True)
except:
mi = MetaInformation(None, None)
if not mi.title: if not mi.title:
mi.title = os.path.splitext(os.path.basename(book))[0] mi.title = os.path.splitext(os.path.basename(book))[0]
if not mi.authors:
mi.authors = [_('Unknown')]
formats.append(format) formats.append(format)
metadata.append(mi) metadata.append(mi)
names.append(os.path.basename(book)) names.append(os.path.basename(book))
if not mi.authors:
mi.authors = ['Unknown']
infos.append({'title':mi.title, 'authors':', '.join(mi.authors), infos.append({'title':mi.title, 'authors':', '.join(mi.authors),
'cover':self.default_thumbnail, 'tags':[]}) 'cover':self.default_thumbnail, 'tags':[]})
@ -524,7 +527,11 @@ in which you want to store your books files. Any existing books will be automati
paths = list(paths) paths = list(paths)
for i, path in enumerate(paths): for i, path in enumerate(paths):
if html_pat.search(path) is not None: if html_pat.search(path) is not None:
try:
paths[i] = html2oeb(path) paths[i] = html2oeb(path)
except:
traceback.print_exc()
continue
if paths[i] is None: if paths[i] is None:
paths[i] = path paths[i] = path
else: else:

View File

@ -45,7 +45,7 @@ class cmd_commit(_cmd_commit):
password = config.get_user_option(prefix+'password') password = config.get_user_option(prefix+'password')
close_bug = config.get_user_option(prefix+'pattern') close_bug = config.get_user_option(prefix+'pattern')
if close_bug is None: if close_bug is None:
close_bug = r'(Fix|Implement)\s+#(\d+)' close_bug = r'(Fix|Implement|Fixes|Fixed|Implemented)\s+#(\d+)'
close_bug_pat = re.compile(close_bug, re.IGNORECASE) close_bug_pat = re.compile(close_bug, re.IGNORECASE)
match = close_bug_pat.search(msg) match = close_bug_pat.search(msg)
if not match: if not match: