forse tolti tutti i os.chdir
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
Qui si mettono i file di test per la versione GUI di bananaSPLIT
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
"paths": {
|
"paths": {
|
||||||
"lastUsed": "defaults.json",
|
"lastUsed": "defaults.json",
|
||||||
"configurationPath": "D:/Emanuele/Documenti/workspace/bananaSPLIT/bananaSPLIT/conf/",
|
"configurationPath": "D:/Emanuele/Documenti/workspace/bananaSPLIT/bananaSPLIT/conf/",
|
||||||
"INworkPath": "D:/Emanuele/Documenti/workspace/bananaSPLIT/TestFiles",
|
"INworkPath": "D:/Emanuele/Documenti/workspace/bananaSPLIT/TestFiles/",
|
||||||
"OUTworkPath": "H:/",
|
"OUTworkPath": "H:/",
|
||||||
"fileList": [
|
"fileList": [
|
||||||
"GUARDIAN 1993.txt",
|
"GUARDIAN 1993.txt",
|
||||||
|
|||||||
@@ -57,14 +57,14 @@ class bananaSPLITTER(QThread):
|
|||||||
# preparo e inizio il salvataggio
|
# preparo e inizio il salvataggio
|
||||||
if os.path.exists(self.outPath):
|
if os.path.exists(self.outPath):
|
||||||
if self.settings['removeOldFiles']:
|
if self.settings['removeOldFiles']:
|
||||||
os.chdir(self.outPath)
|
#os.chdir(self.outPath)
|
||||||
for f in os.listdir(self.outPath):
|
for f in os.listdir(self.outPath):
|
||||||
os.remove(f)
|
os.remove(f)
|
||||||
else:
|
else:
|
||||||
raise FileExistsError("Non posso sovrascrivere i vecchi file, eliminali manualmente!")
|
raise FileExistsError("Non posso sovrascrivere i vecchi file, eliminali manualmente!")
|
||||||
else:
|
else:
|
||||||
os.mkdir(self.outPath)
|
os.mkdir(self.outPath)
|
||||||
os.chdir(self.outPath)
|
#os.chdir(self.outPath)
|
||||||
if self.settings['saveSeparateFiles']:
|
if self.settings['saveSeparateFiles']:
|
||||||
self.saveSeparate()
|
self.saveSeparate()
|
||||||
if self.settings['saveBodyFile']:
|
if self.settings['saveBodyFile']:
|
||||||
@@ -83,9 +83,9 @@ class bananaSPLITTER(QThread):
|
|||||||
|
|
||||||
def openFile(self):
|
def openFile(self):
|
||||||
try:
|
try:
|
||||||
os.chdir(self.paths["INworkPath"])
|
#os.chdir(self.paths["INworkPath"])
|
||||||
self.log.info("Carico il contenuto..")
|
self.log.info("Carico il contenuto..")
|
||||||
fp = open(self.fileParams['name'], mode='r', encoding=self.settings['encoding'])
|
fp = open(self.paths["INworkPath"]+'/'+self.fileParams['name'], mode='r', encoding=self.settings['encoding'])
|
||||||
self.rawFile = fp.readlines()
|
self.rawFile = fp.readlines()
|
||||||
fp.close()
|
fp.close()
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
@@ -253,7 +253,7 @@ class bananaSPLITTER(QThread):
|
|||||||
docnum=outFileCounter,\
|
docnum=outFileCounter,\
|
||||||
papername=ff['newsPaperName'].strip(),\
|
papername=ff['newsPaperName'].strip(),\
|
||||||
**ff['date'])
|
**ff['date'])
|
||||||
out=open('{0}'.format(fName),'wb')
|
out=open(self.outPath+'{0}'.format(fName),'wb')
|
||||||
if self.settings['includeTitle']:
|
if self.settings['includeTitle']:
|
||||||
ff['content'] = ff['title']+os.linesep+ff['content']
|
ff['content'] = ff['title']+os.linesep+ff['content']
|
||||||
out.write(ff['content'].encode(self.settings['encoding']))
|
out.write(ff['content'].encode(self.settings['encoding']))
|
||||||
@@ -276,7 +276,7 @@ class bananaSPLITTER(QThread):
|
|||||||
self.log.debug('Persorso: {0}'.format(self.outPath))
|
self.log.debug('Persorso: {0}'.format(self.outPath))
|
||||||
os.chdir(self.outPath)
|
os.chdir(self.outPath)
|
||||||
try:
|
try:
|
||||||
fName=slugify(self.fileName)
|
fName=self.outPath+slugify(self.fileName)
|
||||||
fName='BODYFILE_{0}.txt'.format(fName[:self.docStruct['maxTitleLen']])
|
fName='BODYFILE_{0}.txt'.format(fName[:self.docStruct['maxTitleLen']])
|
||||||
fileContent = os.linesep.join([cc['content'] for cc in self.contentList])
|
fileContent = os.linesep.join([cc['content'] for cc in self.contentList])
|
||||||
out=open('{0}'.format(fName),'wb')
|
out=open('{0}'.format(fName),'wb')
|
||||||
|
|||||||
Reference in New Issue
Block a user