#!/usr/bin/python3 import argparse # import random # import time import sys # import filing from brore import Brore # from emailer import Emailer # from empro import Empro # from kapro import Kapro # from profile import Profile desc = 'broacast to readers' parser = argparse.ArgumentParser(description=desc) parser.add_argument('-a', action='store_true', help='all reports') parser.add_argument('-b', action='store_true', help='build library only') parser.add_argument('-v', action='store_true', help='do verbose') parser.add_argument('-n', action='store_true', help='no send') parser.add_argument('-m', type=int, help='max mails') parser.add_argument('-r', help='repcode') parser.add_argument('-s', type=int, help='sleep between mails') parser.add_argument('empro', type=str, help='empro') args = parser.parse_args() #kapro = Kapro(do_verbose=args.v) #profile = Profile(do_verbose=args.v) #emailer = Emailer(do_verbose=args.v) empro = args.empro brore = Brore() do_sleep = 0 if args.s is not None: do_sleep = int(args.s) do_max_mails = 0 if args.m is not None: do_max_mails = int(args.m) if args.r is None: if not args.a: print("I need a report if you don't say -a") quit() brore.to_all(args.empro, do_sleep=args.s, do_max_mails=do_max_mails) quit() repcode = args.r if repcode is None: print("I need a report.") sys.exit(0) print(repcode) brore.to_report(empro, repcode, do_sleep=args.s, do_max_mails=do_max_mails) ## # better to this first #if(args.b): # # # update the file library # kapro.build_lib() # quit() # ## # use profile file library, rather than kapro #lib = kapro.load_lib() #random.shuffle(lib) #count_mails = 0 #max_mails = args.m #count_sleep = args.s #for fufi in lib: # if max_mails is not None and count_mails >= max_mails: # quit() # count_mails += 1 # base = empro + '/' + profile.base_from_fufi(fufi) # maix = filing.parse_lax(fufi) # out = emailer.prepare(maix, base=base, empro='start_nitpo', # dont_send=args.n) # if out is not None and count_sleep is not None: # time.sleep(count_sleep) #