From 492c772bbb8648f73148d37e974711c2c8f0ff6c Mon Sep 17 00:00:00 2001 From: AppleTheGolden Date: Mon, 28 Jul 2025 23:42:23 +0200 Subject: [PATCH] cbz thumbnails: sort alphabetically Comic readers will sort alphabetically, but that isn't always the order in which the files are stored in the zip. --- copyparty/mtag.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/copyparty/mtag.py b/copyparty/mtag.py index a972ef33..cacfda39 100644 --- a/copyparty/mtag.py +++ b/copyparty/mtag.py @@ -166,12 +166,13 @@ def au_unpk( znil = [x for x in znil if "cover" in x[0]] or znil znil = [x for x in znil if CBZ_01.search(x[0])] or znil t = "cbz: %d files, %d hits" % (nf, len(znil)) + using = sorted(znil)[0][1].filename if znil: - t += ", using " + znil[0][1].filename + t += ", using " + using log(t) if not znil: raise Exception("no images inside cbz") - fi = zf.open(znil[0][1]) + fi = zf.open(using) else: raise Exception("unknown compression %s" % (pk,))