kcc icon indicating copy to clipboard operation
kcc copied to clipboard

Pages outputted as out of order.

Open VictorGamerLOL opened this issue 2 years ago • 1 comments

In every file explorer, the pages are in what order they are supposed to be. Windows file explorer and 7 zip have the correct alphabetical order.

I have discovered that this is due to the program putting the character of "#" before a space, which causes stuff like extras to come before the final chapter of a volume.

Who am I kidding this has not been updated in 2 years..

VictorGamerLOL avatar Jan 20 '22 20:01 VictorGamerLOL

Here is an original directory with images

$ls -1 images_orig/
'0 0.png'
'0 2.png'
01.png
03.png
04.png
05.png
06.png
07.png
08.png
09.png
10.png

I converted it to cbz.

Here is the result of the extract:

ls -1 images_converted/
0000-0000-kcc.jpg
0000-0002-kcc.jpg
0001-kcc-a.jpg
0001-kcc-b.jpg
0001-kcc-c.jpg
0003-kcc.jpg
0004-kcc.jpg
0005-kcc.jpg
0006-kcc.jpg
0007-kcc.jpg
0008-kcc.jpg
0009-kcc.jpg
0010-kcc.jpg

Where do you see the character "#"? :raised_eyebrow:

Expecting a proper example/description in an issue... who am am I kidding? :smirk:

darodi avatar May 10 '22 22:05 darodi

Some sources where I get my images label chapters and page numbers using # . Sometimes it is for all of them, sometimes for special sections like extras. The fact that some sources put # after the chapter number for extras in fact causes the extras to show up before the actual chapter and not respect the index if any. What I think my past self thought is that KCC considered a # to come before a space in page ordering, which I find strange since # comes after space in ASCII, causing it to not be the same order as explorer would otherwise display. This also happened for pages labelled like 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 instead 01, 02, 03, 04, 05, 06, 07, 08, 09, 10 although I can understand why that happens. Also sorry for my unfavorable message back then I really did not expect any response at all.

VictorGamerLOL avatar Feb 05 '23 00:02 VictorGamerLOL

Do you mean something like this?

Even in OSes, the order is # before the number

image image

darodi avatar Feb 08 '23 18:02 darodi

I means more something like this, since most translation groups like to add their name at the end of every page image

When I was a windows user, these used to show up in the order I would expect in 7zip and it shows up as I would expect it in peazip as well at the moment, but after checking for myself turns out that they do show up in this order in LS. I still find this strange going after an ascii table.

EDIT: I should also mention they show up as expected in my file manager kursader as well but then again you can customize how it sorts :/

EDIT 2: They show up as expected in comictagger as well, so it is a bit off-putting when they show up in the wrong order when reading. Also if any of this is wrong pardon me as I have changed the ways I tag my manga now.

VictorGamerLOL avatar Feb 08 '23 18:02 VictorGamerLOL

KCC is just using the OS order, and '#' comes before ' '.

renaming using another char would fix it

$ sudo apt install rename
$ ls -al
total 10092
drwxrwxrwx 1 rodi rodi     512 Feb  8 20:14 .
drwxrwxrwx 1 rodi rodi     512 Feb  8 19:29 ..
-rwxrwxrwx 1 rodi rodi 1020406 Feb  5 12:52 chapter00#06.png
-rwxrwxrwx 1 rodi rodi  858301 Feb  5 12:51 chapter00.png
-rwxrwxrwx 1 rodi rodi  797510 Feb  5 12:51 chapter01.png
-rwxrwxrwx 1 rodi rodi  990863 Feb  5 12:51 chapter02.png
-rwxrwxrwx 1 rodi rodi 1028155 Feb  5 12:51 chapter03.png
-rwxrwxrwx 1 rodi rodi  911087 Feb  5 12:51 chapter04.png
-rwxrwxrwx 1 rodi rodi  926159 Feb  5 12:52 chapter05.png
-rwxrwxrwx 1 rodi rodi 1020406 Feb  5 12:52 chapter06.png
-rwxrwxrwx 1 rodi rodi 1053624 Feb  5 12:52 chapter07.png
-rwxrwxrwx 1 rodi rodi  833632 Feb  5 12:52 chapter08.png
-rwxrwxrwx 1 rodi rodi  865251 Feb  5 12:52 chapter09.png

$ rename -v 's/#/z/g' *
chapter00#06.png renamed as chapter00z06.png


ls -al
total 10092
drwxrwxrwx 1 rodi rodi     512 Feb  8 20:14 .
drwxrwxrwx 1 rodi rodi     512 Feb  8 19:29 ..
-rwxrwxrwx 1 rodi rodi  858301 Feb  5 12:51 chapter00.png
-rwxrwxrwx 1 rodi rodi 1020406 Feb  5 12:52 chapter00z06.png
-rwxrwxrwx 1 rodi rodi  797510 Feb  5 12:51 chapter01.png
-rwxrwxrwx 1 rodi rodi  990863 Feb  5 12:51 chapter02.png
-rwxrwxrwx 1 rodi rodi 1028155 Feb  5 12:51 chapter03.png
-rwxrwxrwx 1 rodi rodi  911087 Feb  5 12:51 chapter04.png
-rwxrwxrwx 1 rodi rodi  926159 Feb  5 12:52 chapter05.png
-rwxrwxrwx 1 rodi rodi 1020406 Feb  5 12:52 chapter06.png
-rwxrwxrwx 1 rodi rodi 1053624 Feb  5 12:52 chapter07.png
-rwxrwxrwx 1 rodi rodi  833632 Feb  5 12:52 chapter08.png
-rwxrwxrwx 1 rodi rodi  865251 Feb  5 12:52 chapter09.png

another option would be to adapt this to use the sort method you would like

https://github.com/ciromattia/kcc/blob/3a1737e8d0052bc993a5767a8033c8ff12ff1007/kindlecomicconverter/shared.py#L55-L60

darodi avatar Feb 08 '23 19:02 darodi

  • Duplicate #362

darodi avatar Feb 08 '23 20:02 darodi

For anyone else stumbling over this problem, here's the simplest patch I could come up with that just disables the renaming. Will break generating chapter titles for epub from folder names.

diff --git a/kindlecomicconverter/comic2ebook.py b/kindlecomicconverter/comic2ebook.py
index e1941be..7ea4f65 100755
--- a/kindlecomicconverter/comic2ebook.py
+++ b/kindlecomicconverter/comic2ebook.py
@@ -744,6 +744,7 @@ def getPanelViewSize(deviceres, size):
 
 
 def sanitizeTree(filetree):
+    return {}
     chapterNames = {}
     for root, dirs, files in os.walk(filetree, False):
         for name in files:

apply using git apply

Scotsguy avatar Mar 01 '23 16:03 Scotsguy