mirror of
https://github.com/ciromattia/kcc
synced 2026-06-10 00:20:33 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5e68ce380c | |||
| b95cf6e179 | |||
| 08070cdd97 | |||
| df3d174437 |
@@ -393,7 +393,10 @@ class WorkerThread(QThread):
|
||||
for job in currentJobs:
|
||||
bookDir.append(job)
|
||||
try:
|
||||
fusion_source_parent = str(Path(bookDir[0]).parent)
|
||||
comic2ebook.options = comic2ebook.checkOptions(copy(options))
|
||||
if options.output is None:
|
||||
options.output = fusion_source_parent
|
||||
currentJobs.clear()
|
||||
currentJobs.append(comic2ebook.makeFusion(bookDir))
|
||||
MW.addMessage.emit('Created fusion at ' + currentJobs[0], 'info', False)
|
||||
@@ -557,13 +560,6 @@ class WorkerThread(QThread):
|
||||
move(item, GUI.targetDirectory)
|
||||
except Exception:
|
||||
pass
|
||||
if options.filefusion:
|
||||
for path in currentJobs:
|
||||
if os.path.isfile(path):
|
||||
os.remove(path)
|
||||
elif os.path.isdir(path):
|
||||
rmtree(path, True)
|
||||
comic2ebook.checkPre('LLL-')
|
||||
GUI.progress.content = ''
|
||||
GUI.progress.stop()
|
||||
MW.hideProgressBar.emit()
|
||||
|
||||
@@ -76,23 +76,19 @@ def main(argv=None):
|
||||
print('No matching files found.')
|
||||
return 1
|
||||
if options.filefusion:
|
||||
fusion_source_parent = str(Path(sources[0]).parent)
|
||||
fusion_path = makeFusion(list(sources))
|
||||
sources.clear()
|
||||
sources.append(fusion_path)
|
||||
for source in sources:
|
||||
source = source.rstrip('\\').rstrip('/')
|
||||
options = copy(args)
|
||||
if options.filefusion and options.output is None:
|
||||
options.output = fusion_source_parent
|
||||
options = checkOptions(options)
|
||||
print('Working on ' + source + '...')
|
||||
makeBook(source)
|
||||
|
||||
if options.filefusion:
|
||||
for path in sources:
|
||||
if os.path.isfile(path):
|
||||
os.remove(path)
|
||||
elif os.path.isdir(path):
|
||||
rmtree(path, True)
|
||||
checkPre('LLL-')
|
||||
return 0
|
||||
|
||||
|
||||
@@ -979,10 +975,11 @@ def getWorkFolder(afile, workdir=None):
|
||||
manifest_dict[manifest_item.attrib.get('id')] = manifest_item.attrib.get('href')
|
||||
ordered_image_paths = []
|
||||
for i, spine_item in enumerate(spine):
|
||||
if spine_item not in manifest_dict:
|
||||
try:
|
||||
page_path = os.path.join(os.path.dirname(opf_path), manifest_dict[spine_item])
|
||||
page = ET.parse(page_path)
|
||||
except Exception:
|
||||
continue
|
||||
page_path = os.path.join(os.path.dirname(opf_path), manifest_dict[spine_item])
|
||||
page = ET.parse(page_path)
|
||||
imgs = page.findall(r'.//{*}img') + page.findall(r'.//{*}image')
|
||||
|
||||
largest_size = 0
|
||||
@@ -1690,8 +1687,8 @@ def makeFusion(sources: List[str]):
|
||||
raise UserWarning('Fusion requires at least 2 sources. Did you forget to uncheck fusion?')
|
||||
start = perf_counter()
|
||||
first_path = Path(sources[0])
|
||||
|
||||
if True:
|
||||
|
||||
if options.tempdir:
|
||||
fusion_parent = first_path.parent
|
||||
else:
|
||||
# LLL is after KCC
|
||||
@@ -1899,11 +1896,11 @@ def makeBook(source, qtgui=None, job_progress=''):
|
||||
|
||||
end = perf_counter()
|
||||
print(f"{job_progress}makeBook: {end - start} seconds")
|
||||
# Clean up temporary workspace
|
||||
try:
|
||||
rmtree(path, True)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if options.filefusion:
|
||||
rmtree(source, True)
|
||||
checkPre('LLL-')
|
||||
|
||||
return filepath
|
||||
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ def mergeDirectory(work):
|
||||
imagesValid.append(i[0])
|
||||
# Silently drop directories that contain too many images
|
||||
# 131072 = GIMP_MAX_IMAGE_SIZE / 4
|
||||
if targetHeight > 131072 * 4:
|
||||
if targetHeight > 131072 * 8:
|
||||
raise RuntimeError(f'Image too tall at {targetHeight} pixels. {targetWidth} pixels wide. Try using separate chapter folders or file fusion.')
|
||||
result = Image.new('RGB', (targetWidth, targetHeight))
|
||||
y = 0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Pillow>=11.3.0
|
||||
psutil>=7.2.2
|
||||
psutil>=5.9.5
|
||||
requests>=2.34.2
|
||||
python-slugify>=8.0.4
|
||||
packaging>=26.2
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
PySide6==6.4.3
|
||||
Pillow>=11.3.0
|
||||
psutil>=7.2.2
|
||||
psutil>=5.9.5
|
||||
requests>=2.34.2
|
||||
python-slugify>=8.0.4
|
||||
packaging>=26.2
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
PySide6==6.1.3
|
||||
Pillow>=9
|
||||
psutil>=7.2.2
|
||||
psutil>=5.9.5
|
||||
requests>=2.32.4
|
||||
python-slugify>=8.0.4
|
||||
packaging>=26.2
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
PySide6<6.10
|
||||
Pillow>=11.3.0
|
||||
psutil>=7.2.2
|
||||
psutil>=5.9.5
|
||||
requests>=2.34.2
|
||||
python-slugify>=8.0.4,<9.0.0
|
||||
packaging>=26.2
|
||||
|
||||
Reference in New Issue
Block a user