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

Incorrect table of contents if "Rotate and split" is chosen #558

Closed
vinhtq115 opened this issue Jul 19, 2023 · 15 comments · Fixed by #507
Closed

Incorrect table of contents if "Rotate and split" is chosen #558

vinhtq115 opened this issue Jul 19, 2023 · 15 comments · Fixed by #507

Comments

@vinhtq115
Copy link
Contributor

It seems that if "Rotate and split" is chosen, the table of contents created with ComicTagger is not adjusted correctly. If there are any double pages before the entry, It is off by a few pages (roughly equal to the number of double pages before that page).

For example:
Example file: https://we.tl/t-RHYm3amWpH

Settings I used:
image

The first three entries in the ToC is correct (since there aren't any double pages between them). But the fourth one is off by 3 pages (should be 74/171 on Kindle instead of 70/171) because there are 3 double pages before the third and fourth entries. Also, idk why Kindle does not show page 72 (only 70-71-73-74) and the number on the ToC is 68 instead of 70.

@axu2
Copy link
Collaborator

axu2 commented Jul 19, 2023

Can you test if #507 fixes it?

Also png doesn't work well with kindlegen you should do jpg to avoid reprocessing. If you really want lossless use gif.

@vinhtq115
Copy link
Contributor Author

Can you test if #507 fixes it?

Also png doesn't work well with kindlegen you should do jpg to avoid reprocessing. If you really want lossless use gif.

I just tested with #507 and the behavior is still the same.

@axu2
Copy link
Collaborator

axu2 commented Jul 19, 2023

Can you investigate further, I thought it would fix split page bookmark drift since I re-added some logic that was skipped before.

Look for logic related to kcc-b and kcc-c.

Can you test if drift still occurs if you leave split unchecked? Maybe there needs to be kcc-a logic

@vinhtq115
Copy link
Contributor Author

Can you investigate further, I thought it would fix split page bookmark drift since I re-added some logic that was skipped before.

Look for logic related to kcc-b and kcc-c

Sorry, I forgot to checkout that branch. Will recheck immediately.

@vinhtq115
Copy link
Contributor Author

vinhtq115 commented Jul 19, 2023

I just tested #507 again with this settings (only changed PNG to JPEG):

image

Seems like the pages are shuffled. Even the cover is replaced by another page in the manga.

I also tried renaming all the files in the CBZ with 4-digit numbers and now I have this error:

list index out of range

Traceback:
  File "kindlecomicconverter/KCC_gui.py", line 293, in run
  File "kindlecomicconverter/comic2ebook.py", line 1177, in makeBook
  File "kindlecomicconverter/comic2ebook.py", line 520, in buildEPUB

Update: tested CBZ starting with 0000.jpg and 0001.jpg and both of them have the same error.

@axu2
Copy link
Collaborator

axu2 commented Jul 19, 2023

@vinhtq115 Please test the current version of the PR, just added a sorted

For some reason, it wasn't iterating in sorted order in the first place.

Please also test for the index out of range problem.

@vinhtq115
Copy link
Contributor Author

vinhtq115 commented Jul 19, 2023

@vinhtq115 Please test the current version of the PR, just added a sorted

ToC appears to be fine now. Only managed to test the first entry that is incorrect because the device froze and crashed.

Update: ToC is correct but it is because I disabled image processing to get around the out of index error. So no double page splitting in the file

For some reason, it wasn't iterating in sorted order in the first place.

Please also test for the index out of range problem.

I tested with CBZ file renamed from 0000.jpg. Seems like checking the Disable processing will make the problem go away (but the result mobi file is about 6MB larger than cbz one, while the intermediate epub is about 200-300 KB larger).

@vinhtq115
Copy link
Contributor Author

vinhtq115 commented Jul 19, 2023

The exception only happens if I rename the file to 0000.jpg format. If I keep the original name, it runs fine (but ToC is bugged).

File for testing: https://we.tl/t-EMC3t7UgD7

I printed the filenames and filelist variables in buildEPUB function. It seems that they only have 48 files. Here is the filelist:

[('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0000-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0001-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0002-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0003-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0004-kcc-a.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0005-kcc-b.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0006-kcc-c.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0041-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0043-kcc-a.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0044-kcc-b.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0045-kcc-c.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0058-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images', '0062-kcc-a.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0063-kcc-b.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0064-kcc-c.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0083-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0089-kcc-a.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0090-kcc-b.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0091-kcc-c.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0094-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0102-kcc-a.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0103-kcc-b.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0104-kcc-c.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0155-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0165-kcc-a.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0166-kcc-b.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0167-kcc-c.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0180-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0192-kcc-a.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0193-kcc-b.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0194-kcc-c.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0207-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0219-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0220-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0221-kcc-a.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0222-kcc-b.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0223-kcc-c.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0224-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0225-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0226-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0227-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0228-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0229-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0230-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0231-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0232-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0233-kcc.jpg'),
 ('/var/folders/nk/vbrzxwl93h15t3j0kv8bwfbr0000gn/T/KCC-4t1jq94v/OEBPS/Images',  '0234-kcc.jpg')]

Lots of images were removed after detectCorruption function.

@axu2
Copy link
Collaborator

axu2 commented Jul 19, 2023

Please try the updated PR. Looks like the bookmark logic was buggy. Thanks for providing test files, that logic was previously skipped until I fixed the naming issue.

@vinhtq115
Copy link
Contributor Author

I tested with original CBZ file and the ToC is correct now. For the file that begins with 0000.jpg, I still got the same exception.

@axu2
Copy link
Collaborator

axu2 commented Jul 19, 2023

Also, can you test the latest PR, I believe it has fixed the 0000 issue as well.

And if you have a moment, review the PR in its entirety.

@vinhtq115 vinhtq115 reopened this Jul 20, 2023
@vinhtq115
Copy link
Contributor Author

Seems like the error with 0000.jpg is fixed as well.

Regarding the PR, it looks fine to me.

@axu2
Copy link
Collaborator

axu2 commented Jul 20, 2023

Thanks, and just out of curiosity I was testing this with the Apple Silicon PR merged in on top. Did you do that too?

@vinhtq115
Copy link
Contributor Author

No. I only use slugify branch. Is the Apple Silicon branch this one? I will test it in the morning.

@vinhtq115
Copy link
Contributor Author

vinhtq115 commented Jul 21, 2023

I tested it and everything worked. Had to remove the .spec file that was generated earlier for the compilation to work because if I don't, it will generate a non-functional binary file (size = 1/2 that of functional one).

Update: you may want to increment the number of steps during build_binary

[21/21] Removing temporary image...          [ OK ]
[22/21] Removing target image...             [ OK ]

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

Successfully merging a pull request may close this issue.

2 participants