08-18-2024, 11:40 AM | #1 |
Junior Member
Posts: 5
Karma: 10
Join Date: Aug 2024
Device: Pixel 4a
|
Create ebook using filesystem structure
Hello, I've been trying to create an ebook from a collection of html files and wondering if someone can help me out.
The basic story is that I have a collection of html files stored in my filesystem with this basic type of hierarchy: Book │ ├── 1-Foo │ ├── chapter-1.html │ ├── chapter-2.html │ └── chapter-3.html │ ├── 2-Bar │ ├── chapter-1.html │ └── chapter-2.html │ ├── 3-Baz │ ├── chapter-1.html │ ├── chapter-2.html │ └── chapter-3.html My question is, is there anyway to convert my collection of files sorted like above into an ebook in Calibre such that the TOC and ordering of the book follows this structure? So far, I've tried creating an index.html file which references all of the above files in order, and also just zipping the book folder and loading it into Calibre - in either case, Calibre throws the chapters into a completely random order. I've been reading the Calibre manual and they say it uses all kinds of complicated processes to determine the ordering and chapters of the book, but in my case, the work has already been done, it's just that Calibre doesn't understand it. I'm fine with creating a TOC if need be, but I can't find any info on how to manually create a TOC file or how to tell Calibre to use that TOC if I created one. I also don't want to edit the TOC using the book editor, my hope is to generate it using scripts since I can do this easily based off the filesystem structure of the files. But if there's a way to have Calibre infer the structure and ordering of the book from the filesystem automatically, that would be ideal! Any help anyone could provide here would be greatly appreciated! Thanks so much! |
08-18-2024, 12:02 PM | #2 |
creator of calibre
Posts: 44,546
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
08-18-2024, 01:30 PM | #3 |
Junior Member
Posts: 5
Karma: 10
Join Date: Aug 2024
Device: Pixel 4a
|
Sorry, so that was the first thing that I tried. Calibre seems to ignore the ordering of the html file and pulls in the chapters in a completely random order when I do that.
Ah sorry, just noticed the breadth-first ordering. I tried this with the CLI but was getting errors that my html files were ignored because they were binary files. But I just read theres an option to set it in the GUI - ill give it a try Last edited by vanceism7; 08-18-2024 at 01:34 PM. |
08-18-2024, 01:39 PM | #4 |
Junior Member
Posts: 5
Karma: 10
Join Date: Aug 2024
Device: Pixel 4a
|
Ok, so even using breadth-first ordering still results in a totally random chapter ordering
|
08-18-2024, 03:22 PM | #5 |
Junior Member
Posts: 5
Karma: 10
Join Date: Aug 2024
Device: Pixel 4a
|
Update:
Ok so, I atleast found a workaround. I wrote a script that traverses my book files in the order I want, and appends each one to a combined html file, and then I supply that file to `ebook-convert` and that will cause calibre to render the chapters in the correct ordering. Just FYI for anyone else looking for a cheap solution to this in the meantime |
08-18-2024, 04:00 PM | #6 |
Fool
Posts: 423
Karma: 3585252
Join Date: Feb 2003
Device: Kindle: Voyage,PW1,KOA, Kobo: Clara Colour, Nook GLP, Pocketbook verse
|
Did you actually try creating an HTML "table of contents" file as indicated by the link and then asking Calibre to add that file?
|
08-18-2024, 11:41 PM | #7 | |
Junior Member
Posts: 5
Karma: 10
Join Date: Aug 2024
Device: Pixel 4a
|
Quote:
``` <html> <body> <h1>Table of Contents</h1> <ol> <li><a href="1-Foo/chapter-1.html>chapter-1</a></li> ... Etc etc </ol> </body> </html> ``` And then tried the other structure more similar to the one in the manual. It successfully pulls in all of the files but it puts all the chapters in random order. I tried that also using the breadth-first option but it also didn't make a difference. I'm sure it's probably because the algorithm is trying to follow links in the html, and the html links are somewhat malformed as this is a bit of a strange project I'm working on. But as I said, I really don't need a sophisticated algorithm here, I just need it to include the files using the same ordering the filesystem is using. It would be nice if there was some ability to just zip up a directory and it just traversed the files in the natural ordering, but that doesn't seem to work as things are now. Unless there's a plugin or something, but I couldn't find anything in my search. (Admittedly I didn't look *very* hard though) |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Create tags while importing from source folder structure | eamonned | Library Management | 5 | 01-28-2019 10:37 AM |
Create TOC from non linear structure | Cilex | Conversion | 3 | 10-01-2016 09:16 PM |
Development eDGe Library filesystem and backup structure | kenjennings | enTourage Archive | 3 | 05-26-2011 02:29 PM |
Development eDGe Library filesystem and backup structure | kenjennings | enTourage Archive | 0 | 04-27-2011 02:57 AM |
How to create "Genre" expandable tree structure in Tag Browser? | meads | Library Management | 3 | 02-20-2011 03:43 PM |