From e4469dc7a79e297a2dd8aab75d4720a03bed80e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Fri, 9 Aug 2024 16:00:30 +0200 Subject: [PATCH] Don't use sorting heuristic in comics with more than 1000 pages Sorting heuristic to try to find spreads in the content of a comic is now only used for files with less than 1000 pages to avoid false positives. --- CHANGELOG.md | 3 +++ common/comic.cpp | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52e48c21..8da6e82f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ Version counting is based on semantic versioning (Major.Feature.Patch) * Fix headers in the table view getting stuck in a non moveable state. * Add option to set the type of a library. It will convert all the content to desired type (comic, manga, etc) and it will set that type as the default one for that library. Available in the library context menu. +### All apps +* Sorting heuristic to try to find spreads in the content of a comic is now only used for files with less than 1000 pages to avoid false positives. + ## 9.14.2 ### YACReaderLibrary diff --git a/common/comic.cpp b/common/comic.cpp index 6ddc36c2..6763db2a 100644 --- a/common/comic.cpp +++ b/common/comic.cpp @@ -1067,6 +1067,13 @@ void comic_pages_sort(QList &pageNames, YACReaderPageSortingMode sortin case YACReaderHeuristicSorting: { std::sort(pageNames.begin(), pageNames.end(), naturalSortLessThanCI); + // This heuristic tries to find spreads named like 1011.jpg, which means page 10 and 11 toghether in a single image file + // if the issue has more than 1000 pages lets not use this heuristic to avoid false positives. + // Alternativelly the heuristic could be improved but I don't think it's worth the effort. + if (pageNames.size() >= 1000) { + return; + } + QList singlePageNames; QList doublePageNames;