Fix the issue where was only the one split file in the CSV generator stuff

This commit is contained in:
nzkarit 2018-05-06 19:04:15 +12:00
parent 510e9da267
commit c9cae9130a
3 changed files with 9 additions and 11 deletions

View File

@ -168,15 +168,14 @@ def threadingCSV(csv):
global cfg global cfg
cfg = configparser.ConfigParser() cfg = configparser.ConfigParser()
cfg.read('config.cfg') cfg.read('config.cfg')
arguments = argParser() arguments = argParser()
arguments.csvfile = csv[0] arguments.csvfile = csv['csv']
arguments.outputfilename = csv[1] arguments.outputfilename = csv['out']
global logger global logger
logging.config.fileConfig('logging.cfg') logging.config.fileConfig('logging.cfg')
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
logger.info('Starting ADSB Encoder threadingCSV entry point') logger.info('Starting ADSB Encoder threadingCSV entry point')
logger.debug('Being called with the following CSV file: %s' % (csv[0])) logger.debug('Being called with the following CSV file: %s' % (arguments.csvfile))
logger.debug('The arguments: %s' % (arguments)) logger.debug('The arguments: %s' % (arguments))
data = None data = None
if arguments.csvfile == '': if arguments.csvfile == '':

View File

@ -12,7 +12,7 @@ def writeFile(directory, filename, filenameExtension, data, count):
for row in data: for row in data:
output.writerow([row]) output.writerow([row])
csvfile.close() csvfile.close()
return "['%s', '%s-%s.iq8s'],"%(csvFilename, filename, count) return "{'csv':'%s', 'out':'%s-%s.iq8s'},"%(csvFilename, filename, count)
def main(): def main():
directory = 'generated' directory = 'generated'
@ -23,8 +23,7 @@ def main():
minICAO = 0x0 minICAO = 0x0
maxICAO = 0x3E8 maxICAO = 0x3E8
# If the number of planes is less than the split it doesn't work splitNumber = 1000
splitNumber = 100
try: try:
os.stat(directory) os.stat(directory)
@ -63,7 +62,7 @@ def main():
k += 1 k += 1
j = 0 j = 0
files = files[:-1] files = files[:-1]
script.write('files = (%s)\n' % (files)) script.write('files = [%s]\n' % (files))
script.write('for file in files:\n') script.write('for file in files:\n')
script.write(' t = threading.Thread(target=threadingCSV, args=(file,))\n') script.write(' t = threading.Thread(target=threadingCSV, args=(file,))\n')
script.write(' t.start()\n') script.write(' t.start()\n')

View File

@ -12,7 +12,7 @@ def writeFile(directory, filename, filenameExtension, data, count):
for row in data: for row in data:
output.writerow([row]) output.writerow([row])
csvfile.close() csvfile.close()
return "['%s', '%s-%s.iq8s'],"%(csvFilename, filename, count) return "{'csv':'%s', 'out':'%s-%s.iq8s'},"%(csvFilename, filename, count)
def main(): def main():
directory = 'generated' directory = 'generated'
@ -24,7 +24,7 @@ def main():
minLat = -90 minLat = -90
maxLat = 90 maxLat = 90
# If the number of lat is less than the split it doesn't work # If the number of lat is less than the split it doesn't work
splitNumber = 100 splitNumber = 1000
step = 0.1 step = 0.1
try: try:
@ -64,7 +64,7 @@ def main():
k += 1 k += 1
j = 0 j = 0
files = files[:-1] files = files[:-1]
script.write('files = (%s)\n' % (files)) script.write('files = [%s]\n' % (files))
script.write('for file in files:\n') script.write('for file in files:\n')
script.write(' t = threading.Thread(target=threadingCSV, args=(file,))\n') script.write(' t = threading.Thread(target=threadingCSV, args=(file,))\n')
script.write(' t.start()\n') script.write(' t.start()\n')