def config(defaults=None): desc = _('Options to control the ebook viewer') if defaults is None: c = Config('viewer', desc) else: c = StringConfig(defaults, desc) c.add_opt('raise_window', ['--raise-window'], default=False, help=_('If specified, viewer window will try to come to the ' 'front when started.')) c.add_opt('full_screen', ['--full-screen', '--fullscreen', '-f'], default=False, help=_('If specified, viewer window will try to open ' 'full screen when started.')) c.add_opt('remember_window_size', default=False, help=_('Remember last used window size')) c.add_opt( 'debug_javascript', ['--debug-javascript'], default=False, help=_('Print javascript alert and console messages to the console')) c.add_opt( 'open_at', ['--open-at'], default=None, help=_( 'The position at which to open the specified book. The position is ' 'a location as displayed in the top left corner of the viewer.')) return c
def server_config(defaults=None): desc=_('Settings to control the calibre content server') c = Config('server', desc) if defaults is None else StringConfig(defaults, desc) c.add_opt('port', ['-p', '--port'], default=8080, help=_('The port on which to listen. Default is %default')) c.add_opt('timeout', ['-t', '--timeout'], default=120, help=_('The server timeout in seconds. Default is %default')) c.add_opt('thread_pool', ['--thread-pool'], default=30, help=_('The max number of worker threads to use. Default is %default')) c.add_opt('password', ['--password'], default=None, help=_('Set a password to restrict access. By default access is unrestricted.')) c.add_opt('username', ['--username'], default='calibre', help=_('Username for access. By default, it is: %default')) c.add_opt('develop', ['--develop'], default=False, help='Development mode. Server automatically restarts on file changes and serves code files (html, css, js) from the file system instead of calibre\'s resource system.') c.add_opt('max_cover', ['--max-cover'], default='600x800', help=_('The maximum size for displayed covers. Default is %default.')) c.add_opt('max_opds_items', ['--max-opds-items'], default=30, help=_('The maximum number of matches to return per OPDS query. ' 'This affects Stanza, WordPlayer, etc. integration.')) c.add_opt('max_opds_ungrouped_items', ['--max-opds-ungrouped-items'], default=100, help=_('Group items in categories such as author/tags ' 'by first letter when there are more than this number ' 'of items. Default: %default. Set to a large number ' 'to disable grouping.')) c.add_opt('url_prefix', ['--url-prefix'], default='', help=_('Prefix to prepend to all URLs. Useful for reverse' 'proxying to this server from Apache/nginx/etc.')) return c
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 "%(templ)s" which will save books into a per-author ' 'subdirectory with filenames containing title and author. ' 'Available controls are: {%(controls)s}')%dict( templ=DEFAULT_TEMPLATE, controls=', '.join(sorted(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 "%(templ)s" which will save books into a per-author ' 'directory with filenames containing title and author. ' 'Available controls are: {%(controls)s}')%dict( templ=DEFAULT_SEND_TEMPLATE, controls=', '.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. %(day)s - day,' ' %(month)s - month, %(mn)s - month number, %(year)s - year. Default is: %(default)s' )%dict(day='%d', month='%b', mn='%m', year='%Y', default='%b, %Y')) x('send_timefmt', default='%b, %Y', help=_('The format in which to display dates. %(day)s - day,' ' %(month)s - month, %(mn)s - month number, %(year)s - year. Default is: %(default)s' )%dict(day='%d', month='%b', mn='%m', year='%Y', default='%b, %Y')) x('to_lowercase', default=False, help=_('Convert paths to lowercase.')) x('replace_whitespace', default=False, help=_('Replace whitespace with underscores.')) x('single_dir', default=False, help=_('Save into a single directory, ignoring the template' ' directory structure')) return c
def config(defaults=None): from calibre.utils.config import Config, StringConfig desc = _('Control email delivery') c = Config('smtp', desc) if defaults is None else StringConfig( defaults, desc) c.add_opt('from_') c.add_opt('accounts', default={}) c.add_opt('subjects', default={}) c.add_opt('relay_host') c.add_opt('relay_port', default=25) c.add_opt('relay_username') c.add_opt('relay_password') c.add_opt('encryption', default='TLS', choices=['TLS', 'SSL']) return c
def config(): c = StringConfig('') c.add_opt('title', ['-t', '--title'], help=_('Set the title.')) c.add_opt('authors', ['-a', '--authors'], help=_('Set the authors. Multiple authors should be separated ' 'by the & character. Author names should be in the order ' 'Firstname Lastname.')) c.add_opt('title_sort', ['--title-sort'], help=_('The version of the title to be used for sorting. ' 'If unspecified, and the title is specified, it will ' 'be auto-generated from the title.')) c.add_opt('author_sort', ['--author-sort'], help=_( 'String to be used when sorting by author. ' 'If unspecified, and the author(s) are specified, it will ' 'be auto-generated from the author(s).')) c.add_opt('cover', ['--cover'], help=_('Set the cover to the specified file.')) c.add_opt('comments', ['-c', '--comments'], help=_('Set the ebook description.')) c.add_opt('publisher', ['-p', '--publisher'], help=_('Set the ebook publisher.')) c.add_opt('category', ['--category'], help=_('Set the book category.')) c.add_opt('series', ['-s', '--series'], help=_('Set the series this ebook belongs to.')) c.add_opt('series_index', ['-i', '--index'], help=_('Set the index of the book in this series.')) c.add_opt('rating', ['-r', '--rating'], help=_('Set the rating. Should be a number between 1 and 5.')) c.add_opt('isbn', ['--isbn'], help=_('Set the ISBN of the book.')) c.add_opt( 'identifiers', ['--identifier'], action='append', help= _('Set the identifiers for the book, can be specified multiple times.' ' For example: --identifier uri:http://acme.com --identifier isbn:12345' ' To remove an identifier, specify no value, --identifier isbn:' ' Note that for EPUB files, an identifier marked as the package identifier cannot be removed.' )) c.add_opt( 'tags', ['--tags'], help=_('Set the tags for the book. Should be a comma separated list.')) c.add_opt('book_producer', ['-k', '--book-producer'], help=_('Set the book producer.')) c.add_opt('language', ['-l', '--language'], help=_('Set the language.')) c.add_opt('pubdate', ['-d', '--date'], help=_('Set the published date.')) c.add_opt('get_cover', ['--get-cover'], help=_('Get the cover from the ebook and save it at as the ' 'specified file.')) c.add_opt('to_opf', ['--to-opf'], help=_('Specify the name of an OPF file. The metadata will ' 'be written to the OPF file.')) c.add_opt( 'from_opf', ['--from-opf'], help=_('Read metadata from the specified OPF file and use it to ' 'set metadata in the ebook. Metadata specified on the ' 'command line will override metadata read from the OPF file')) c.add_opt('lrf_bookid', ['--lrf-bookid'], help=_('Set the BookID in LRF files')) return c
def config(defaults=None): desc = _('Options to customize the ebook viewer') if defaults is None: c = Config('viewer', desc) else: c = StringConfig(defaults, desc) c.add_opt('remember_window_size', default=False, help=_('Remember last used window size')) c.add_opt('user_css', default='', help=_('Set the user CSS stylesheet. This can be used to customize the look of all books.')) c.add_opt('max_fs_width', default=800, help=_("Set the maximum width that the book's text and pictures will take" " when in fullscreen mode. This allows you to read the book text" " without it becoming too wide.")) c.add_opt('max_fs_height', default=-1, help=_("Set the maximum height that the book's text and pictures will take" " when in fullscreen mode. This allows you to read the book text" " without it becoming too tall. Note that this setting only takes effect in paged mode (which is the default mode).")) c.add_opt('fit_images', default=True, help=_('Resize images larger than the viewer window to fit inside it')) c.add_opt('hyphenate', default=False, help=_('Hyphenate text')) c.add_opt('hyphenate_default_lang', default='en', help=_('Default language for hyphenation rules')) c.add_opt('search_online_url', default='https://www.google.com/search?q={text}', help=_('The URL to use when searching for selected text online')) c.add_opt('remember_current_page', default=True, help=_('Save the current position in the document, when quitting')) c.add_opt('copy_bookmarks_to_file', default=True, help=_('Copy bookmarks to the ebook file for easy sharing, if possible')) c.add_opt('wheel_flips_pages', default=False, help=_('Have the mouse wheel turn pages')) c.add_opt('wheel_scroll_fraction', default=100, help=_('Control how much the mouse wheel scrolls by in flow mode')) c.add_opt('line_scroll_fraction', default=100, help=_('Control how much the arrow keys scroll by in flow mode')) c.add_opt('tap_flips_pages', default=True, help=_('Tapping on the screen turns pages')) c.add_opt('line_scrolling_stops_on_pagebreaks', default=False, help=_('Prevent the up and down arrow keys from scrolling past ' 'page breaks')) c.add_opt('page_flip_duration', default=0.5, help=_('The time, in seconds, for the page flip animation. Default' ' is half a second.')) c.add_opt('font_magnification_step', default=0.2, help=_('The amount by which to change the font size when clicking' ' the font larger/smaller buttons. Should be a number between ' '0 and 1.')) c.add_opt('fullscreen_clock', default=False, action='store_true', help=_('Show a clock in fullscreen mode.')) c.add_opt('fullscreen_pos', default=False, action='store_true', help=_('Show reading position in fullscreen mode.')) c.add_opt('fullscreen_scrollbar', default=True, action='store_false', help=_('Show the scrollbar in fullscreen mode.')) c.add_opt('start_in_fullscreen', default=False, action='store_true', help=_('Start viewer in full screen mode')) c.add_opt('show_fullscreen_help', default=True, action='store_false', help=_('Show full screen usage help')) c.add_opt('cols_per_screen', default=1) c.add_opt('cols_per_screen_portrait', default=1) c.add_opt('cols_per_screen_landscape', default=1) c.add_opt('cols_per_screen_migrated', default=False, action='store_true') c.add_opt('use_book_margins', default=False, action='store_true') c.add_opt('top_margin', default=20) c.add_opt('side_margin', default=40) c.add_opt('bottom_margin', default=20) c.add_opt('text_color', default=None) c.add_opt('background_color', default=None) c.add_opt('show_controls', default=True) fonts = c.add_group('FONTS', _('Font options')) fonts('serif_family', default='Times New Roman' if iswindows else 'Liberation Serif', help=_('The serif font family')) fonts('sans_family', default='Verdana' if iswindows else 'Liberation Sans', help=_('The sans-serif font family')) fonts('mono_family', default='Courier New' if iswindows else 'Liberation Mono', help=_('The monospaced font family')) fonts('default_font_size', default=20, help=_('The standard font size in px')) fonts('mono_font_size', default=16, help=_('The monospaced font size in px')) fonts('standard_font', default='serif', help=_('The standard font type')) fonts('minimum_font_size', default=8, help=_('The minimum font size in px')) oparse = c.parse def parse(): ans = oparse() if not ans.cols_per_screen_migrated: ans.cols_per_screen_portrait = ans.cols_per_screen_landscape = ans.cols_per_screen return ans c.parse = parse return c
def config(): c = StringConfig('') c.add_opt('title', ['-t', '--title'], help=_('Set the title.')) c.add_opt('authors', ['-a', '--authors'], help=_('Set the authors. Multiple authors should be separated ' 'by the & character. Author names should be in the order ' 'Firstname Lastname.')) c.add_opt('title_sort', ['--title-sort'], help=_('The version of the title to be used for sorting. ' 'If unspecified, and the title is specified, it will ' 'be auto-generated from the title.')) c.add_opt('author_sort', ['--author-sort'], help=_('String to be used when sorting by author. ' 'If unspecified, and the author(s) are specified, it will ' 'be auto-generated from the author(s).')) c.add_opt('cover', ['--cover'], help=_('Set the cover to the specified file.')) c.add_opt('comments', ['-c', '--comments'], help=_('Set the e-book description.')) c.add_opt('publisher', ['-p', '--publisher'], help=_('Set the e-book publisher.')) c.add_opt('category', ['--category'], help=_('Set the book category.')) c.add_opt('series', ['-s', '--series'], help=_('Set the series this e-book belongs to.')) c.add_opt('series_index', ['-i', '--index'], help=_('Set the index of the book in this series.')) c.add_opt('rating', ['-r', '--rating'], help=_('Set the rating. Should be a number between 1 and 5.')) c.add_opt('isbn', ['--isbn'], help=_('Set the ISBN of the book.')) c.add_opt('identifiers', ['--identifier'], action='append', help=_('Set the identifiers for the book, can be specified multiple times.' ' For example: --identifier uri:https://acme.com --identifier isbn:12345' ' To remove an identifier, specify no value, --identifier isbn:' ' Note that for EPUB files, an identifier marked as the package identifier cannot be removed.')) c.add_opt('tags', ['--tags'], help=_('Set the tags for the book. Should be a comma separated list.')) c.add_opt('book_producer', ['-k', '--book-producer'], help=_('Set the book producer.')) c.add_opt('language', ['-l', '--language'], help=_('Set the language.')) c.add_opt('pubdate', ['-d', '--date'], help=_('Set the published date.')) c.add_opt('get_cover', ['--get-cover'], help=_('Get the cover from the e-book and save it at as the ' 'specified file.')) c.add_opt('to_opf', ['--to-opf'], help=_('Specify the name of an OPF file. The metadata will ' 'be written to the OPF file.')) c.add_opt('from_opf', ['--from-opf'], help=_('Read metadata from the specified OPF file and use it to ' 'set metadata in the e-book. Metadata specified on the ' 'command line will override metadata read from the OPF file')) c.add_opt('lrf_bookid', ['--lrf-bookid'], help=_('Set the BookID in LRF files')) return c
def config(defaults=None): desc = _('Options to customize the ebook viewer') if defaults is None: c = Config('viewer', desc) else: c = StringConfig(defaults, desc) c.add_opt('remember_window_size', default=False, help=_('Remember last used window size')) c.add_opt( 'user_css', default='', help= _('Set the user CSS stylesheet. This can be used to customize the look of all books.' )) c.add_opt( 'max_fs_width', default=800, help=_( "Set the maximum width that the book's text and pictures will take" " when in fullscreen mode. This allows you to read the book text" " without it becoming too wide.")) c.add_opt( 'fit_images', default=True, help=_('Resize images larger than the viewer window to fit inside it')) c.add_opt('hyphenate', default=False, help=_('Hyphenate text')) c.add_opt('hyphenate_default_lang', default='en', help=_('Default language for hyphenation rules')) c.add_opt( 'remember_current_page', default=True, help=_('Save the current position in the document, when quitting')) c.add_opt('wheel_flips_pages', default=False, help=_('Have the mouse wheel turn pages')) c.add_opt('line_scrolling_stops_on_pagebreaks', default=False, help=_('Prevent the up and down arrow keys from scrolling past ' 'page breaks')) c.add_opt('page_flip_duration', default=0.5, help=_( 'The time, in seconds, for the page flip animation. Default' ' is half a second.')) c.add_opt( 'font_magnification_step', default=0.2, help=_('The amount by which to change the font size when clicking' ' the font larger/smaller buttons. Should be a number between ' '0 and 1.')) c.add_opt('fullscreen_clock', default=False, action='store_true', help=_('Show a clock in fullscreen mode.')) fonts = c.add_group('FONTS', _('Font options')) fonts('serif_family', default='Times New Roman' if iswindows else 'Liberation Serif', help=_('The serif font family')) fonts('sans_family', default='Verdana' if iswindows else 'Liberation Sans', help=_('The sans-serif font family')) fonts('mono_family', default='Courier New' if iswindows else 'Liberation Mono', help=_('The monospaced font family')) fonts('default_font_size', default=20, help=_('The standard font size in px')) fonts('mono_font_size', default=16, help=_('The monospaced font size in px')) fonts('standard_font', default='serif', help=_('The standard font type')) return c