def initial_check(args, accession_digits, oe_list, reference_number): ''' Tells the user which packages will be accessioned and what their accession numbers will be. ''' to_accession = {} wont_accession = [] # accession = 'af' + str(accession_digits) ref = reference_number reference_digits = int(ref[2:]) # so just reverse this - loop through the csv first. # this will break the non CSV usage of batchaccession for now. for thingies in oe_list: for root, _, _ in sorted(os.walk(args.input)): if os.path.basename(root)[:2] == 'oe' and len( os.path.basename(root)[2:]) >= 4: if copyit.check_for_sip(root) is None: wont_accession.append(root) else: # this is just batchaccessioning if no csv is supplied # this is pretty pointless at the moment seeing as this is loopline through oe_list :( if not oe_list: to_accession[root] = 'aaa' + str( accession_digits).zfill(4) accession_digits += 1 else: # gets parent info if os.path.basename(root) == thingies: to_accession[os.path.join( os.path.dirname(root), order.main(root))] = [ 'aaa' + str(accession_digits).zfill(4), ref[:2] + str(reference_digits).zfill(4) ] if root in to_accession: # If a single file is found, this prevents the file being # processed twice, with a skip in the number run reference_digits += 1 accession_digits += 1 continue accession_digits += 1 # gets reproduction info to_accession[root] = [ 'aaa' + str(accession_digits).zfill(4), ref[:2] + str(reference_digits), 'reproduction' ] reference_digits += 1 accession_digits += 1 for fails in wont_accession: print( '%s looks like it is not a fully formed SIP. Perhaps loopline_repackage.py should proccess it?' % fails) for success in sorted(to_accession.keys()): print('%s will be accessioned as %s' % (success, to_accession[success])) return to_accession
def initial_check(args, accession_digits, oe_list, reference_number): ''' Tells the user which packages will be accessioned and what their accession numbers will be. ''' to_accession = {} wont_accession = [] # accession = 'af' + str(accession_digits) ref = reference_number reference_digits = int(ref[2:]) for root, _, _ in sorted(os.walk(args.input)): if os.path.basename(root)[:2] == 'oe' and len( os.path.basename(root)[2:]) == 4: if copyit.check_for_sip(root) is None: wont_accession.append(root) else: # this is just batchaccessioning if no csv is supplied if not oe_list: to_accession[root] = 'aaa' + str(accession_digits).zfill(4) accession_digits += 1 else: if os.path.basename(root) in oe_list: to_accession[os.path.join( os.path.dirname(root), order.main(root))] = [ 'aaa' + str(accession_digits).zfill(4), ref[:2] + str(reference_digits).zfill(4) ] if root in to_accession: # If a single file is found, this prevents the file being # processed twice, with a skip in the number run reference_digits += 1 accession_digits += 1 continue accession_digits += 1 to_accession[root] = [ 'aaa' + str(accession_digits).zfill(4), ref[:2] + str(reference_digits) ] reference_digits += 1 accession_digits += 1 for fails in wont_accession: print '%s looks like it is not a fully formed SIP. Perhaps loopline_repackage.py should proccess it?' % fails for success in sorted(to_accession.keys()): print '%s will be accessioned as %s' % (success, to_accession[success]) return to_accession
def initial_check(args, accession_digits): ''' Tells the user which packages will be accessioned and what their accession numbers will be. ''' to_accession = {} wont_accession = [] for root, _, _ in os.walk(args.input): if os.path.basename(root)[:2] == 'oe': if len(os.path.basename(root)[2:]) == 4: if copyit.check_for_sip(root) is None: wont_accession.append(root) #print '%s looks like it is not a fully formed SIP. Perhaps loopline_repackage.py should proccess it?' % root else: to_accession[root] = 'aaa' + str(accession_digits) accession_digits += 1 for fails in wont_accession: print '%s looks like it is not a fully formed SIP. Perhaps loopline_repackage.py should proccess it?' % fails for success in sorted(to_accession.keys()): print '%s will be accessioned as %s' % (success, to_accession[success]) return to_accession