home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 January / maximum-cd-2011-01.iso / DiscContents / calibre-0.7.26.msi / file_1431 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-10-31  |  3.3 KB  |  59 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. __license__ = 'GPL v3'
  5. __copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
  6. __docformat__ = 'restructuredtext en'
  7. import os
  8. from calibre.utils.config import Config, StringConfig, config_dir, tweaks
  9. listen_on = '0.0.0.0'
  10. log_access_file = os.path.join(config_dir, 'server_access_log.txt')
  11. log_error_file = os.path.join(config_dir, 'server_error_log.txt')
  12.  
  13. def server_config(defaults = None):
  14.     desc = _('Settings to control the calibre content server')
  15.     c = None if defaults is None else StringConfig(defaults, desc)
  16.     c.add_opt('port', [
  17.         '-p',
  18.         '--port'], default = 8080, help = _('The port on which to listen. Default is %default'))
  19.     c.add_opt('timeout', [
  20.         '-t',
  21.         '--timeout'], default = 120, help = _('The server timeout in seconds. Default is %default'))
  22.     c.add_opt('thread_pool', [
  23.         '--thread-pool'], default = 30, help = _('The max number of worker threads to use. Default is %default'))
  24.     c.add_opt('password', [
  25.         '--password'], default = None, help = _('Set a password to restrict access. By default access is unrestricted.'))
  26.     c.add_opt('username', [
  27.         '--username'], default = 'calibre', help = _('Username for access. By default, it is: %default'))
  28.     c.add_opt('develop', [
  29.         '--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.")
  30.     c.add_opt('max_cover', [
  31.         '--max-cover'], default = '600x800', help = _('The maximum size for displayed covers. Default is %default.'))
  32.     c.add_opt('max_opds_items', [
  33.         '--max-opds-items'], default = 30, help = _('The maximum number of matches to return per OPDS query. This affects Stanza, WordPlayer, etc. integration.'))
  34.     c.add_opt('max_opds_ungrouped_items', [
  35.         '--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.'))
  36.     c.add_opt('url_prefix', [
  37.         '--url-prefix'], default = '', help = _('Prefix to prepend to all URLs. Useful for reverseproxying to this server from Apache/nginx/etc.'))
  38.     return c
  39.  
  40.  
  41. def custom_fields_to_display(db):
  42.     ckeys = db.custom_field_keys()
  43.     yes_fields = set(tweaks['content_server_will_display'])
  44.     no_fields = set(tweaks['content_server_wont_display'])
  45.     if '*' in yes_fields:
  46.         yes_fields = set(ckeys)
  47.     
  48.     if '*' in no_fields:
  49.         no_fields = set(ckeys)
  50.     
  51.     return frozenset(yes_fields - no_fields)
  52.  
  53.  
  54. def main():
  55.     main = main
  56.     import calibre.library.server.main
  57.     return main()
  58.  
  59.