valos/Komikku
9
102
Fork
You've already forked Komikku
29

[Models] Sort chapters by natsort when fetching next chapter #906

Merged
valos merged 1 commit from nivkner/Komikku:natsort_natsort into main 2026年07月06日 00:29:24 +02:00
Contributor
Copy link

when getting the next chapter sorted by title, only the comparison to the current chapter is done with natsort,
the sorting of the matched chapters is done with regular sort.

so when you have the chapter titles

1 - Example
2 - Example
10 - Example

and you are on chapter 1, since both 10 and 2 are greater than 1 by natsort, they are both listed, but the list is

10 - Example
2 - Example

so 10 is picked by fetchone.

tested with 3 local CBZ files, with ComicInfo.xml containing

<?xml version="1.0" encoding="UTF-8"?>
<ComicInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/anansi-project/comicinfo/main/schema/v2.0/ComicInfo.xsd">
 <Title>Example</Title>
 <Number>$id</Number>
 <Writer>Me</Writer>
</ComicInfo>

where $id is the chapter number for each of the archives.

after the fix, chapter 1 is followed by chapter 2 when sorting by title, as expected.

when getting the next chapter sorted by title, only the comparison to the current chapter is done with `natsort`, the sorting of the matched chapters is done with regular sort. so when you have the chapter titles ``` 1 - Example 2 - Example 10 - Example ``` and you are on chapter 1, since both 10 and 2 are greater than 1 by natsort, they are both listed, but the list is ``` 10 - Example 2 - Example ``` so 10 is picked by `fetchone`. tested with 3 local CBZ files, with `ComicInfo.xml` containing ``` <?xml version="1.0" encoding="UTF-8"?> <ComicInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/anansi-project/comicinfo/main/schema/v2.0/ComicInfo.xsd"> <Title>Example</Title> <Number>$id</Number> <Writer>Me</Writer> </ComicInfo> ``` where `$id` is the chapter number for each of the archives. after the fix, chapter 1 is followed by chapter 2 when sorting by title, as expected.
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
valos/Komikku!906
Reference in a new issue
valos/Komikku
No description provided.
Delete branch "nivkner/Komikku:natsort_natsort"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?