qmsk/irclogs/config.py
changeset 140 6db2527b67cf
parent 131 67f5d2fdca1d
child 141 65c98c9e1716
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qmsk/irclogs/config.py	Sun Sep 13 01:15:56 2009 +0300
@@ -0,0 +1,112 @@
+"""
+    Configureable defaults
+"""
+
+import os.path, pytz
+from log_parser import IrssiParser
+from log_channel import LogChannel
+from log_source import LogSourceDecoder, LogDirectory
+from log_formatter import IrssiFormatter, DebugFormatter
+from channels import ChannelList
+import log_formatter
+
+# build relative paths to the dir containing this file
+relpath = lambda path : os.path.join(os.path.dirname(__file__), path)
+
+###                     ###
+###    Configuration    ###
+###                     ###
+
+# timezone to use for logs
+LOG_TIMEZONE                    = pytz.timezone('Europe/Helsinki')
+
+# timestamp format for logfiles
+LOG_TIMESTAMP_FMT               = '%H:%M:%S'
+
+# the decoder used for logfiles
+LOG_DECODER                     = LogSourceDecoder((
+    ('utf-8',       'strict'),
+    ('latin-1',     'replace'),
+))
+
+# log filename format
+LOG_FILENAME_FMT                = '%Y-%m-%d'
+
+# the log parser that we use
+LOG_PARSER                      = IrssiParser(LOG_TIMEZONE, LOG_TIMESTAMP_FMT)
+#LOG_PARSER_FULLTS               = IrssiParser(LOG_TIMEZONE, '%Y%m%d%H%M%S')
+
+# the statically defined channel list
+LOG_CHANNELS                    = ChannelList([
+    LogChannel('tycoon',    "OFTC",     "#tycoon", 
+        LogDirectory(relpath('/home/spbot/irclogs/tycoon'),    LOG_TIMEZONE, LOG_PARSER, LOG_DECODER, LOG_FILENAME_FMT)
+    ),
+
+    LogChannel('openttd',   "OFTC",     "#openttd", 
+        LogDirectory(relpath('/home/spbot/irclogs/openttd'),   LOG_TIMEZONE, LOG_PARSER, LOG_DECODER, LOG_FILENAME_FMT)
+    ),
+
+    LogChannel('test',      "TEST",     "#test",
+        LogDirectory(relpath('/home/spbot/irclogs/test'),  LOG_TIMEZONE, LOG_PARSER, LOG_DECODER, LOG_FILENAME_FMT)
+    )
+])
+
+# URL to the hgweb installation for this code
+HGWEB_URL                       = "http://hg.qmsk.net/irclogs2"
+
+# path to the mercurial working copy
+HG_WC_PATH                      = "."
+
+# how to handle decode() errors for logfile lines
+LOG_SOURCE_DECODE_ERRORS        = 'replace'
+
+# date format for URLs
+URL_DATE_FMT                    = '%Y-%m-%d'
+
+# month name format
+MONTH_FMT                       = '%B %Y'
+
+# timezone name format
+TIMEZONE_FMT                    = '%Z %z'
+
+# TTF fonts to use for drawing images
+FORMATTER_IMAGE_FONTS =         {
+    # XXX: no unicode support
+    #    'default':              (None,                                                                  "Ugly default font"         ),
+    'ttf-dejavu-mono':      ("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf",             "DejaVu Sans Mono"          ),
+    'ttf-liberation-mono':  ("/usr/share/fonts/truetype/ttf-liberation/LiberationMono-Regular.ttf", "Liberation Mono Regular"   )
+}
+
+# available formatters
+LOG_FORMATTERS =                {
+    'irssi':        IrssiFormatter,
+    'debug':        DebugFormatter,
+}
+
+# Cookie settings
+PREF_COOKIE_PATH                = '/'
+PREF_COOKIE_EXPIRE_SECONDS      = 1 * 365 * 24 * 60 * 60    # one year
+
+# default preferences
+PREF_TIME_FMT_DEFAULT           = '%H:%M:%S'
+PREF_DATE_FMT_DEFAULT           = '%Y-%m-%d'
+PREF_TIMEZONE_FALLBACK          = pytz.utc
+PREF_FORMATTER_DEFAULT          = IrssiFormatter
+PREF_COUNT_DEFAULT              = 200
+PREF_COUNT_MAX                  = None
+PREF_IMAGE_FONT_DEFAULT         = 'ttf-dejavu-mono'
+PREF_IMAGE_FONT_SIZE_DEFAULT    = 12
+PREF_IMAGE_FONT_SIZE_MAX        = 32
+
+# search line count options
+SEARCH_LINE_COUNT_OPTIONS       = (
+    (50,    50), 
+    (100,   100), 
+    (200,   200), 
+    (None,  "∞"),
+)
+
+# search index database path
+SEARCH_INDEX_PATH               = '/home/spbot/irclogs/search-index'
+SEARCH_AUTOINDEX_PATH           = '/home/spbot/irclogs/search-autoindex'
+