parser.add_argument('-i','--icao',action='store',type=auto_int,dest='icao',default=cfg.get('plane','icao'),help='The ICAO number for the plane in hex. Ensure the ICAO is prefixed with \'0x\' to ensure this is parsed as a hex number. This is 24 bits long. Default: %(default)s')
parser.add_argument('--csv','--csvfile','--in','--input',action='store',type=str,dest='csvfile',help='The name of the FR24 CSV file',required=True)
returnparser.parse_args()
defreverseCSV(csvfile):
"""Reverse a CSV. Returns a dictionary of the CSV"""
data=[]
withopen(csvfile,newline='')ascsvfilein:
reader=csv.DictReader(csvfilein,delimiter=',')
forrowinreader:
data.append(row)
csvfilein.close()
returnreversed(data)
defmain():
globalcfg
cfg=configparser.ConfigParser()
cfg.read('config.cfg')
arguments=argParser()
csvFilename='fr24.csv'
time=0
#Need to reverse the FR24 CSV as it is in reverse order i.e. the most recent record is row 2 and the first ADS-B message of the flight is the last row in the CSV