def main(argv):
    generic_logging.init(level=logging.WARN)
    global logger
    logger = logging.getLogger()

    config = json.loads(open("config").read())

    battor_logfile_path = config["parse"]["file_path"]
    sample_rate = get_sample_rate(battor_logfile_path)
    down_sample = config["parse"]["down_sample"]

    loglines = parse(**config)
    start_edge = find_start_edge(loglines, sample_rate, down_sample, **config["edge"])

    logcat_lines = logcat_generator(**config["logcat"])
    logcat_time_offset, battor_first_edge_timestamp = get_edge_timestamps(loglines, start_edge, logcat_lines)

    h = Handover(config["handover"]["dir"], logcat_time_offset)
Exemple #2
0
import os,sys,argparse
import logging
import multiprocessing

# Just so I don't piss off people with an additional setup step :)
try:
	import pycommons
except:
	# No pycommons. Fetch it
	import subprocess
	subprocess.check_call('git clone https://github.com/gurupras/pycommons', shell=True)
	import pycommons


from pycommons import generic_logging
generic_logging.init(level=logging.DEBUG)
logger = logging.getLogger(__file__)

from pycommons.file_entry import FileEntry

def setup_parser(parser=None):
	if parser is None:
		parser = argparse.ArgumentParser(description='Process audio file')
	parser.add_argument('source', help='The file or directory to process')
	parser.add_argument('--dump', action='store_true', help='Dump intermediate format')
	parser.add_argument('--plot', action='store_true', default=False, help='Plot')
	return parser

def common_process(dump_callback, print_callback, regex):
	parser = setup_parser()
	args = parser.parse_args()
import os,sys,argparse
import json
import itertools
import datetime

import logging
import pycommons.pycommons as pycommons
from pycommons import generic_logging
generic_logging.init(level=logging.INFO)
logger = logging.getLogger('post_processing')

import device1, device2, server, handover

def get_files(config):
	battor_files = []
	dev1_files = []
	dev2_files = []
	server_files = []
	handover_files = []

	base_dir = config['base']

	lists = [battor_files, dev1_files, dev2_files, server_files, handover_files]
	list_labels = ['battor', 'device1', 'device2', 'server', 'handover']
	for opt, opt_list in itertools.izip(list_labels, lists):
		config_opt = config[opt]
		opt_dir = os.path.join(base_dir, config_opt['dir'])
		opt_prefix = config_opt['prefix']
		opt_suffix = config_opt['suffix']

		for date in config['dates']:
Exemple #4
0
import time
import signal
import struct
import socket
import subprocess
import traceback

import threading
import multiprocessing

import logging
try:
	import pycommons
	from pycommons import generic_logging
	if __name__ == '__main__':
		generic_logging.init(level=logging.DEBUG)
except:
	print 'No pycommons..continuing anyway'
	logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__file__)

import common
import protocol_pb2

def setup_parser():
	parser = argparse.ArgumentParser()

	parser.add_argument('--host', '-H', type=str, required=True,
			help='Host to connect to')
	parser.add_argument('--port', '-p', type=int, default=15225,
			help='Port on which host is running server')