Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function for converting list of images to cbz or cbr format #6

Open
RootEncrypter opened this issue Oct 7, 2020 · 5 comments
Open

Comments

@RootEncrypter
Copy link

Hey i see your code is converting list of images to cbz or cbr format. Could you explain or show the function how you do it. Do you use the urls directly or do you use downloaded images? @shibi391

@iShibi
Copy link
Owner

iShibi commented Oct 7, 2020

I used patool to archive the downloaded images into a cbr file.

for r, d, f in os.walk(path):
    for file in f:
        if '.jpg' in file:
            img_files.append(os.path.join(r, file))

print("Converting images into cbr format...")
images = tuple(img_files)

comic_meta_data_arr = comic_url.split('/')
comic_name = comic_meta_data_arr[4]
issue_number = (comic_meta_data_arr[5].split('?'))[0]

patoolib.create_archive(f"{path}\\" + f"{comic_name} {issue_number}.cbr", images, verbosity=-1)

patool is a python package. It takes the path of the cbr file you want to create and a tuple containing all the downloaded images which you want to archive. Verbosity arg is optional.

@RootEncrypter
Copy link
Author

Is img_files a list? @shibi391

@RootEncrypter
Copy link
Author

I have winrar installed but when I use patool I get an error saying cannot find excutable, any idea how to fix this ? @shibi391

@iShibi
Copy link
Owner

iShibi commented Oct 8, 2020

Is img_files a list? @shibi391

It's a list while I'm appending the image files to it, but after that, I have to convert it into a tuple because patool only accept tuple arg for files.

@iShibi
Copy link
Owner

iShibi commented Oct 8, 2020

I have winrar installed but when I use patool I get an error saying cannot find excutable, any idea how to fix this ? @shibi391

Did you install all the packages listed in the requirements.txt?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants