channels.py
changeset 50 f13cf27a360b
parent 46 185504387370
child 51 07ca28f3a9f2
equal deleted inserted replaced
49:aaa62c8e5bd5 50:f13cf27a360b
     7 # for relpath
     7 # for relpath
     8 import os.path
     8 import os.path
     9 
     9 
    10 from log_channel import LogChannel
    10 from log_channel import LogChannel
    11 from log_source import LogDirectory
    11 from log_source import LogDirectory
       
    12 from log_parser import IrssiParser
    12 
    13 
    13 relpath = lambda path : os.path.join(os.path.dirname(__file__), path)
    14 relpath = lambda path : os.path.join(os.path.dirname(__file__), path)
    14 
    15 
    15 class ChannelList (object) :
    16 class ChannelList (object) :
    16     """
    17     """
    17         The list of channels, and related methods
    18         The list of channels, and related methods
    18     """
    19     """
       
    20 
       
    21     # timezone to use
       
    22     TIMEZONE = pytz.timezone('Europe/Helsinki')
       
    23 
       
    24     # the parser that we use
       
    25     PARSER = IrssiParser(TIMEZONE, "%H:%M:%S")
    19     
    26     
    20     # the statically defined channel list
    27     # the statically defined channel list
    21     CHANNELS = {
    28     CHANNELS = {
    22         'tycoon':   LogChannel('tycoon', "OFTC", "#tycoon", 
    29         'tycoon':   LogChannel('tycoon', "OFTC", "#tycoon", 
    23             LogDirectory(relpath('logs/tycoon'), pytz.timezone('Europe/Helsinki'))
    30             LogDirectory(relpath('logs/tycoon'), TIMEZONE, PARSER)
    24         ),
    31         ),
    25         'openttd':   LogChannel('openttd', "OFTC", "#openttd", 
    32         'openttd':   LogChannel('openttd', "OFTC", "#openttd", 
    26             LogDirectory(relpath('logs/openttd'), pytz.timezone('Europe/Helsinki'))
    33             LogDirectory(relpath('logs/openttd'), TIMEZONE, PARSER)
    27         ),
    34         ),
    28     }
    35     }
    29 
    36 
    30     def __init__ (self, channels) :
    37     def __init__ (self, channels) :
    31         """
    38         """