Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # pip install manga-py
- # pip install KindleComicConverter
- import os
- import zipfile
- from tqdm import tqdm
- # Supported site where you download form (for reference: https://manga-dl.yuru-yuri.sttv.me/#resources-list)
- WEBSITE = ""
- # No spaces is mandatory 'cause I'm lazy (e.g. Blue_Exorcist)
- MANGA_NAME = ""
- # How many chapters you want per kindle file? (not too much, not too little)
- CHAPTERS_PER_FILE = 10
- # Download manga in Manga/<MANGA_NAME>
- os.system("manga-py " + WEBSITE + " --name " + MANGA_NAME)
- # DECOMPRESS
- directory = "Manga/" + MANGA_NAME
- zip_volumes = os.listdir(directory)
- j = 1
- for i, zip_name in tqdm(list(enumerate(list(zip_volumes)))):
- volume_name = zip_name[:-4]
- file_name = MANGA_NAME + "_" + str(j)
- os.system("mkdir " + directory + "\\decomp\\" +
- file_name + "\\" + volume_name)
- zip_file = zipfile.ZipFile(directory + "/" + zip_name)
- zip_file.extractall(directory + "/decomp/" + file_name + "/" + volume_name)
- pages = os.listdir(directory + "/decomp/" + file_name + "/" + volume_name)
- for page in pages:
- if page == "info.txt":
- os.remove(directory + "/decomp/" + file_name +
- "/" + volume_name + "/" + page)
- else:
- os.rename(directory + "/decomp/" + file_name + "/" + volume_name + "/" + page,
- directory + "/decomp/" + file_name + "/" + volume_name + "/" + page[:3] + ".webp")
- if (i + 1) % CHAPTERS_PER_FILE == 0:
- j += 1
- # CREATE
- creator_list = os.listdir(directory + "/decomp/")
- for element in creator_list:
- os.system(
- # for reference visit: https://github.com/ciromattia/kcc
- # REMEMBER TO SET UP YOUR KindleGen so that is reachable somewhere in your PATH variable!!!
- "kcc-c2e " + directory.replace('/','\\') + "\\decomp\\" + element
- )
- # Final note: be sure to navigate the comic book with "panel view" disabled! So that you go page after page and not by randomly zooming all around!
Advertisement
Add Comment
Please, Sign In to add comment