mirror of
https://github.com/ciromattia/kcc
synced 2025-12-12 17:26:23 +00:00
dot_clean in c2p
This commit is contained in:
@@ -44,7 +44,7 @@ from html import escape as hescape
|
||||
import pymupdf
|
||||
import numpy as np
|
||||
|
||||
from .shared import getImageFileName, walkSort, walkLevel, sanitizeTrace, subprocess_run
|
||||
from .shared import getImageFileName, walkSort, walkLevel, sanitizeTrace, subprocess_run, dot_clean
|
||||
from .comicarchive import SEVENZIP, available_archive_tools
|
||||
from . import comic2panel
|
||||
from . import image
|
||||
@@ -1041,13 +1041,6 @@ def sanitizePermissions(filetree):
|
||||
dot_clean(filetree)
|
||||
|
||||
|
||||
def dot_clean(filetree):
|
||||
for root, _, files in os.walk(filetree, topdown=False):
|
||||
for name in files:
|
||||
if name.startswith('._'):
|
||||
os.remove(os.path.join(root, name))
|
||||
|
||||
|
||||
def chunk_directory(path):
|
||||
level = -1
|
||||
for root, _, files in os.walk(os.path.join(path, 'OEBPS', 'Images')):
|
||||
|
||||
@@ -24,7 +24,7 @@ from argparse import ArgumentParser
|
||||
from shutil import rmtree, copytree, move
|
||||
from multiprocessing import Pool
|
||||
from PIL import Image, ImageChops, ImageOps, ImageDraw
|
||||
from .shared import getImageFileName, walkLevel, walkSort, sanitizeTrace
|
||||
from .shared import dot_clean, getImageFileName, walkLevel, walkSort, sanitizeTrace
|
||||
|
||||
|
||||
def mergeDirectoryTick(output):
|
||||
@@ -44,6 +44,7 @@ def mergeDirectory(work):
|
||||
imagesValid = []
|
||||
sizes = []
|
||||
targetHeight = 0
|
||||
dot_clean(directory)
|
||||
for root, _, files in walkLevel(directory, 0):
|
||||
for name in files:
|
||||
if getImageFileName(name) is not None:
|
||||
@@ -253,6 +254,7 @@ def main(argv=None, qtgui=None):
|
||||
raise RuntimeError("One of workers crashed. Cause: " + mergeWorkerOutput[0][0],
|
||||
mergeWorkerOutput[0][1])
|
||||
print("Splitting images...")
|
||||
dot_clean(targetDir)
|
||||
for root, _, files in os.walk(targetDir, False):
|
||||
for name in files:
|
||||
if getImageFileName(name) is not None:
|
||||
|
||||
@@ -45,6 +45,14 @@ class HTMLStripper(HTMLParser):
|
||||
pass
|
||||
|
||||
|
||||
def dot_clean(filetree):
|
||||
for root, _, files in os.walk(filetree, topdown=False):
|
||||
for name in files:
|
||||
if name.startswith('._') or name == '.DS_Store':
|
||||
if os.path.exists(os.path.join(root, name)):
|
||||
os.remove(os.path.join(root, name))
|
||||
|
||||
|
||||
def getImageFileName(imgfile):
|
||||
name, ext = os.path.splitext(imgfile)
|
||||
ext = ext.lower()
|
||||
|
||||
Reference in New Issue
Block a user