-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
131 lines (86 loc) · 4.68 KB
/
main.py
File metadata and controls
131 lines (86 loc) · 4.68 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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
'''
The License:
Asterix-dz is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Asterix-dz is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Asterix-dz. If not, see <http://www.gnu.org/licenses/>.
Q29kZWQgQnkgIk9TZHogRHpheWVyIgpXaXRoIHRoZSBoZWxwIE9mIFJhb3VmCkZhY2Vib29rOiBPU2RldmR6Cg==
'''
from __future__ import division
from aircodes import airline_code
import sys, getopt
import rdbt
import Glob
import Func
# ------------------ MAIN ENTRY ---------------------------------------#
def main(argv):
Hello = """
.oo .oPYo. ooooo .oPYo. .oPYo. o o o ooo. oooooo
.P 8 8 8 8. 8 `8 8 `b d' 8 `8. d'
.P 8 `Yooo. 8 `boo o8YooP' 8 `bd' 8 `8 d'
oPooo8 `8 8 .P 8 `b 8 .PY. ooooo 8 8 d'
.P 8 8 8 8 8 8 8 .P Y. 8 .P d'
.P 8 `YooP' 8 `YooP' 8 8 8 .P Y. 8ooo' dooooo
..:::::..:.....:::..:::.....::..:::......::::..:::::::.....::.......
:Q29kZWQgQnkgIk9TZHogRHpheWVyIgpXaXRoIHRoZSBoZWxwIE9mIFJhb3VmCkZhY2:
::::::::::::Vib29rOiBPU2RldmR6Cg==::::::::::::::::::::::::::::::::::
"""
print(Hello)
i = 1
try:
#print ("Hey" + sys.argv[1])
with open(sys.argv[1], "rb") as rdbt.f:
#index = 0
while(1):
Glob.cat = rdbt.readbyte()
if (Glob.cat == 1 or Glob.cat == 48):
print("\n------------------------------------------------")
print("------------------CAT: %d-----------------------"% Glob.cat)
print("------------------------------------------------")
else:
while ((Glob.cat != 1) and (Glob.cat != 48)):
print("\n\n##########################################")
print Glob .index
print("Don't Support Cat %d" % Glob.cat)
print("Block Data Skipped N= %d" % i)
leng1 = rdbt.readbyte()
leng2 = rdbt.readbyte()
leng = (leng1 << 8) | leng2
print ("+---CAT: %d" % Glob.cat)
print ("len is %d " % leng)
print("##########################################\n\n")
# Just Skip This Category Block
leng = leng - 3 # 3 bytes of CAT and Length
rdbt.f.seek(leng, 1)
Glob.cat = rdbt.readbyte()
Glob.index = Glob.index - 3
i = i + 1
print("------------------------------------------------")
print("------------------CAT: %d-----------------------"% Glob.cat)
print("------------------------------------------------")
Glob.index = Glob.index + 1
length1 = rdbt.readbyte()
length2 = rdbt.readbyte()
BlockData_length = (length1 << 8) | length2
Glob.total_len = Glob.total_len + BlockData_length
print ("+--- Block Len : %d" % BlockData_length)
while (Glob.index < Glob.total_len):
print Glob .index
print("--------------(New Data Record)---------------")
Func.READ_FSPEC()
# Decode CAT48:
if(Glob.cat == 48):
Func.Decode_48()
# Decode CAT001:
elif (Glob.cat == 1):
Func.Decode_01()
except EnvironmentError:
print("<"+sys.argv[1]+">" + " file Does not exist")
if __name__ == "__main__":
main(sys.argv[1:])