risolti i problemi di parsign su file di esempio semplificato

This commit is contained in:
2019-12-01 18:29:09 +01:00
parent d69a3d0628
commit 8628c3dbfb
3 changed files with 11 additions and 11 deletions

View File

@@ -107,7 +107,7 @@ class bananaSPLITTER(threading.Thread):
# ricerco la data
if (lineWords[self.settings['monthPosition']]).capitalize() in self.docStruct['dateWords']:
try:
docDate=parse.parse(self.docParams['dateFormat'],l).named
docDate=parse.parse(self.docStruct['dateFormat'],l).named
docDate['month']=docDate['month'].lstrip().rstrip().capitalize()
docDate['month']=self.docStruct['dateWords'].index(docDate['month'])+1
title = ''
@@ -231,7 +231,7 @@ class bananaSPLITTER(threading.Thread):
print ('Persorso: {0}'.format(self.paths['OUTworkPath'].format('nomeFile')))
try:
fName=slugify(self.fileName)
fName='BODYFILE_{0}_{1}.txt'.format(self.fileCounter,fName[:self.settings['maxTitleLen']])
fName='BODYFILE_{0}.txt'.format(fName[:self.settings['maxTitleLen']])
fileContent = os.linesep.join([cc['content'] for cc in self.fileList])
out=open(self.paths['OUTworkPath']+'{0}'.format(fName),'wb')
out.write(fileContent.encode(self.settings['encoding']))
@@ -239,9 +239,6 @@ class bananaSPLITTER(threading.Thread):
except IOError as e:
print("OOPS! Qualcosa e\' andato storto, non riesco a scrivere il file: {}".format(e))
pass
if __name__ == "__main__":
logg = fancyLogger(name="LibSplit")
spp = bananaSPLITTER(fileParams="testfile.txt", logger=logg)

View File

@@ -58,7 +58,7 @@
"nameNotFoundStr": "ND",
"includeTitle": true,
"removeDuplicates": true,
"showSkipped": false,
"showSkipped": true,
"showRemovedDuplicates": true,
"maxTitleLen": 32,
"loadTXT": true,
@@ -67,7 +67,7 @@
"saveSeparateFiles": true,
"saveBodyFile": true,
"saveBodyNumber": true,
"delLF": false,
"delLF": true,
"delWordBreak": true,
"delChars": [
"'",

View File

@@ -17,9 +17,12 @@ confl.use("testEN.json")
splconf = confl.getParams("splitter")
splconf["name"] = splconf["paths"]["INworkPath"]+"GUARDIAN 1989.txt"
splitter = bananaSPLITTER(fileParams=splconf, logger=logger)
splitter.start()
splitter.join()
splitter.openFile()
splitter.remEmptyLines()
splitter.splitFile()
splitter.removeDuplicates()
splitter.saveBody()
splitter.saveSeparate()