| 1 |
ninoborges |
8 |
"""
|
| 2 |
|
|
XFD_ProdAttRangeMaker.py
|
| 3 |
|
|
|
| 4 |
|
|
This program will create production attach ranges from and XFD and a corcordance export
|
| 5 |
|
|
|
| 6 |
|
|
Created by
|
| 7 |
|
|
Emanuel Borges
|
| 8 |
|
|
|
| 9 |
|
|
09.08.2007
|
| 10 |
|
|
|
| 11 |
|
|
"""
|
| 12 |
|
|
|
| 13 |
|
|
from FixBatesRange_func import SeperateAlpha
|
| 14 |
|
|
|
| 15 |
|
|
|
| 16 |
|
|
|
| 17 |
|
|
if __name__ == '__main__':
|
| 18 |
|
|
contents2 = open(r"\\Ercdis12\admin\Share\Manny\WIP\30217261\L_Henegar\db_Export.txt").readlines()
|
| 19 |
|
|
contents1 = open(r"\\ercdis12\h\C_D\30217261\Productions\20070904Henegar\test2\30217261_L_HENEGAR_EMAILREVIEW.XFD").readlines()
|
| 20 |
|
|
outputFile = open(r"c:\test_dir\henegarOut.txt",'w')
|
| 21 |
|
|
prodMatrix = {}
|
| 22 |
|
|
orrigMatrix = {}
|
| 23 |
|
|
for i in contents1:
|
| 24 |
|
|
i = i.replace("\n","")
|
| 25 |
|
|
begBates, endBates, prodBeg, prodEnd = i.split(",")
|
| 26 |
|
|
prodMatrix[begBates] = [endBates, prodBeg, prodEnd]
|
| 27 |
|
|
|
| 28 |
|
|
print len(prodMatrix.keys())
|
| 29 |
|
|
|
| 30 |
|
|
for i in contents:
|
| 31 |
|
|
i = i.replace("\n","")
|
| 32 |
|
|
begBates, endBates, attBeg, attEnd = i.split(",")
|
| 33 |
|
|
orrigMatrix[begBates] = [endBates, attBeg, attEnd]
|
| 34 |
|
|
|
| 35 |
|
|
print len(orrigMatrix.keys())
|
| 36 |
|
|
|
| 37 |
|
|
prodLst = prodMatrix.keys()
|
| 38 |
|
|
prodLst.sort()
|
| 39 |
|
|
for k in prodLst:
|
| 40 |
|
|
prodBegNo = prodMatrix[k][1]
|
| 41 |
|
|
prodEndNo = prodMatrix[k][2]
|
| 42 |
|
|
oldAttBeg = orrigMatrix[k][1]
|
| 43 |
|
|
oldAttEnd = orrigMatrix[k][2]
|
| 44 |
|
|
attLst = []
|
| 45 |
|
|
attAlpha, attStrtInt = SeperateAlpha(oldAttBeg)
|
| 46 |
|
|
attEndInt = SeperateAlpha(oldAttEnd)[1]
|
| 47 |
|
|
for i in range(attStrtInt,attEndInt):
|
| 48 |
|
|
try:
|
| 49 |
|
|
attLst.append(prodMatrix[attAlpha+str(i)][1])
|
| 50 |
|
|
attLst.append(prodMatrix[attAlpha+str(i)][2])
|
| 51 |
|
|
except:
|
| 52 |
|
|
pass
|
| 53 |
|
|
outputFile.write(prodBegNo + "," + prodEndNo + "," +attLst[0] +"," + attLst[-1] +"\n") |