mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Cleanup previous PR
There was a leftover str(id).
This commit is contained in:
parent
8dc6a4ea9d
commit
ea4aebf878
@ -172,7 +172,7 @@ class Formatter(TemplateFormatter):
|
|||||||
return key
|
return key
|
||||||
|
|
||||||
|
|
||||||
def get_component_metadata(template, mi, id_, timefmt='%b %Y'):
|
def get_component_metadata(template, mi, book_id, timefmt='%b %Y'):
|
||||||
tsorder = tweaks['save_template_title_series_sorting']
|
tsorder = tweaks['save_template_title_series_sorting']
|
||||||
format_args = FORMAT_ARGS.copy()
|
format_args = FORMAT_ARGS.copy()
|
||||||
format_args.update(mi.all_non_none_fields())
|
format_args.update(mi.all_non_none_fields())
|
||||||
@ -215,7 +215,7 @@ def get_component_metadata(template, mi, id_, timefmt='%b %Y'):
|
|||||||
hasattr(mi.last_modified, 'timetuple')):
|
hasattr(mi.last_modified, 'timetuple')):
|
||||||
format_args['last_modified'] = strftime(timefmt, mi.last_modified.timetuple())
|
format_args['last_modified'] = strftime(timefmt, mi.last_modified.timetuple())
|
||||||
|
|
||||||
format_args['id'] = str(id_)
|
format_args['id'] = str(book_id)
|
||||||
# Now format the custom fields
|
# Now format the custom fields
|
||||||
custom_metadata = mi.get_all_user_metadata(make_copy=False)
|
custom_metadata = mi.get_all_user_metadata(make_copy=False)
|
||||||
for key in custom_metadata:
|
for key in custom_metadata:
|
||||||
@ -239,20 +239,20 @@ def get_component_metadata(template, mi, id_, timefmt='%b %Y'):
|
|||||||
format_args[key] = ''
|
format_args[key] = ''
|
||||||
return format_args
|
return format_args
|
||||||
|
|
||||||
def get_components(template, mi, id_, timefmt='%b %Y', length=250,
|
|
||||||
|
def get_components(template, mi, book_id, timefmt='%b %Y', length=250,
|
||||||
sanitize_func=ascii_filename, replace_whitespace=False,
|
sanitize_func=ascii_filename, replace_whitespace=False,
|
||||||
to_lowercase=False, safe_format=True, last_has_extension=True,
|
to_lowercase=False, safe_format=True, last_has_extension=True,
|
||||||
single_dir=False):
|
single_dir=False):
|
||||||
format_args = get_component_metadata(template, mi, id_, timefmt)
|
format_args = get_component_metadata(template, mi, book_id, timefmt)
|
||||||
if safe_format:
|
if safe_format:
|
||||||
components = Formatter().safe_format(template, format_args,
|
components = Formatter().safe_format(template, format_args, 'G_C-EXCEPTION!', mi)
|
||||||
'G_C-EXCEPTION!', mi)
|
|
||||||
else:
|
else:
|
||||||
components = Formatter().unsafe_format(template, format_args, mi)
|
components = Formatter().unsafe_format(template, format_args, mi)
|
||||||
components = [x.strip() for x in components.split('/')]
|
components = [x.strip() for x in components.split('/')]
|
||||||
components = [sanitize_func(x) for x in components if x]
|
components = [sanitize_func(x) for x in components if x]
|
||||||
if not components:
|
if not components:
|
||||||
components = [str(id)]
|
components = [str(book_id)]
|
||||||
if to_lowercase:
|
if to_lowercase:
|
||||||
components = [x.lower() for x in components]
|
components = [x.lower() for x in components]
|
||||||
if replace_whitespace:
|
if replace_whitespace:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user