1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-13 01:36:27 +00:00

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

View File

@@ -828,7 +828,7 @@ def sanitizePermissions(filetree):
os.chmod(os.path.join(root, name), S_IWRITE | S_IREAD | S_IEXEC)
def batch_directory(path):
def chunk_directory(path):
level = -1
for root, _, files in os.walk(os.path.join(path, 'OEBPS', 'Images')):
for f in files:
@@ -842,16 +842,16 @@ def batch_directory(path):
level = newLevel
if level > 0:
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]
for tome in batcher:
for tome in chunker:
path.append(tome)
return path
else:
raise UserWarning('Unsupported directory structure.')
def batch_process(path, mode, parent):
def chunk_process(path, mode, parent):
output = []
currentSize = 0
currentTarget = path
@@ -1196,7 +1196,7 @@ def makeBook(source, qtgui=None):
GUI.progressBarTick.emit('1')
chapterNames = sanitizeTree(os.path.join(path, 'OEBPS', 'Images'))
if options.batchsplit > 0:
tomes = batch_directory(path)
tomes = chunk_directory(path)
else:
tomes = [path]
filepath = []