Пример #1
0
def convertCap(*args):
    print(args)
    name = PathDir(str(args[0]).replace(' ', '-').lower())
    caps = [PathDir(f'{name}_cap{cp:0>4}') for cp in args[1]]
    for cap in caps:
        folder = PathDir(BASE_DIR, name, 'jpgs', cap)
        convertFolder(folder, name, cap_words(cap.abs.replace('_', ' ')))
Пример #2
0
def convertEmptys(*args):
    folder = PathDir(BASE_DIR, str(args[0]).replace(' ', '-').lower(), 'jpgs')
    empty_caps = [
        PathDir(folder, cp) for cp in folder.listdir
        if cp.isdir and len(cp.listdir) == 0
    ]
    empty_caps.sort()
    download_manga(
        folder.parent.basename, None, 1, BASE_DIR,
        [parseCap(n.basename.split('_cap')[-1]) for n in empty_caps])
Пример #3
0
def convertFolder(folder: str, manganame=None, namecap=None):

    folder_dir = PathDir(folder)
    os.system(f'''echo "making PDF of cap {namecap or folder_dir.basename}"''')
    manga_name = PathDir(manganame or folder_dir.parent.parent.basename)
    name_cap = PathFile(namecap or folder_dir.parent.basename).addExt('pdf')
    root = folder_dir.parent.parent.parent
    createFolderIfNotExists(root.join(manga_name))
    fix_images_by_folder(folder)
    fit_images_by_folder(folder)
    convert_cmd = f'''convert {folder}/*.jpg "{root.join(manga_name,name_cap)}"'''
    os.system(convert_cmd)

    print(f'''create file {root.join(manga_name,name_cap)}''')
Пример #4
0
def convertMain(*args):
    folder = PathDir(args[1].replace(' ', '-').lower())
    manganame = folder.basename.split('_')[0].strip('-').lower()
    cap = cap_words(
        f"{manganame} cap{folder.basename.split('_')[1]:0>4}".replace(
            '-', ' '))
    convertFolder(folder, folder.parent.parent, cap)
Пример #5
0
def fix_images_by_folder(folder):
    img_paths = PathDir(folder).listdir
    for imgFile in img_paths:
        if imgFile.isfile:
            try:
                fix_image(imgFile)
            except Exception as err:
                print('FIX ALL IMAGEs ERROR: ', imgFile.name, '\n', err)
Пример #6
0
import json
import getpass
from pathdir import PathDir
import os

ROOT_PATH = PathDir(os.path.join(os.path.dirname(os.path.abspath(__file__))))

CONFIGS = json.load(open(os.path.join(ROOT_PATH.abs, 'config.json'), 'r'))

BASE_DIR = PathDir(CONFIGS["base-dir"].replace('$HOME',
                                               f'/home/{getpass.getuser()}'))
BASE_URL = PathDir(CONFIGS["base-url"])
TEMP_DIR = PathDir(CONFIGS["temp-dir"])

KINDLE_W_CONST = CONFIGS['width']
KINDLE_H_CONST = CONFIGS['height']
Пример #7
0
def getParentDir(folder: str):
    return PathDir(folder)
Пример #8
0
 def __inter():
     args = os.sys.argv[1:]
     name = PathDir(args[1])
     ext(name, args[2:])