From c9b5bd625fb45f50d659b76325e105ebb7236f94 Mon Sep 17 00:00:00 2001 From: "Andrew W. Buchanan" Date: Mon, 4 Apr 2022 22:34:31 -0400 Subject: [PATCH 1/2] Fix parsing of filenames that end with an ID such as [__######__] --- comicapi/filenameparser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comicapi/filenameparser.py b/comicapi/filenameparser.py index f669a96..f2250c5 100644 --- a/comicapi/filenameparser.py +++ b/comicapi/filenameparser.py @@ -89,7 +89,7 @@ class FileNameParser: # is the series name followed by issue filename = re.sub(r"--.*", self.repl, filename) - elif "__" in filename: + elif "__" in filename and not re.search('\\[__\\d+__\\]', filename): # the pattern seems to be that anything to left of the first "__" # is the series name followed by issue filename = re.sub(r"__.*", self.repl, filename) From d4470a2015cd39df6e4c7b76bc5c800349be9f80 Mon Sep 17 00:00:00 2001 From: abuchanan920 Date: Tue, 5 Apr 2022 10:37:33 -0400 Subject: [PATCH 2/2] Use more idiomatic regular expression string Co-authored-by: Timmy Welch --- comicapi/filenameparser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comicapi/filenameparser.py b/comicapi/filenameparser.py index f2250c5..c2fb459 100644 --- a/comicapi/filenameparser.py +++ b/comicapi/filenameparser.py @@ -89,7 +89,7 @@ class FileNameParser: # is the series name followed by issue filename = re.sub(r"--.*", self.repl, filename) - elif "__" in filename and not re.search('\\[__\\d+__\\]', filename): + elif "__" in filename and not re.search(r"\[__\d+__\]", filename): # the pattern seems to be that anything to left of the first "__" # is the series name followed by issue filename = re.sub(r"__.*", self.repl, filename)