-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunc_yfs_header_extract.py
38 lines (29 loc) · 1.01 KB
/
func_yfs_header_extract.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
#!/usr/bin/env python
__version__ = "20210129"
__author__ = "Decaff_42"
__copyright__ = "2021 by Decaff_42"
__license__ = """Only non-commercial use with attribution is allowed without prior written permission from Decaff_42."""
"""
VERSION HISTORY:
20181127 - Original Code
20210129 - Re-formatting IAW PEPs.
"""
def break_line():
print("----------------------------------------------------")
def extract_yfs_header(data):
"""Extract key information from the YFS header"""
ysf_version = ""
scenery_name = ""
event_block_start_line = 0
for ind, line in enumerate(data):
if line.startswith("YFSVERSI"):
ysf_version = line.split(" ")[-1]
elif line.startswith("FIELDNAM"):
scenery_name = line.split(" ")[1]
elif line.startswith("EVTBLOCK"):
event_block_start_line = ind
break
print("YSF Version: {}".format(ysf_version))
print("Map: {}".format(scenery_name))
break_line()
return ysf_version, scenery_name