Inizio scrittura confloader
integrazione del fancylogger e settings nel file di test
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
logg = fancyLogger()
|
||||
confloader = bananaCONF(workdir=os.getcwd(), logger=logg)
|
||||
|
||||
|
||||
@@ -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": "'|@|#"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user