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
13 # build relative paths to the dir containing this file
14 relpath = lambda path : os.path.join(os.path.dirname(__file__), path)
20 # timezone to use for logs
21 LOG_TIMEZONE = pytz.timezone('Europe/Helsinki')
23 # timestamp format for logfiles
24 LOG_TIMESTAMP_FMT = '%H:%M:%S'
26 # the decoder used for logfiles
27 LOG_DECODER = LogSourceDecoder((
29 ('latin-1', 'replace'),
33 LOG_FILENAME_FMT = '%Y-%m-%d'
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')
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)
45 LogChannel('openttd', "OFTC", "#openttd",
46 LogDirectory(relpath('/home/spbot/irclogs/openttd'), LOG_TIMEZONE, LOG_PARSER, LOG_DECODER, LOG_FILENAME_FMT)
49 LogChannel('test', "TEST", "#test",
50 LogDirectory(relpath('/home/spbot/irclogs/test'), LOG_TIMEZONE, LOG_PARSER, LOG_DECODER, LOG_FILENAME_FMT)
54 # URL to the hgweb installation for this code
55 HGWEB_URL = "http://hg.qmsk.net/qmsk.irclogs"
57 # path to the mercurial working copy
60 # how to handle decode() errors for logfile lines
61 LOG_SOURCE_DECODE_ERRORS = 'replace'
63 # date format for URLs
64 URL_DATE_FMT = '%Y-%m-%d'
69 # timezone name format
70 TIMEZONE_FMT = '%Z %z'
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" )
80 # available formatters
82 'irssi': IrssiFormatter,
83 'debug': DebugFormatter,
87 PREF_COOKIE_PATH = '/'
88 PREF_COOKIE_EXPIRE_SECONDS = 1 * 365 * 24 * 60 * 60 # one year
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
97 PREF_IMAGE_FONT_DEFAULT = 'ttf-dejavu-mono'
98 PREF_IMAGE_FONT_SIZE_DEFAULT = 12
99 PREF_IMAGE_FONT_SIZE_MAX = 32
101 # search line count options
102 SEARCH_LINE_COUNT_OPTIONS = (
107 # infinity, not supported
111 # search index database path
112 SEARCH_INDEX_PATH = '/home/spbot/irclogs/search-index'
113 SEARCH_AUTOINDEX_PATH = '/home/spbot/irclogs/search-autoindex'