Add fallback where CRS is unable to be obtained

This commit is contained in:
Fred Boniface 2024-10-03 11:50:03 +01:00
parent 452ce699ee
commit 87cbd484ce
4 changed files with 15 additions and 10 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
env_conf env_conf
include include
*.docx *.docx
*.pdf
git git
run.sh run.sh

View File

@ -1,5 +1,5 @@
home = /usr/bin home = /usr/bin
include-system-site-packages = false include-system-site-packages = false
version = 3.11.8 version = 3.12.3
executable = /usr/bin/python3.11 executable = /usr/bin/python3.12
command = /usr/bin/python -m venv /home/fred.boniface/Desktop/diagrams-to-parse/diagram-parser command = /usr/bin/python -m venv /home/fred.boniface/Desktop/diagrams-to-parse/diagram-parser

View File

@ -6,9 +6,6 @@ def start():
if not owlboard_connector.check_connection(): if not owlboard_connector.check_connection():
print("Exiting") print("Exiting")
sys.exit(1) sys.exit(1)
#if not gitea_connector.check_connection():
# print("Exiting")
# sys.exit(1)
working_directory = os.getcwd() working_directory = os.getcwd()
print("Working directory: ", working_directory) print("Working directory: ", working_directory)
@ -36,7 +33,7 @@ def start():
get_detail.append({ get_detail.append({
'pis': code['pis'], 'pis': code['pis'],
'services': services, 'services': services,
'diagram_file': code['file'], 'diagram_file': code['source_file'],
'date': code['date'], 'date': code['date'],
'headcode': code['headcode'], 'headcode': code['headcode'],
}) })
@ -58,6 +55,10 @@ def start():
formatted_additions = formatter.humanYaml(details) formatted_additions = formatter.humanYaml(details)
print(formatted_additions) print(formatted_additions)
out = open("pis_output", "a")
f.write('\n---\n')
f.write(formatted_additions)
f.close()
gitea_connector.clone_repository() gitea_connector.clone_repository()
gitea_connector.commit_and_push_changes(formatted_additions,"From owlbot diagram-parser") gitea_connector.commit_and_push_changes(formatted_additions,"From owlbot diagram-parser")

View File

@ -62,8 +62,9 @@ def get_service_detail(trainUid, date):
'vstp': json_res.get('vstp', False) 'vstp': json_res.get('vstp', False)
} }
organised = organise_svc(svc_detail) organised = organise_svc(svc_detail)
print(res.text) #print(res.text)
print(organised) #print(organised)
print("Service Details Found")
return organised return organised
else: else:
print("Service Not Found") print("Service Not Found")
@ -95,3 +96,5 @@ def convert_tiploc_to_crs(tiploc):
if json_res: if json_res:
crs = json_res[0]['3ALPHA'] crs = json_res[0]['3ALPHA']
return crs.lower() return crs.lower()
else:
return "NO_CRS"