diff --git a/comicapi/comicarchive.py b/comicapi/comicarchive.py index e887098..0d850a4 100644 --- a/comicapi/comicarchive.py +++ b/comicapi/comicarchive.py @@ -148,7 +148,7 @@ class SevenZipArchiver(UnknownArchiver): def get_filename_list(self) -> list[str]: try: with py7zr.SevenZipFile(self.path, "r") as zf: - namelist: list[str] = zf.getnames() + namelist: list[str] = [file.filename for file in zf.list() if not file.is_directory] return namelist except (py7zr.Bad7zFile, OSError) as e: @@ -248,7 +248,7 @@ class ZipArchiver(UnknownArchiver): def get_filename_list(self) -> list[str]: try: with zipfile.ZipFile(self.path, mode="r") as zf: - namelist = zf.namelist() + namelist = [file.filename for file in zf.infolist() if not file.is_dir()] return namelist except (zipfile.BadZipfile, OSError) as e: logger.error("Error listing files in zip archive [%s]: %s", e, self.path) @@ -934,7 +934,7 @@ class ComicArchive: # seems like some archive creators are on Windows, and don't know about case-sensitivity! if sort_list: - files = cast(list[str], natsort.natsorted(files, alg=natsort.ns.IC | natsort.ns.I | natsort.ns.U)) + files = cast(list[str], natsort.os_sorted(files)) # make a sub-list of image files self.page_list = [] diff --git a/requirements.txt b/requirements.txt index 0084ebd..2f88c88 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,7 @@ pathvalidate pillow>=9.1.0 py7zr pycountry +pyicu; sys_platform == 'linux' or sys_platform == 'darwin' requests==2.* text2digits thefuzz>=0.19.0 diff --git a/testing/data/Cory Doctorow's Futuristic Tales of the Here and Now #001 - Anda's Game (2007).cbz b/testing/data/Cory Doctorow's Futuristic Tales of the Here and Now #001 - Anda's Game (2007).cbz index a228fd0..e12d05b 100644 Binary files a/testing/data/Cory Doctorow's Futuristic Tales of the Here and Now #001 - Anda's Game (2007).cbz and b/testing/data/Cory Doctorow's Futuristic Tales of the Here and Now #001 - Anda's Game (2007).cbz differ diff --git a/testing/data/fake_cbr.cbr b/testing/data/fake_cbr.cbr index 1157aec..50f2aed 100644 Binary files a/testing/data/fake_cbr.cbr and b/testing/data/fake_cbr.cbr differ diff --git a/tests/comicarchive_test.py b/tests/comicarchive_test.py index 27b3cb2..0f1aadf 100644 --- a/tests/comicarchive_test.py +++ b/tests/comicarchive_test.py @@ -15,6 +15,8 @@ def test_getPageNameList(): pageNameList = c.get_page_name_list() assert pageNameList == [ + "!cover.jpg", + "00.jpg", "page0.jpg", "Page1.jpeg", "Page2.png",