# Path: chirp/common/timestamp.py
# _TIMESTAMP_FORMAT = "%Y%m%d-%H%M%S"
# _PRETTY_FORMAT = "%c"
# PROCESS_START_TIME = time.time()  # time of importing this file
# _MIN_REASONABLE_TIMESTAMP = parse_human_readable("20081130-000000")
# _MAX_REASONABLE_TIMESTAMP = parse_human_readable("20380119-000000")
# _SECONDS_PER_MINUTE = 60
# _SECONDS_PER_HOUR = 60 * _SECONDS_PER_MINUTE
# _SECONDS_PER_DAY = 24 * _SECONDS_PER_HOUR
# def now():
# def now_ms():
# def process_start_time_ms():
# def process_age_ms():
# def get_human_readable(ts=None):
# def get_human_readable_ms(ms_ts):
# def get_pretty(ts=None):
# def get_pretty_ms(ms_ts):
# def parse_human_readable(human_readable_str):
# def is_valid(ts):
# def get_human_readable_duration(duration_s):
#     def _pluralize(n, unit):
# def get_human_readable_duration_ms(duration_ms):
# 
# Path: chirp/stream/message.py
# CONNECTED = "Connected"        # New connection initiated.
# RESPONSE = "Response"          # HTTP response received.
# BLOCK = "Block"                # A chunk of raw data.
# FRAME = "Frame"                # An MP3 frame.
# ERROR = "Error"                # An error.
# CONNECT_TIMEOUT_ERROR = "Connect Timeout Error"
# CONNECT_ERROR = "Connect Error"
# REQUEST_ERROR = "Request Error"
# READ_TIMEOUT_ERROR = "Read Timeout Error"
# READ_ERROR = "Read Error"
# MISSING_HEADERS_ERROR = "Missing HTTP Headers Error"
# MALFORMED_HEADERS_ERROR = "Malformed HTTP Headers Error"
# BAD_REDIRECT_ERROR = "Bad Redirect Error"
# END_OF_STREAM_ERROR = "End of Stream Error"
# class Message(object):
# class MessageSource(object):
# class MessageConsumer(looper.Looper):
# class MessageTee(MessageConsumer):
#     def payload_sha1(self):
#     def payload_hex_sha1(self):
#     def __str__(self):
#     def set_error(self, error_type, err):
#     def is_error(self):
#     def is_end_of_stream(self):
#     def __init__(self):
#     def _add_message(self, msg):
#     def _add_stop_message(self):
#     def get_next_message(self, timeout=None):
#     def get_all_messages(self):
#     def wait_until_empty(self):
#     def __init__(self, src):
#     def _process_message(self, msg):
#     def _loop_once(self):
#     def __init__(self, input_src, num_outputs):
#     def _process_message(self, msg):


from chirp.common import timestamp
from chirp.stream import message


class Logger(message.MessageConsumer):

    def __init__(self, src):
        message.MessageConsumer.__init__(self, src)
        self._fh = open("/tmp/barix.log", "w", 0)  # Unbuffered

    def _process_message(self, msg):
        info = [msg.message_type]
        if msg.message_type == message.FRAME:
            info.append(str(msg.mp3_header))
        output = "%s: %s\n" % (

# Path: chirp/common/timestamp.py
# _TIMESTAMP_FORMAT = "%Y%m%d-%H%M%S"
# _PRETTY_FORMAT = "%c"
# PROCESS_START_TIME = time.time()  # time of importing this file
# _MIN_REASONABLE_TIMESTAMP = parse_human_readable("20081130-000000")
# _MAX_REASONABLE_TIMESTAMP = parse_human_readable("20380119-000000")
# _SECONDS_PER_MINUTE = 60
# _SECONDS_PER_HOUR = 60 * _SECONDS_PER_MINUTE
# _SECONDS_PER_DAY = 24 * _SECONDS_PER_HOUR
# def now():
# def now_ms():
# def process_start_time_ms():
# def process_age_ms():
# def get_human_readable(ts=None):
# def get_human_readable_ms(ms_ts):
# def get_pretty(ts=None):
# def get_pretty_ms(ms_ts):
# def parse_human_readable(human_readable_str):
# def is_valid(ts):
# def get_human_readable_duration(duration_s):
#     def _pluralize(n, unit):
# def get_human_readable_duration_ms(duration_ms):
# 
# Path: chirp/stream/message.py
# CONNECTED = "Connected"        # New connection initiated.
# RESPONSE = "Response"          # HTTP response received.
# BLOCK = "Block"                # A chunk of raw data.
# FRAME = "Frame"                # An MP3 frame.
# ERROR = "Error"                # An error.
# CONNECT_TIMEOUT_ERROR = "Connect Timeout Error"
# CONNECT_ERROR = "Connect Error"
# REQUEST_ERROR = "Request Error"
# READ_TIMEOUT_ERROR = "Read Timeout Error"
# READ_ERROR = "Read Error"
# MISSING_HEADERS_ERROR = "Missing HTTP Headers Error"
# MALFORMED_HEADERS_ERROR = "Malformed HTTP Headers Error"
# BAD_REDIRECT_ERROR = "Bad Redirect Error"
# END_OF_STREAM_ERROR = "End of Stream Error"
# class Message(object):
# class MessageSource(object):
# class MessageConsumer(looper.Looper):
# class MessageTee(MessageConsumer):
#     def payload_sha1(self):
#     def payload_hex_sha1(self):
#     def __str__(self):
#     def set_error(self, error_type, err):
#     def is_error(self):
#     def is_end_of_stream(self):
#     def __init__(self):
#     def _add_message(self, msg):
#     def _add_stop_message(self):
#     def get_next_message(self, timeout=None):
#     def get_all_messages(self):
#     def wait_until_empty(self):
#     def __init__(self, src):
#     def _process_message(self, msg):
#     def _loop_once(self):
#     def __init__(self, input_src, num_outputs):
#     def _process_message(self, msg):


# Path: chirp/stream/logger.py
from chirp.common import timestamp
from chirp.stream import message



class Logger(message.MessageConsumer):

    def __init__(self, src):
        message.MessageConsumer.__init__(self, src)
        self._fh = open("/tmp/barix.log", "w", 0)  # Unbuffered

    def _process_message(self, msg):
        info = [msg.message_type]
        if msg.message_type == message.FRAME:
            info.append(str(msg.mp3_header))
        output = "%s: %s\n" % (

            timestamp.get_human_readable_ms(timestamp.now_ms()),