forked from TallChris91/PASS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPASS.py
More file actions
50 lines (41 loc) · 1.81 KB
/
PASS.py
File metadata and controls
50 lines (41 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from Governing_module import TopicWalk
import re
import os
import sys
import pickle
from Info_dict_module import InfoDict
def main(file, savestate='n'):
templatetexthome, templatetextaway, templatetextneutral, templatedict = TopicWalk(file)
infodict = InfoDict(file)
print(templatetexthome)
print(templatetextaway)
print(templatetextneutral)
print(templatedict)
print(infodict)
if savestate == 'y':
newfile = os.path.splitext(os.path.basename(file))[0]
newfile = re.sub(r'goal', '', newfile)
with open('./SavedReports/' + newfile + 'home.txt', 'wb') as f:
print(newfile + 'home.txt saved')
f.write(bytes(templatetexthome, 'UTF-8'))
with open('./SavedReports/' + newfile + 'away.txt', 'wb') as f:
print(newfile + 'away.txt saved')
f.write(bytes(templatetextaway, 'UTF-8'))
with open('./SavedReports/' + newfile + 'neutral.txt', 'wb') as f:
print(newfile + 'neutral.txt saved')
f.write(bytes(templatetextneutral, 'UTF-8'))
with open('./SavedReports/' + newfile + 'matchdict.p', 'wb') as f:
print(newfile + 'matchdict.p saved')
pickle.dump(templatedict, f)
with open('./SavedReports/' + newfile + 'infodict.p', 'wb') as f:
print(newfile + 'infodict.p saved')
pickle.dump(infodict, f)
currentpath = os.getcwd()
#textpath = os.path.dirname(currentpath) + '/Europa_League/TestInfoXMLs'
#onlyfiles = [textpath + '/' + f for f in os.listdir(textpath) if os.path.isfile(os.path.join(textpath, f))]
#for file in onlyfiles:
#main(file, 'y')
#main(os.path.dirname(currentpath) + '/Europa_League/NewInfoXMLs/rea_aja_5032019.xml', 'y')
main(currentpath + '/NewInfoXMLs/hhc_bd_2032019.xml', 'y')
#if __name__ == '__main__':
#main(sys.argv[1:])