2 Commits

Author SHA1 Message Date
ef91f8d26a iniziano test librerie, modifiche file configurazione di test 2019-12-01 16:50:15 +01:00
fe75d99736 Inizia il testing della libreria 2019-12-01 16:21:23 +01:00
6 changed files with 103 additions and 16 deletions

View File

@@ -3,7 +3,6 @@ Created on 2 nov 2019
@author: Emanuele Trabattoni
'''
from libbabanasplit.libfancylogger import fancyLogger
import json,os,glob,copy
class bananaCONF(object):
@@ -11,7 +10,7 @@ class bananaCONF(object):
Carica e Salva file di configurazione per bananaSPLITTER
'''
def __init__(self, workdir=None, logger=None):
self.log = logger
self.log = logger
self.fileList = None
self.workdir = None
self.inUse = None
@@ -65,8 +64,8 @@ class bananaCONF(object):
f=open(self.inUse)
json.dump(self.settingsList[self.inUse], f)
f.close()
except IOError as eee:
self.log.error("Impossibile salvare il file: {}".format(self.inUse))
except IOError as e:
self.log.error("Impossibile salvare il file: {} - [{}]".format(self.inUse,e))
pass
def getFiles(self):
@@ -79,10 +78,6 @@ class bananaCONF(object):
def setParams(self, k, v):
self.settingsList[self.inUse][k]=dict(v)
pass
if __name__ == "__main__":
logg = fancyLogger()
confloader = bananaCONF(workdir=".", logger=logg)
confloader.open()

View File

@@ -10,7 +10,7 @@ import colorama
class fancyLogger(object):
'''
Colorizza il logger di python, per un' esperienza alla willy wonka
Colorizza il logger di python, per un' esperienza stile willy wonka
'''
def __init__(self, name="Logger", consoleLog=True, fileLog=True):
settings = json.load(open("./testSettings.json"))["logger"]
@@ -82,8 +82,4 @@ class fancyLogger(object):
self.error("Test Error")
self.critical("Test Critical")
pass
if __name__ == "__main__":
l=fancyLogger(name="testLogger")
l.testColors()
pass

View File

@@ -3,7 +3,7 @@ Created on 2 nov 2019
@author: Emanuele Trabattoni
'''
from libbabanasplit.libfancylogger import fancyLogger
from libfancylogger import fancyLogger
import threading, time, parse, re, copy, slugify, os
class bananaSPLITTER(threading.Thread):

View File

@@ -0,0 +1,79 @@
{
"version": "v1.1a",
"logger": {
"logFile": "D:\\Test\\bananaSPLIT.log",
"logFormat": "%(asctime)s|%(levelname)-8s| %(message)-50s",
"logTimeFormat": "%m-%d %H:%M:%S"
},
"splitter": {
"paths": {
"INworkPath": "D:\\Test\\",
"OUTworkPath": "D:\\Test\\Separati\\",
"OUTnameFormat": "TEST_{docnum}_{year:04d}{month:02d}{day:02d}_{title}.txt"
},
"docStruct": {
"docSep": "Copyright [(0-9)]+",
"dateFormat": "{day:d} {month} {year:d} {}",
"dateWords": [
"Gennaio",
"Febbraio",
"Marzo",
"Aprile",
"Maggio",
"Giugno",
"Luglio",
"Agosto",
"Settembre",
"Ottobre",
"Novembre",
"Dicembre"
],
"headWords": [
"BYLINE:",
"SECTION:",
"LENGTH:",
"DATELINE:",
"HIGHLIGHT:",
"Email:"
],
"tailWords": [
"LANGUAGE:",
"GRAPHIC:",
"TYPE:",
"URL:",
"LOAD-DATE:",
"PUBLICATION-TYPE:",
"DOCUMENT-TYPE:",
"CHARTS:"
]
},
"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": [
"'",
"@",
"#",
"$",
"%",
"^",
"&"
]
}
}
}

View File

@@ -0,0 +1,17 @@
'''
Created on 1 dic 2019
@author: Emanuele Trabattoni
'''
from libsplit import bananaSPLITTER
from libconfload import bananaCONF
from libfancylogger import fancyLogger
logger = fancyLogger(fileLog = False)
confl = bananaCONF()
splitter = bananaSPLITTER()