Merge pull request #2 from nzkarit/files

Files
This commit is contained in:
nzkarit 2018-04-22 10:13:27 +12:00 committed by GitHub
commit 85b128471d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -126,18 +126,19 @@ def manyPlanes(arguments):
return samples
def writeOutputFile(filename, data):
logger.info('Writing tmp.iq8s file')
SamplesFile = open('tmp.iq8s', 'wb')
tmpfile = '%s.tmp'%(filename)
logger.info('Writing %s file'%(tmpfile))
SamplesFile = open(tmpfile, 'wb')
SamplesFile.write(data)
SamplesFile.close()
os.system('sync')
os.system('rm %s' % (filename))
logger.info('dd for file: %s' % (filename))
os.system("dd if=tmp.iq8s of=%s bs=4k seek=63 > /dev/null 2>&1" % (filename))
os.system("dd if=%s of=%s bs=4k seek=63 > /dev/null 2>&1" % (tmpfile, filename))
os.system('sync')
os.system('rm tmp.iq8s')
os.system('rm %s'%(tmpfile))
if __name__ == "__main__":
def main():
global cfg
cfg = configparser.ConfigParser()
cfg.read('config.cfg')
@ -157,5 +158,30 @@ if __name__ == "__main__":
writeOutputFile(arguments.outputfilename, data)
logger.info('Complete')
def threadingCSV(csv):
global cfg
cfg = configparser.ConfigParser()
cfg.read('config.cfg')
arguments = argParser()
arguments.csvfile = csv[0]
arguments.outputfilename = csv[1]
global logger
logging.config.fileConfig('logging.cfg')
logger = logging.getLogger(__name__)
logger.info('Starting ADSB Encoder')
logger.debug('The arguments: %s' % (arguments))
data = None
if arguments.csvfile == '':
data = singlePlane(arguments)
else:
data = manyPlanes(arguments)
writeOutputFile(arguments.outputfilename, data)
logger.info('Complete')
if __name__ == "__main__":
main()