08-10-2014, 06:46 AM | #1 |
Junior Member
Posts: 2
Karma: 10
Join Date: Aug 2014
Device: Sony Reader PRS-T2
|
Simple utils for comic to EPUB conversion to perserve order
Hi all,
Like some others I had some problems when I wanted to convert a CBZ/CBR comic to EPUB in Calibre, because the conversion puts filename order above directory order. For example a CBZ with the following images: Code:
Comic Chapter 1/1.jpg Comic Chapter 1/2.jpg Comic Chapter 1/3.jpg ... Comic Chapter 2/1.jpg Comic Chapter 2/2.jpg Comic Chapter 2/3.jpg Code:
Comic Chapter 1/1.jpg Comic Chapter 2/1.jpg Comic Chapter 1/2.jpg Comic Chapter 2/2.jpg Comic Chapter 1/3.jpg Comic Chapter 2/3.jpg Manually renaming everything is kind of a drag though, so I quickly wrote two utilities to help me rename files and create CBZ's out of these. Since I might not be the only one who wanted this, I thought it would be nice to share these with the community. Keep in mind that I just quickly put these together, so don't expect a pretty interface and all. I created it in Java since that'll work on most different operating systems and because that's what I'm good at, so it'll require you to install the Java Runtime Environment (JRE) if you haven't already (just try to run it and you'll automatically see if you have the proper Java installed). I included the runnable jars as attachments, which can be run on any OS. For Windows users such as myself I also created executables of these jars, for ease of use. AppDir.jar / appendir.exe This utility will go through all the subdirectories and prefix the filenames with a number for the directory, so the filenames will remain in the same order when flattened. It'll use human readable parsing to ensure that for example directory "Chapter 9" comes before "Chapter 10" (which wouldn't be the case in alphabetical ordering). So for example, if you run the appendir.exe in the following directory with comic chapters Code:
... Comic Chapter 9/1.jpg Comic Chapter 9/2.jpg Comic Chapter 9/3.jpg Comic Chapter 9.5/1.jpg Comic Chapter 9.5/2.jpg Comic Chapter 9.5/3.jpg Comic Chapter 10/1.jpg Comic Chapter 10/2.jpg Comic Chapter 10/3.jpg Code:
... Comic Chapter 9/009_1.jpg Comic Chapter 9/009_2.jpg Comic Chapter 9/009_3.jpg Comic Chapter 9.5/010_1.jpg Comic Chapter 9.5/010_2.jpg Comic Chapter 9.5/010_3.jpg Comic Chapter 10/011_1.jpg Comic Chapter 10/011_2.jpg Comic Chapter 10/011_3.jpg Options You can run the utility as is, but I added two optional commandline parameters for more control if required:
Example use: Put appendir.exe in the comic folder you need to rename and doubleclick. Example use with parameters: Open command prompt, go to location of appendir.exe and run: appendir.exe "C:\Comics" 5 Example use with jar: Open command prompt or terminal, go to location of AppDir.jar and run: java -jar AppDir.jar Dir2CBZ.jar / dir2cbz.exe After renaming all the files in comic volumes I still needed to create CBZ's or CBR's out of them. This is rather trivial to do by creating a zip file of every volume and renaming it to *.cbz, but I couldn't quickly find a satisfactory method of doing this automatically for all folders, so again I made a simple utility to do this for me. So this just automatically creates CBZ files for all folders in the directory it's run in, which then can be directly imported into Calibre. Options You can run the utility as is, but I added one optional commandline parameters:
Example use: Put dir2cbz.exe in the comic folder containing all the folders you want to create CBZs out of and doubleclick. Example use with parameters: Open command prompt, go to location of dir2cbz.exe and run: dir2cbz.exe "C:\Comics" Example use with jar: Open command prompt or terminal, go to location of Dir2CBZ.jar and run: java -jar Dir2CBZ.jar Any feedback / suggestions / requests are welcome, though again keep in mind that these are just simple utilities I quickly created. Feel free to use them as you like, hopefully I helped someone else with this to manage their comic library. Enjoy! |
08-11-2014, 12:05 AM | #2 |
creator of calibre
Posts: 44,393
Karma: 23798586
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
Advert | |
|
08-14-2014, 01:59 PM | #3 |
Junior Member
Posts: 2
Karma: 10
Join Date: Aug 2014
Device: Sony Reader PRS-T2
|
Thanks kovidgoyal, that'll make it a lot easier!
|
Tags |
cbz, comic, epub, order, ordered |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
comic conversion | killa | Conversion | 1 | 02-28-2011 09:31 AM |
Having a very hard time converting a comic and keeping it in order! | branchedout | Reading and Management | 2 | 08-18-2010 11:13 AM |
Simple Esperanto ePub conversion script? | amuzulo | ePub | 10 | 03-06-2010 02:54 PM |
Calibre comic conversion yields poor results when target is epub; looks fine on LRF | acidzebra | Calibre | 2 | 08-17-2009 10:54 AM |
Comic Conversion | grzy7316 | Calibre | 2 | 04-08-2009 06:55 PM |