diff --git a/bananaSPLIT/libbabanasplit/libconfload.py b/bananaSPLIT/libbabanasplit/libconfload.py index 15d17a4..49a7dcd 100644 --- a/bananaSPLIT/libbabanasplit/libconfload.py +++ b/bananaSPLIT/libbabanasplit/libconfload.py @@ -3,13 +3,20 @@ Created on 2 nov 2019 @author: Emanuele Trabattoni ''' +from bananaSPLIT.libbabanasplit.libfancylogger import fancyLogger +import json,sys, os class bananaCONF(object): ''' Carica e Salva file di configurazione per bananaSPLITTER ''' - - def __init__(self, workdir=None): + def __init__(self, workdir=None, logger=None): + self.log=logger + if workdir is not None: + os.chdir(workdir) + self.log.debug("Cerco le configurazioni in: [{}]".format(os.getcwd())) + else: + self.log.error("Non mi e' stata fornita una directory per i file di configurazione") pass def open(self): @@ -27,4 +34,8 @@ class bananaCONF(object): def set(self): pass - \ No newline at end of file +if __name__ == "__main__": + logg = fancyLogger() + confloader = bananaCONF(workdir=os.getcwd(), logger=logg) + + \ No newline at end of file diff --git a/bananaSPLIT/libbabanasplit/testSettings.json b/bananaSPLIT/libbabanasplit/testSettings.json index 612469e..8a24f62 100644 --- a/bananaSPLIT/libbabanasplit/testSettings.json +++ b/bananaSPLIT/libbabanasplit/testSettings.json @@ -2,7 +2,71 @@ "version": "v1.1a", "logger": { "logFile": "D:\\Test\\bananaSPLIT.log", - "logFormat": "%(asctime)s|%(levelname)-8s|%(funcName)-10s|%(lineno)-3d: %(message)-50s", + "logFormat": "%(asctime)s|%(levelname)-8s| %(message)-50s", "logTimeFormat": "%m-%d %H:%M:%S" + }, + "splitter": { + "INworkPath": "D:\\Test\\", + "OUTworkPath": "D:\\Test\\Separati\\", + "OUTnameFormat": "TEST_{docnum}_{year:04d}{month:02d}{day:02d}_{title}.txt", + "docStruct": { + "docSep": "\\s*Copyright [(0-9)]+", + "dateFormat": "{month} {day:d}, {year:d}{}", + "dateWords": [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" + ], + "headWords": [ + "BYLINE:", + "SECTION:", + "LENGTH:", + "DATELINE:", + "HIGHLIGHT:", + "Email:" + ], + "tailWords": [ + "Newstex ID", + "NOTES", + "LANGUAGE:", + "GRAPHIC:", + "TYPE:", + "URL:", + "LOAD-DATE:", + "PUBLICATION-TYPE:", + "DOCUMENT-TYPE:", + "CHARTS:", + "JOURNAL-CODE:" + ] + }, + "settings": { + "encoding": "utf-8", + "monthPosition": 0, + "getNewsPaperName": true, + "nameNotFoundStr": "--ND--", + "includeTitle": true, + "removeDuplicates": true, + "showSkipped": false, + "showRemovedDuplicates": true, + "maxTitleLen": 32, + "loadTXT": true, + "loadDOCX": false, + "removeOldFiles": true, + "saveSeparateFiles": true, + "saveBodyFile": true, + "saveBodyNumber": true, + "delLF": false, + "delWordBreak": true, + "delChars": "'|@|#" + } } }