rename batch to chunk (#826)

This commit is contained in:
Alex Xu
2025-02-12 15:31:40 -08:00
committed by GitHub
parent 3d4fae62d8
commit 02535421a0
+5 -5
View File
@@ -828,7 +828,7 @@ def sanitizePermissions(filetree):
os.chmod(os.path.join(root, name), S_IWRITE | S_IREAD | S_IEXEC) os.chmod(os.path.join(root, name), S_IWRITE | S_IREAD | S_IEXEC)
def batch_directory(path): def chunk_directory(path):
level = -1 level = -1
for root, _, files in os.walk(os.path.join(path, 'OEBPS', 'Images')): for root, _, files in os.walk(os.path.join(path, 'OEBPS', 'Images')):
for f in files: for f in files:
@@ -842,16 +842,16 @@ def batch_directory(path):
level = newLevel level = newLevel
if level > 0: if level > 0:
parent = pathlib.Path(path).parent parent = pathlib.Path(path).parent
batcher = batch_process(os.path.join(path, 'OEBPS', 'Images'), level, parent) chunker = chunk_process(os.path.join(path, 'OEBPS', 'Images'), level, parent)
path = [path] path = [path]
for tome in batcher: for tome in chunker:
path.append(tome) path.append(tome)
return path return path
else: else:
raise UserWarning('Unsupported directory structure.') raise UserWarning('Unsupported directory structure.')
def batch_process(path, mode, parent): def chunk_process(path, mode, parent):
output = [] output = []
currentSize = 0 currentSize = 0
currentTarget = path currentTarget = path
@@ -1196,7 +1196,7 @@ def makeBook(source, qtgui=None):
GUI.progressBarTick.emit('1') GUI.progressBarTick.emit('1')
chapterNames = sanitizeTree(os.path.join(path, 'OEBPS', 'Images')) chapterNames = sanitizeTree(os.path.join(path, 'OEBPS', 'Images'))
if options.batchsplit > 0: if options.batchsplit > 0:
tomes = batch_directory(path) tomes = chunk_directory(path)
else: else:
tomes = [path] tomes = [path]
filepath = [] filepath = []