ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/Evidox/LoadFilesMissing.py
(Generate patch)

Comparing Python/NinoCode/Active_prgs/Evidox/LoadFilesMissing.py (file contents):
Revision 675 by nino.borges, Thu Mar 26 14:37:00 2020 UTC vs.
Revision 676 by nino.borges, Thu Mar 26 16:23:22 2020 UTC

# Line 33 | Line 33 | def LfpWriteLine(openFileObj, bates, fil
33      openFileObj.write("IM,%s,%s,0,@;%s;%s\n"% (bates, firstPageMark, filePath, docType))
34  
35   if __name__ == '__main__':
36 <    textFilesStartDir = r"\\sas40\sas40\33444\Inbound\2\092779\PNC - Response to Subpoena\PNC Subpoena Response (rec'd 9.27.19)\TEXT"
37 <    imageFilesStartDir = r"\\sas40\sas40\33444\Inbound\2\092779\PNC - Response to Subpoena\PNC Subpoena Response (rec'd 9.27.19)\IMAGES"
38 <    volumeName = "PNC003"
36 >    textFilesStartDir = r"\\sas40\sas40\33444\Inbound\2\092779\PNC - Response to Subpoena\PNC Subpoena Response (rec'd 11.15.19)\VOL0001\TEXT"
37 >    imageFilesStartDir = r"\\sas40\sas40\33444\Inbound\2\092779\PNC - Response to Subpoena\PNC Subpoena Response (rec'd 11.15.19)\VOL0001\IMAGES"
38 >    volumeName = "PNC007"
39  
40      outputDirectory = r"C:\Temp"
41 +    errLog = open(os.path.join(outputDirectory,volumeName+"_XDD"+".ERR"),'w')
42      
43      approvedImageExtensions = ['.TIFF','.JPG','.TIF']
44      textFileMatrix = {}
# Line 61 | Line 62 | if __name__ == '__main__':
62  
63      ## make the dat and populate it with begno, endno, textPath
64      ## make the LFP and populate with paths.
65 <    outputFile = open(os.path.join(outputDirectory,volumeName+".DAT"),'w')
65 >    outputFile = open(os.path.join(outputDirectory,volumeName+"_XDD"+".DAT"),'w')
66      outputFile.write("ProdBegBates|ProdEndBates|TextFilePath\n")
67 <    outputImagesFile = open(os.path.join(outputDirectory,volumeName+".LFP"),'w')
67 >    outputImagesFile = open(os.path.join(outputDirectory,volumeName+"_XDD"+".LFP"),'w')
68      batesList = textFileMatrix.keys()
69      batesList.sort()
70      imageList = imageFileMatrix.keys()
# Line 76 | Line 77 | if __name__ == '__main__':
77              outputFile.write("%s|%s|%s\n"%(batesEnum[0],batesEnum[-2], textFileMatrix[prevBates]))
78              firstImage = True
79              for page in batesEnum[:-1]:
80 < ##                if os.path.splitext(imageFileMatrix[prevBates])[1].upper() == ".JPG":
81 < ##                    docType = "4"
82 < ##                else:
83 < ##                    docType = "2"
84 <                if firstImage:
85 <                    LfpWriteLine(outputImagesFile, page, imageFileMatrix[page], firstPage = True)
86 <                    #outputImagesFile.write("IM,%s,D,0,@;%s;%s\n"% (prevBates, imageFileMatrix[prevBates],docType))
86 <                    firstImage = False
87 <                else:
88 <                    LfpWriteLine(outputImagesFile, page, imageFileMatrix[page], firstPage = False)
89 <                    #outputImagesFile.write("IM,%s,,0,@;%s;%s\n"% (prevBates, imageFileMatrix[prevBates],docType))
80 >                try:
81 >                    imagePath = imageFileMatrix[page]
82 >                except:
83 >                    imagePath = "ERROR FILE NOT FOUND.TIFF"
84 >                    errLog.write("%s Image FILE NOT FOUND.\n"% page)
85 >                LfpWriteLine(outputImagesFile, page, imagePath, firstImage)
86 >                firstImage = False
87                          
88              prevBates = bates
89              
# Line 99 | Line 96 | if __name__ == '__main__':
96      outputFile.close()
97      firstImage = True
98      for page in batesEnum:
99 < ##        if os.path.splitext(imageFileMatrix[prevBates])[1].upper() == ".JPG":
100 < ##            docType = "4"
101 < ##        else:
102 < ##            docType = "2"
103 <        if firstImage:
104 <            LfpWriteLine(outputImagesFile, page, imageFileMatrix[page], firstPage = True)
105 <            #outputImagesFile.write("IM,%s,D,0,@;%s;%s\n"% (bates, imageFileMatrix[bates],docType))
109 <            firstImage = False
110 <        else:
111 <            LfpWriteLine(outputImagesFile, page, imageFileMatrix[page], firstPage = False)
112 <            #outputImagesFile.write("IM,%s,,0,@;%s;%s\n"% (bates, imageFileMatrix[bates],docType))
99 >        try:
100 >            imagePath = imageFileMatrix[page]
101 >        except:
102 >            imagePath = "ERROR FILE NOT FOUND.TIFF"
103 >            errLog.write("%s Image FILE NOT FOUND.\n"% page)
104 >        LfpWriteLine(outputImagesFile, page, imagePath, firstImage)
105 >        firstImage = False
106      outputImagesFile.close()
107  
108    
109  
110      ## run test to see if there are images missing from LFP
111 <    contents = open(os.path.join(outputDirectory,volumeName+".LFP")).readlines()
112 <    errLog = open(os.path.join(outputDirectory,volumeName+".ERR"),'w')
111 >    contents = open(os.path.join(outputDirectory,volumeName+"_XDD"+".LFP")).readlines()
112 >    
113      testImageList = []
114      for line in contents:
115          line = line.replace("\n","")

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)