示例#1
0
def main():
    args = docopt.docopt(__doc__)

    atxutils.logging_setup('DEBUG')

    if args['--till']:
        till = arrow.get(args['--till']).timestamp
    else:
        till = arrow.now().timestamp

    if args['--since'].startswith('-'):
        if args['--since'].endswith('d'):
            since = till - int(args['--since'][1:-1]) * 3600 * 24
        else:
            since = till - int(args['--since'][1:])
    else:
        since = arrow.get(args['--since']).timestamp

    assert (since <= till)

    logging.info('since: %s, till: %s' % (since, till))

    if args['--incoming']:
        path_incoming = args['--incoming']
    else:
        logging.info('--incoming not specified, defaulting to /home/incoming')
        path_incoming = '/home/incoming'

    mjs = args['<mj>']

    res = process_many(mjs, since, till, path_incoming)
    import pprint
    pprint.pprint(res)
示例#2
0
def main():
	args = docopt.docopt(__doc__)

	atxutils.logging_setup('DEBUG')

	if args['--till']:
		till = arrow.get(args['--till']).replace(tzinfo='Europe/Prague').timestamp
	else:
		till = None

	if args['--since']:
		if args['--since'].startswith('-'):
			if args['--since'].endswith('d'):
				since = till - int(args['--since'][1:-1]) * 3600 * 24
			else:
				since = till - int(args['--since'][1:])
		else:
			since = arrow.get(args['--since']).replace(tzinfo='Europe/Prague').timestamp
	else:
		since = None

	threshold = 0.040  # TODO: hard-coded shit

	logging.info('since: %s, till: %s, threshold: %s' % (since, till, threshold))

	if args['--incoming']:
		path_incoming = args['--incoming']
	else:
		logging.info('--incoming not specified, defaulting to /home/incoming')
		path_incoming = '/home/incoming'

	mjs = args['<mj>']

	res = process_many(mjs, since, till, path_incoming, threshold)
	pprint.pprint(res)
示例#3
0
def main():
	atxutils.logging_setup('DEBUG')
	state = {
		'state': 'form',
		'since_value': arrow.get().format('YYYY-MM-DD'),
	}
	thr_web = threading.Thread(target=start, args=(state, ))
	thr_web.start()