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

fix webtoon source directory is empty

This commit is contained in:
Alex Xu
2025-10-16 21:49:36 -07:00
parent e56612228c
commit 4c5ec95a9b

View File

@@ -21,7 +21,7 @@
import os import os
import sys import sys
from argparse import ArgumentParser from argparse import ArgumentParser
from shutil import rmtree, copytree, move from shutil import rmtree
from multiprocessing import Pool from multiprocessing import Pool
from time import perf_counter from time import perf_counter
from PIL import Image, ImageChops, ImageOps, ImageDraw, ImageFilter from PIL import Image, ImageChops, ImageOps, ImageDraw, ImageFilter
@@ -233,7 +233,7 @@ def main(argv=None, qtgui=None):
targetDir = sourceDir + "-Splitted" targetDir = sourceDir + "-Splitted"
if os.path.isdir(sourceDir): if os.path.isdir(sourceDir):
rmtree(targetDir, True) rmtree(targetDir, True)
copytree(sourceDir, targetDir) os.renames(sourceDir, targetDir)
work = [] work = []
pagenumber = 1 pagenumber = 1
splitWorkerOutput = [] splitWorkerOutput = []
@@ -291,8 +291,7 @@ def main(argv=None, qtgui=None):
raise RuntimeError("One of workers crashed. Cause: " + splitWorkerOutput[0][0], raise RuntimeError("One of workers crashed. Cause: " + splitWorkerOutput[0][0],
splitWorkerOutput[0][1]) splitWorkerOutput[0][1])
if args.inPlace: if args.inPlace:
rmtree(sourceDir, True) os.renames(targetDir, sourceDir)
move(targetDir, sourceDir)
else: else:
rmtree(targetDir, True) rmtree(targetDir, True)
raise UserWarning("C2P: Source directory is empty.") raise UserWarning("C2P: Source directory is empty.")