mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Conversion pipeline: Handle missing/obsolete input/output profiles gracefully
This commit is contained in:
parent
ff6ac7f352
commit
d1e49d9267
@ -706,15 +706,22 @@ OptionRecommendation(name='timestamp',
|
|||||||
for rec in group:
|
for rec in group:
|
||||||
setattr(self.opts, rec.option.name, rec.recommended_value)
|
setattr(self.opts, rec.option.name, rec.recommended_value)
|
||||||
|
|
||||||
for x in input_profiles():
|
def set_profile(profiles, which):
|
||||||
if x.short_name == self.opts.input_profile:
|
attr = which + '_profile'
|
||||||
self.opts.input_profile = x
|
sval = getattr(self.opts, attr)
|
||||||
break
|
for x in profiles():
|
||||||
|
if x.short_name == sval:
|
||||||
|
setattr(self.opts, attr, x)
|
||||||
|
return
|
||||||
|
self.log.warn(
|
||||||
|
'Profile (%s) %r is no longer available, using default'%(which, sval))
|
||||||
|
for x in profiles():
|
||||||
|
if x.short_name == 'default':
|
||||||
|
setattr(self.opts, attr, x)
|
||||||
|
break
|
||||||
|
|
||||||
for x in output_profiles():
|
set_profile(input_profiles, 'input')
|
||||||
if x.short_name == self.opts.output_profile:
|
set_profile(output_profiles, 'output')
|
||||||
self.opts.output_profile = x
|
|
||||||
break
|
|
||||||
|
|
||||||
self.read_user_metadata()
|
self.read_user_metadata()
|
||||||
self.opts.no_inline_navbars = self.opts.output_profile.supports_mobi_indexing \
|
self.opts.no_inline_navbars = self.opts.output_profile.supports_mobi_indexing \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user