fix from directory import
This commit is contained in:
parent
73c0998ae0
commit
b359521001
@ -59,10 +59,17 @@ class WPimport:
|
|||||||
|
|
||||||
|
|
||||||
def fromFile(self, files=[], number_thread=1, max_thread=1):
|
def fromFile(self, files=[], number_thread=1, max_thread=1):
|
||||||
|
divFiles = int(len(files) / max_thread)
|
||||||
|
currentRangeFiles = int(divFiles * (number_thread+1))
|
||||||
|
firstRange = int(currentRangeFiles - divFiles)
|
||||||
|
self._logger.debug("{0} : index : {1}".format(self._name,number_thread))
|
||||||
|
|
||||||
for i in range(0, len(files)):
|
self._logger.debug("{0} : first range : {1}".format(self._name,firstRange))
|
||||||
|
self._logger.debug("{0} : last range : {1}".format(self._name,currentRangeFiles))
|
||||||
|
|
||||||
|
for i in range(firstRange, currentRangeFiles):
|
||||||
if os.path.exists(files[i]):
|
if os.path.exists(files[i]):
|
||||||
self._logger.info("{0} : ({1}/{2}) File is being processed : {3}".format(self._name, i+1, len(files), files[i]))
|
self._logger.info("{0} : ({1}/{2}) File is being processed : {3}".format(self._name, i+1, currentRangeFiles + 1, files[i]))
|
||||||
with open(files[i], 'r') as f:
|
with open(files[i], 'r') as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
self._logger.debug("{0} : Size of article : {1}".format(self._name, len(content)))
|
self._logger.debug("{0} : Size of article : {1}".format(self._name, len(content)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user