FORMAT_ARG_DESCS = dict(title = _('The title'), authors = _('The authors'), author_sort = _('The author sort string. To use only the first letter of the name use {author_sort[0]}'), tags = _('The tags'), series = _('The series'), series_index = _('The series number. To get leading zeros use {series_index:0>3s} or {series_index:>3s} for leading spaces'), rating = _('The rating'), isbn = _('The ISBN'), publisher = _('The publisher'), timestamp = _('The date'), pubdate = _('The published date'), id = _('The calibre internal id'))
FORMAT_ARGS = { }
for x in FORMAT_ARG_DESCS:
FORMAT_ARGS[x] = ''
def config(defaults = None):
if defaults is None:
c = Config('save_to_disk', _('Options to control saving to disk'))
else:
c = StringConfig(defaults)
x = c.add_opt
x('update_metadata', default = True, help = _('Normally, calibre will update the metadata in the saved files from what is in the calibre library. Makes saving to disk slower.'))
x('write_opf', default = True, help = _('Normally, calibre will write the metadata into a separate OPF file along with the actual e-book files.'))
x('save_cover', default = True, help = _('Normally, calibre will save the cover in a separate file along with the actual e-book file(s).'))
x('formats', default = 'all', help = _('Comma separated list of formats to save for each book. By default all available formats are saved.'))
x('template', default = DEFAULT_TEMPLATE, help = _('The template to control the filename and directory structure of the saved files. Default is "%s" which will save books into a per-author subdirectory with filenames containing title and author. Available controls are: {%s}') % (DEFAULT_TEMPLATE, ', '.join(FORMAT_ARGS)))
x('send_template', default = DEFAULT_SEND_TEMPLATE, help = _('The template to control the filename and directory structure of files sent to the device. Default is "%s" which will save books into a per-author directory with filenames containing title and author. Available controls are: {%s}') % (DEFAULT_SEND_TEMPLATE, ', '.join(FORMAT_ARGS)))
x('asciiize', default = True, help = _('Normally, calibre will convert all non English characters into English equivalents for the file names. WARNING: If you turn this off, you may experience errors when saving, depending on how well the filesystem you are saving to supports unicode.'))
x('timefmt', default = '%b, %Y', help = _('The format in which to display dates. %d - day, %b - month, %Y - year. Default is: %b, %Y'))
x('send_timefmt', default = '%b, %Y', help = _('The format in which to display dates. %d - day, %b - month, %Y - year. Default is: %b, %Y'))
x('to_lowercase', default = False, help = _('Convert paths to lowercase.'))
x('replace_whitespace', default = False, help = _('Replace whitespace with underscores.'))