Compare commits
2 Commits
a4e550797c
...
ef91f8d26a
| Author | SHA1 | Date | |
|---|---|---|---|
| ef91f8d26a | |||
| fe75d99736 |
@@ -3,7 +3,6 @@ Created on 2 nov 2019
|
|||||||
|
|
||||||
@author: Emanuele Trabattoni
|
@author: Emanuele Trabattoni
|
||||||
'''
|
'''
|
||||||
from libbabanasplit.libfancylogger import fancyLogger
|
|
||||||
import json,os,glob,copy
|
import json,os,glob,copy
|
||||||
|
|
||||||
class bananaCONF(object):
|
class bananaCONF(object):
|
||||||
@@ -11,7 +10,7 @@ class bananaCONF(object):
|
|||||||
Carica e Salva file di configurazione per bananaSPLITTER
|
Carica e Salva file di configurazione per bananaSPLITTER
|
||||||
'''
|
'''
|
||||||
def __init__(self, workdir=None, logger=None):
|
def __init__(self, workdir=None, logger=None):
|
||||||
self.log = logger
|
self.log = logger
|
||||||
self.fileList = None
|
self.fileList = None
|
||||||
self.workdir = None
|
self.workdir = None
|
||||||
self.inUse = None
|
self.inUse = None
|
||||||
@@ -65,8 +64,8 @@ class bananaCONF(object):
|
|||||||
f=open(self.inUse)
|
f=open(self.inUse)
|
||||||
json.dump(self.settingsList[self.inUse], f)
|
json.dump(self.settingsList[self.inUse], f)
|
||||||
f.close()
|
f.close()
|
||||||
except IOError as eee:
|
except IOError as e:
|
||||||
self.log.error("Impossibile salvare il file: {}".format(self.inUse))
|
self.log.error("Impossibile salvare il file: {} - [{}]".format(self.inUse,e))
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def getFiles(self):
|
def getFiles(self):
|
||||||
@@ -80,9 +79,5 @@ class bananaCONF(object):
|
|||||||
self.settingsList[self.inUse][k]=dict(v)
|
self.settingsList[self.inUse][k]=dict(v)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
logg = fancyLogger()
|
|
||||||
confloader = bananaCONF(workdir=".", logger=logg)
|
|
||||||
confloader.open()
|
|
||||||
|
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ import colorama
|
|||||||
|
|
||||||
class fancyLogger(object):
|
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):
|
def __init__(self, name="Logger", consoleLog=True, fileLog=True):
|
||||||
settings = json.load(open("./testSettings.json"))["logger"]
|
settings = json.load(open("./testSettings.json"))["logger"]
|
||||||
@@ -83,7 +83,3 @@ class fancyLogger(object):
|
|||||||
self.critical("Test Critical")
|
self.critical("Test Critical")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
l=fancyLogger(name="testLogger")
|
|
||||||
l.testColors()
|
|
||||||
pass
|
|
||||||
@@ -3,7 +3,7 @@ Created on 2 nov 2019
|
|||||||
|
|
||||||
@author: Emanuele Trabattoni
|
@author: Emanuele Trabattoni
|
||||||
'''
|
'''
|
||||||
from libbabanasplit.libfancylogger import fancyLogger
|
from libfancylogger import fancyLogger
|
||||||
import threading, time, parse, re, copy, slugify, os
|
import threading, time, parse, re, copy, slugify, os
|
||||||
|
|
||||||
class bananaSPLITTER(threading.Thread):
|
class bananaSPLITTER(threading.Thread):
|
||||||
|
|||||||
79
bananaSPLIT/libbabanasplit/testITA.json
Normal file
79
bananaSPLIT/libbabanasplit/testITA.json
Normal 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": [
|
||||||
|
"'",
|
||||||
|
"@",
|
||||||
|
"#",
|
||||||
|
"$",
|
||||||
|
"%",
|
||||||
|
"^",
|
||||||
|
"&"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
17
bananaSPLIT/libtestmain.py
Normal file
17
bananaSPLIT/libtestmain.py
Normal 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()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user