From 07641d702c4958d4f526a2391c011593de85fb8c Mon Sep 17 00:00:00 2001 From: Emanuele Date: Mon, 30 Mar 2020 18:12:53 +0200 Subject: [PATCH] prima versione funzionante con i file nuovi corretto errore unicode, rimosso body dal contenuto del file, potrebbe rimanere il problema della chiave 'year' --- bananaSPLIT/conf/testbastardi.json | 67 ++++++++++++++++++++++++++ bananaSPLIT/guimain.py | 3 +- bananaSPLIT/libbananasplit/libsplit.py | 6 +-- 3 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 bananaSPLIT/conf/testbastardi.json diff --git a/bananaSPLIT/conf/testbastardi.json b/bananaSPLIT/conf/testbastardi.json new file mode 100644 index 0000000..bdb1087 --- /dev/null +++ b/bananaSPLIT/conf/testbastardi.json @@ -0,0 +1,67 @@ +{ + "version": "v1.1a", + "paths": { + "lastUsed": "testbastardi.json", + "configurationPath": "D:/Emanuele/Documenti/workspace/bananaSPLIT/bananaSPLIT/conf/", + "INworkPath": "D:/Emanuele/Documenti/workspace/bananaSPLIT/TestFiles/FileBastardi", + "OUTworkPath": "H:/", + "fileList": [ + "Files(100)(1).txt", + "Files(100)(2).txt" + ] + }, + "docStruct": { + "fileVersNew": true, + "language": "English", + "docSep": "\\s*Copyright [(0-9)]+", + "beginOfDocument": "\\s*Body", + "endOfDocument": "\\s*End of Document", + "dateFormat": "{month} {day:d}, {year:d}{}", + "outPrefix": "", + "outSuffix": "", + "outExt": ".txt", + "outDateType": "jpn", + "outNameFormat": "", + "outDate": true, + "outTitle": true, + "outNumber": true, + "numberPos": 3, + "datePos": 1, + "titlePos": 2, + "maxTitleLen": 20, + "outNameSep": "-", + "customSep": "=", + "dateFormats": { + "jpn": "{year:04d}{month:02d}{day:02d}", + "it": "{day:02d}{month:02d}{year:04d}", + "usa": "{month:02d}{year:04d}{day:02d}" + } + }, + "settings": { + "encoding": "ansi", + "monthPosition": 0, + "getNewsPaperName": true, + "nameNotFoundStr": "ND", + "includeTitle": false, + "removeDuplicates": false, + "showSkipped": false, + "showRemovedDuplicates": false, + "loadTXT": true, + "loadDOCX": false, + "removeOldFiles": true, + "saveSeparateFiles": true, + "saveBodyFile": true, + "saveBodyNumber": true, + "delLF": false, + "delWordBreak": true, + "delChars": [ + "'", + "@", + "#", + "$", + "%", + "^", + "&" + ] + } +} \ No newline at end of file diff --git a/bananaSPLIT/guimain.py b/bananaSPLIT/guimain.py index c90badf..003a596 100644 --- a/bananaSPLIT/guimain.py +++ b/bananaSPLIT/guimain.py @@ -167,6 +167,7 @@ class bananaMain(PyQt5.QtWidgets.QMainWindow): return def applicaTutto(self): + self.conf.setParam(('docStruct','fileVersNew'), self.ui.rad_fileNew.isChecked()) self.titolo.applica() self.selezout.applica() self.advopt.applica() @@ -451,9 +452,9 @@ class bananaSelezOut(PyQt5.QtWidgets.QWidget): @pyqtSlot() def updateState(msg): - #print (msg) msgb.setText(msg) # costruisco i thread + tDict={} try: for f in splconf['paths']['fileList']: diff --git a/bananaSPLIT/libbananasplit/libsplit.py b/bananaSPLIT/libbananasplit/libsplit.py index 1c87542..f5f8fef 100644 --- a/bananaSPLIT/libbananasplit/libsplit.py +++ b/bananaSPLIT/libbananasplit/libsplit.py @@ -179,9 +179,9 @@ class bananaSPLITTER(QObject): #doppio check per trovare l'inizio del corpo documento if re.match(self.docStruct['beginOfDocument'],l): self.status='body' - if lineWords[0].upper() not in self.docStruct['language']['headWords']: #se la prima parola non e' tra quelle di inizio - tempBody.append(l) # vuol dire che ho trovato l'articolo e aggiungo la prima riga al contenuto del documento - self.status = 'body' + #if lineWords[0].upper() not in self.docStruct['language']['headWords']: #se la prima parola non e' tra quelle di inizio + #tempBody.append(l) # vuol dire che ho trovato l'articolo e aggiungo la prima riga al contenuto del documento + #self.status = 'body' elif self.status == 'body': if re.match(self.docStruct['endOfDocument'],l) is not None: #controlla se ci sono articoli che non hanno le parole chiave finali self.log.warn("Ho individuato una separatore valido prima che si chiusesse l'articolo precedente, controlla i tuoi file in uscita!\n\