-
Notifications
You must be signed in to change notification settings - Fork 0
/
automate.py
85 lines (76 loc) · 2.7 KB
/
automate.py
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import subprocess
import sys
import pathlib
if len(sys.argv) != 3 :
print('Usage is automate.py APP_DIR DATA_DIR')
quit(0)
# Get the App Location
apps: str = sys.argv[1]
# Get the Root Location for Data Storage
data_loc: str = sys.argv[2]
# Create the Given Folder if it does not exist
pathlib.Path(data_loc).mkdir(parents=True, exist_ok=True)
# First Run PDFDownloader
def RunCSharpProjectWithDotNetRun(project_path: str):
# Pass Required Arguments to DotNet
completed = subprocess.run([
'dotnet','run', # Name of App with Command
'--configuration', 'Debug', #Start in Release Configuration
'--project', # Specify That We are to Run project
project_path, # Specify Project Path
data_loc # Specify Command Line Path where to Perform Action
], shell=True # Ensure it can access current CMD path
)
return completed
def RunPythonScript(script_path: str):
# Pass Required Argument to Python
completed = subprocess.run([
'python',
script_path, # Specify Project Path
data_loc # Specify Command Line Path where to Perform Action
], shell=True # Ensure it can access current CMD path
)
return completed
# Download All PDFs
def PDFDownloader():
project_path: str = apps + '/' + 'PdfDownloader/PdfDownloader/PdfDownloader.csproj '
return RunCSharpProjectWithDotNetRun(project_path)
# Download All PDFs
def ICAOCodeParser():
project_path: str = apps + '/' + 'ICAOCodeParser/ICAOCodeParser/ICAOCodeParser.csproj '
return RunCSharpProjectWithDotNetRun(project_path)
# Convert PDF to CSV
def PdfToCSVParser():
project_path: str = apps + '/' + 'PdfToCSVParser/PdfToCSVParser/PdfToCSVParser.csproj'
return RunCSharpProjectWithDotNetRun(project_path)
# Convert CSV To KML2D
def CSVToKML2D():
script_path: str = apps + '/' + 'csv_kml_2d.py'
return RunPythonScript(script_path)
# Convert CSV To KMZ
def CSVToKMZ():
script_path: str = apps + '/' + 'csv_kmz.py'
return RunPythonScript(script_path)
def GenerateNetworkLink():
script_path: str = apps + '/' + 'network_link.py'
return RunPythonScript(script_path)
def ICAOCSVToDb():
script_path: str = apps + '/' + 'icaocsv2db.py'
return RunPythonScript(script_path)
def ObstacleCSVToDb():
script_path: str = apps + '/' + 'obstaclecsvtodb.py'
return RunPythonScript(script_path)
# Push to Git
def PushToGit():
script_path: str = apps + '/' + 'gitscript.py'
return RunPythonScript(script_path)
# Run the Given Functions
ICAOCodeParser()
PDFDownloader()
PdfToCSVParser()
CSVToKML2D()
CSVToKMZ()
GenerateNetworkLink()
ICAOCSVToDb()
ObstacleCSVToDb()
#PushToGit()