# Path: masscopy.py
# def analyze_log(logfile):
#     '''
#     Analyzes logfiles on the desktop and summarises the outcome.
#     '''
#     outcome = ''
#     with open(logfile, 'r') as fo:
#         log_lines = fo.readlines()
#         for line in log_lines:
#             if 'EVENT = File Transfer Judgement - Success' in line:
#                 outcome = 'success'
#             if 'EVENT = File Transfer Outcome - Failure' in line:
#                 outcome = 'failure'
#             if 'EVENT = Existing source manifest check - Failure' in line:
#                 outcome = 'failure - might be outdated manifests in use'
#         return outcome


import argparse
import os
import sys
import ififuncs
import sipcreator
from masscopy import analyze_log
        print('Exiting as you selected -dryrun')
        sys.exit()
    logs = []
    if args.y:
        proceed = 'Y'
    else:
        proceed = ififuncs.ask_yes_no(
            'Do you want to proceed?'
        )
    if proceed == 'Y':
        for sips in sorted(oe_dict):
            print(oe_dict[sips])
            sipcreator_cmd = ['-i',]
            for sipcreator_inputs in oe_dict[sips][0]:
                sipcreator_cmd.append(sipcreator_inputs)
            sipcreator_cmd += ['-supplement']
            for sipcreator_supplements in oe_dict[sips][1]:
                sipcreator_cmd.append(sipcreator_supplements)
            sipcreator_cmd += ['-user', user, '-oe', sips, '-o', args.o]
            if args.rename_uuid:
                sipcreator_cmd.append('-rename_uuid')
            if args.zip:
                sipcreator_cmd.append('-zip')
            if args.l:
                sipcreator_cmd.append('-l')
            print(sipcreator_cmd)
            sipcreator_log, _ = sipcreator.main(sipcreator_cmd)
            logs.append(sipcreator_log)
            for i in logs:
                if os.path.isfile(i):

# Path: masscopy.py
# def analyze_log(logfile):
#     '''
#     Analyzes logfiles on the desktop and summarises the outcome.
#     '''
#     outcome = ''
#     with open(logfile, 'r') as fo:
#         log_lines = fo.readlines()
#         for line in log_lines:
#             if 'EVENT = File Transfer Judgement - Success' in line:
#                 outcome = 'success'
#             if 'EVENT = File Transfer Outcome - Failure' in line:
#                 outcome = 'failure'
#             if 'EVENT = Existing source manifest check - Failure' in line:
#                 outcome = 'failure - might be outdated manifests in use'
#         return outcome


# Path: batchsipcreator.py
import argparse
import os
import sys
import ififuncs
import sipcreator
from masscopy import analyze_log

        print('Exiting as you selected -dryrun')
        sys.exit()
    logs = []
    if args.y:
        proceed = 'Y'
    else:
        proceed = ififuncs.ask_yes_no(
            'Do you want to proceed?'
        )
    if proceed == 'Y':
        for sips in sorted(oe_dict):
            print(oe_dict[sips])
            sipcreator_cmd = ['-i',]
            for sipcreator_inputs in oe_dict[sips][0]:
                sipcreator_cmd.append(sipcreator_inputs)
            sipcreator_cmd += ['-supplement']
            for sipcreator_supplements in oe_dict[sips][1]:
                sipcreator_cmd.append(sipcreator_supplements)
            sipcreator_cmd += ['-user', user, '-oe', sips, '-o', args.o]
            if args.rename_uuid:
                sipcreator_cmd.append('-rename_uuid')
            if args.zip:
                sipcreator_cmd.append('-zip')
            if args.l:
                sipcreator_cmd.append('-l')
            print(sipcreator_cmd)
            sipcreator_log, _ = sipcreator.main(sipcreator_cmd)
            logs.append(sipcreator_log)
            for i in logs:
                if os.path.isfile(i):

                    print(("%-*s   : copyit job was a %s" % (50, os.path.basename(i), analyze_log(i))))