'''
Created on 1 dic 2019

@author: Emanuele Trabattoni
'''
import os
from glob import glob
from copy import deepcopy
from libsplit import bananaSPLITTER
from libconfload import bananaCONF
from libfancylogger import fancyLogger

if __name__ == "__main__":
	print("CWD-> "+os.getcwd())
	logger = fancyLogger(fileLog = False)
	confl = bananaCONF(workdir=r"./libbananasplit", logger=logger)
	confl.open()
	
	confl.use("testEN.json")
	splconf = confl.getParams("splitter")
	splist = []
	os.chdir(splconf["paths"]["INworkPath"])
	for f in glob("*.txt"):
		splconf["name"] = f
		logger.info("-"*80)
		splitter = bananaSPLITTER(fileParams=deepcopy(splconf), logger=logger)
		splist.append(splitter)
		splitter.start()
		splitter.join()

	logger.info("\n"+"="*50+"\n\tFINITO!!!\n"+"="*50)




