qmsk/irclogs/config.py
author Tero Marttila <terom@fixme.fi>
Sun, 13 Sep 2009 20:11:00 +0300
changeset 144 35c4c56f1376
parent 141 65c98c9e1716
permissions -rw-r--r--
update HGWEB_URL
     1 """
     2     Configureable defaults
     3 """
     4 
     5 import os.path, pytz
     6 from log_parser import IrssiParser
     7 from log_channel import LogChannel
     8 from log_source import LogSourceDecoder, LogDirectory
     9 from log_formatter import IrssiFormatter, DebugFormatter
    10 from channels import ChannelList
    11 import log_formatter
    12 
    13 # build relative paths to the dir containing this file
    14 relpath = lambda path : os.path.join(os.path.dirname(__file__), path)
    15 
    16 ###                     ###
    17 ###    Configuration    ###
    18 ###                     ###
    19 
    20 # timezone to use for logs
    21 LOG_TIMEZONE                    = pytz.timezone('Europe/Helsinki')
    22 
    23 # timestamp format for logfiles
    24 LOG_TIMESTAMP_FMT               = '%H:%M:%S'
    25 
    26 # the decoder used for logfiles
    27 LOG_DECODER                     = LogSourceDecoder((
    28     ('utf-8',       'strict'),
    29     ('latin-1',     'replace'),
    30 ))
    31 
    32 # log filename format
    33 LOG_FILENAME_FMT                = '%Y-%m-%d'
    34 
    35 # the log parser that we use
    36 LOG_PARSER                      = IrssiParser(LOG_TIMEZONE, LOG_TIMESTAMP_FMT)
    37 #LOG_PARSER_FULLTS               = IrssiParser(LOG_TIMEZONE, '%Y%m%d%H%M%S')
    38 
    39 # the statically defined channel list
    40 LOG_CHANNELS                    = ChannelList([
    41     LogChannel('tycoon',    "OFTC",     "#tycoon", 
    42         LogDirectory(relpath('/home/spbot/irclogs/tycoon'),    LOG_TIMEZONE, LOG_PARSER, LOG_DECODER, LOG_FILENAME_FMT)
    43     ),
    44 
    45     LogChannel('openttd',   "OFTC",     "#openttd", 
    46         LogDirectory(relpath('/home/spbot/irclogs/openttd'),   LOG_TIMEZONE, LOG_PARSER, LOG_DECODER, LOG_FILENAME_FMT)
    47     ),
    48 
    49     LogChannel('test',      "TEST",     "#test",
    50         LogDirectory(relpath('/home/spbot/irclogs/test'),  LOG_TIMEZONE, LOG_PARSER, LOG_DECODER, LOG_FILENAME_FMT)
    51     )
    52 ])
    53 
    54 # URL to the hgweb installation for this code
    55 HGWEB_URL                       = "http://hg.qmsk.net/qmsk.irclogs"
    56 
    57 # path to the mercurial working copy
    58 HG_WC_PATH                      = "."
    59 
    60 # how to handle decode() errors for logfile lines
    61 LOG_SOURCE_DECODE_ERRORS        = 'replace'
    62 
    63 # date format for URLs
    64 URL_DATE_FMT                    = '%Y-%m-%d'
    65 
    66 # month name format
    67 MONTH_FMT                       = '%B %Y'
    68 
    69 # timezone name format
    70 TIMEZONE_FMT                    = '%Z %z'
    71 
    72 # TTF fonts to use for drawing images
    73 FORMATTER_IMAGE_FONTS =         {
    74     # XXX: no unicode support
    75     #    'default':              (None,                                                                  "Ugly default font"         ),
    76     'ttf-dejavu-mono':      ("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf",             "DejaVu Sans Mono"          ),
    77     'ttf-liberation-mono':  ("/usr/share/fonts/truetype/ttf-liberation/LiberationMono-Regular.ttf", "Liberation Mono Regular"   )
    78 }
    79 
    80 # available formatters
    81 LOG_FORMATTERS =                {
    82     'irssi':        IrssiFormatter,
    83     'debug':        DebugFormatter,
    84 }
    85 
    86 # Cookie settings
    87 PREF_COOKIE_PATH                = '/'
    88 PREF_COOKIE_EXPIRE_SECONDS      = 1 * 365 * 24 * 60 * 60    # one year
    89 
    90 # default preferences
    91 PREF_TIME_FMT_DEFAULT           = '%H:%M:%S'
    92 PREF_DATE_FMT_DEFAULT           = '%Y-%m-%d'
    93 PREF_TIMEZONE_FALLBACK          = pytz.utc
    94 PREF_FORMATTER_DEFAULT          = IrssiFormatter
    95 PREF_COUNT_DEFAULT              = 200
    96 PREF_COUNT_MAX                  = None
    97 PREF_IMAGE_FONT_DEFAULT         = 'ttf-dejavu-mono'
    98 PREF_IMAGE_FONT_SIZE_DEFAULT    = 12
    99 PREF_IMAGE_FONT_SIZE_MAX        = 32
   100 
   101 # search line count options
   102 SEARCH_LINE_COUNT_OPTIONS       = (
   103     (50,    50), 
   104     (100,   100), 
   105     (200,   200), 
   106 
   107 # infinity, not supported
   108 #    (0,     "&#8734;"),
   109 )
   110 
   111 # search index database path
   112 SEARCH_INDEX_PATH               = '/home/spbot/irclogs/search-index'
   113 SEARCH_AUTOINDEX_PATH           = '/home/spbot/irclogs/search-autoindex'
   114